2

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 unix or sqlplus ?

3 Answers 3

7

Use the SPOOL command:

SQL> SPOOL /opt/output

SQL> SELECT ...

SQL> SPOOL OFF
Sign up to request clarification or add additional context in comments.

Comments

1

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
!!

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.