set colsep' '; //域输出分隔符
set echo off;//显示start启动的脚本中的每个sql命令,缺省为on
set feedback off;//回显本次sql命令处理的记录条数,缺省为on
set heading off; //输出域标题,缺省为on
set pagesize 0;//输出每页行数,缺省为24,为了避免分页,可设定为0。
set termout off; //显示脚本中的命令的执行结果,缺省为on
set trimout on;//去除标准输出每行的拖尾空格,缺省为off
set trimspool on;//去除重定向(spool)输出每行的拖尾空格,缺省为off
这样就可以得到很纯净的脚本了
另外,如果在shell脚本中调用SQLPLUS,希望出来SQL语句结果以外,什么都不输出,可以使用-s参数,有意想不到的惊喜哦
比如,不使用-s参数的结果:
[oracle@rac01 ~]$ cat testsqlplus.sh
#!/bin/bash
sqlplus "/ as sysdba" <
select * from dual;
exit;
EOF
exit 0
结果如下:
[oracle@rac01 ~]$ cat testsqlplus.log
SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 19 21:31:56 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
D
-
X
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
使用-s参数的结果如下:
[oracle@rac01 ~]$ cat test.log
D
-
X
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/469356/viewspace-758912/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/469356/viewspace-758912/