开发者

I want to copy the output of unix and sqlplus into a file

I am using Solaris. I have to log into sql plus and run some queries, which give a huge result set.

I want to copy all that into a file. Is there any command for it in开发者_如何学C unix or sqlplus ?


Use the SPOOL command:

SQL> SPOOL /opt/output

SQL> SELECT ...

SQL> SPOOL OFF


setup Oracle environment

(there are ways around specifying username/password on the command line - not the best way especially when other users can 'ps' on the server and see your password)

sqlplus -s username/password <<-!!
set trimspool on trimout on pages 0 feedback off linesize 1000 echo off verify off
spool file.out
select sysdate from dual;
exit
!!


If you are on the command line then just use the > and 2> to redirect stdout and stderr respectively to log files

func > out.log

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜