sqlplus

sql plus output is not coming in proper CSV format if we use the colsep ,

怎甘沉沦 提交于 2021-02-08 10:25:21
问题 The issue i am facing is that even the data in the CSV file also getting separated if the value consists of , (comma) I am using shell script connect to oracle using the sql plus and spooling the data in the CSV file In the CSV the colsep , (comma) is working fine to separate columns but the data also getting separated. for example if the value of the company name is (Southern textiles,LICO ) In that case even SOuttheren textiles is in one column and LICO is moving to another column and thee

How to insert list as parameter from powershell to SqlPlus

橙三吉。 提交于 2021-02-08 07:24:55
问题 I have a query which is like this in a file : script.sql select * from test_table where name in (&1) This is an example of query i'm trying to make and i execute it with a power shell script which is like this : $names = '''Name1'', ''Name2''' $params = '"' + $names + '"' sqlplus -silent $username/$password@$tnsalias "@script.sql" $params Note that $names has a variable list of names But then when the script is executed, the parameter get substitute like this : former : where name in (&1) new

How to insert list as parameter from powershell to SqlPlus

此生再无相见时 提交于 2021-02-08 07:23:00
问题 I have a query which is like this in a file : script.sql select * from test_table where name in (&1) This is an example of query i'm trying to make and i execute it with a power shell script which is like this : $names = '''Name1'', ''Name2''' $params = '"' + $names + '"' sqlplus -silent $username/$password@$tnsalias "@script.sql" $params Note that $names has a variable list of names But then when the script is executed, the parameter get substitute like this : former : where name in (&1) new

How to insert list as parameter from powershell to SqlPlus

戏子无情 提交于 2021-02-08 07:22:11
问题 I have a query which is like this in a file : script.sql select * from test_table where name in (&1) This is an example of query i'm trying to make and i execute it with a power shell script which is like this : $names = '''Name1'', ''Name2''' $params = '"' + $names + '"' sqlplus -silent $username/$password@$tnsalias "@script.sql" $params Note that $names has a variable list of names But then when the script is executed, the parameter get substitute like this : former : where name in (&1) new

Oracle sqlplus comments

巧了我就是萌 提交于 2021-02-08 05:44:23
问题 Why does the following insert statement not work when executed like sqlplus <connect> @file INSERT INTO abc ( a ,b ,c) VALUES ( '1' --a ,'2' --b ,'3'); --c but it works without the comments i.e INSERT INTO abc ( a ,b ,c) VALUES ( '1' ,'2' ,'3'); Does sqlplus flatten the file i.e execute the whole thing on a single line? which might result in rest of the line getting commented out? 回答1: The fist insert statement didn't work only because of the last comment --c you've placed after the statement

oracle数据泵导入导出数据

只谈情不闲聊 提交于 2021-01-31 09:51:18
数据泵是10g推出的功能,个人倒数据比较喜欢用数据泵。 其导入的时候利用remap参数很方便转换表空间以及schema,并且可以忽略服务端与客户端字符集问题(exp/imp需要排查字符集)。 数据泵也有不方便的地方,如果远程导出导入,必须安装数据库服务端(client不行);需要在数据库中创建一个路径directory(dba_directories);并且主流工具支持exp/imp的导入导出(plsql developer),所以发现数据泵流行程度没有想象中高。 以下简单介绍schema的导入导出 以schema方式导出生产库用户下所有对象,并导入测试库。 注:eamdb为生产库,eamprd为生产库用户,密码为eamprd eamuat为测试库,eamprduat为测试库用户,密码为eamprduat 一、 生产库的导出(以 sqlplus 命令行的方式)。 1.以sys或者system用户身份登录生产数据库。 2.创建schema导出路径(DUMP_DIR名称可替换),并在dba_directories中查看 create directory DUMP_DIR as ‘/xxx/xxx’; select * from dba_directories; 3.把导出路径与导出权限授权给eamprd,如果用system等高级帐号导出,则不用。 grant read,write on

Oracle数据泵导入导出

☆樱花仙子☆ 提交于 2021-01-31 09:18:30
由于在oracle11g之后的某些版本中,采用exp方式导出数据会导致空表被漏掉,解决办法分为两种: 一、对空表进行插入操作,然后再删除数据。 二、采用数据泵的方式导出。 本文介绍第二种方式。 导出: 1、从cmd中以dba权限登录数据库:sqlplus system/密码@orcl as sysdba; 2、创建目录: Create directory TEST as 'd:\test'; 3、授权:Grant read,write on directory TEST to yxf; 4、对应第二步所创建的目录,在数据库服务端的d盘新建文件夹test; 5、退出数据库登录:quit; 6、导出: Ø 单个用户 方案导出 Expdp [用户名]/[密码]@[主机字符窜] schemas=[用户名] directory=TEST dumpfile=X.dmp logfile=X.log Ø 数据库全库 导出 Expdp [用户名]/[密码]@[主机字符窜] full=y directory=TEST dumpfile=X.dmp logfile=X.log 执行完以上两步后,即可在d://test文件夹下看到导出的数据文件X.dmp,以及导出日志X.log 导入:与导出的前面5步相同 1、从cmd中以dba权限登录数据库:sqlplus system/密码@orcl as

DBMS_PARALLEL_EXECUTE and indirectly given grants on procedure

落爺英雄遲暮 提交于 2021-01-28 04:00:50
问题 I just bumped into some strange behaviour of DBMS_PARALLEL_EXECUTE (at least for me). See my preset (executed as SYS): -- Preset drop user usr1 cascade; create user usr1 identified by usr1; create or replace procedure usr1.do_stuff(p1 in number, p2 in number) is begin dbms_output.put_line('I did stuff!'); end; / drop user usr2 cascade; create user usr2 identified by usr2; grant connect to usr2; grant create job to usr2; drop role stuff_doer cascade; create role stuff_doer; grant execute on

DBMS_PARALLEL_EXECUTE and indirectly given grants on procedure

孤者浪人 提交于 2021-01-28 03:23:28
问题 I just bumped into some strange behaviour of DBMS_PARALLEL_EXECUTE (at least for me). See my preset (executed as SYS): -- Preset drop user usr1 cascade; create user usr1 identified by usr1; create or replace procedure usr1.do_stuff(p1 in number, p2 in number) is begin dbms_output.put_line('I did stuff!'); end; / drop user usr2 cascade; create user usr2 identified by usr2; grant connect to usr2; grant create job to usr2; drop role stuff_doer cascade; create role stuff_doer; grant execute on

oracle安装rlwrap

别等时光非礼了梦想. 提交于 2021-01-15 13:19:31
wget https://fossies.org/linux/privat/rlwrap-0.43.tar.gz yum -y install readline* https://fossies.org/linux/privat/rlwrap-0.43.tar.gz tar zxvf rlwrap-0.43.tar.gz cd rlwrap-0.43 ./configure make && make install alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' 来源: oschina 链接: https://my.oschina.net/u/4339481/blog/4899828