0

I have an sql file being called from shell script, and I want to capture the output of the execution into a log file. I am trying to capture by appending redirecting to log file like this >> log.txt but it is not working.

What do I need to do to fix it?

sqlplus -s ${USER}/${PWD}@${DATABASE} << EOF
@${LOADDIR}/VV_validation.sql
EOF'
1
  • There's at least a decent chance that sqlplus -s ${USER}/${PWD}@${DATABASE} << EOF >> log.txt 2>&1 would do the job. The 2>&1 sends standard error (file descriptor 2) to the same place that standard output (file descriptor 1) is going, namely the log.txt file. Commented May 2, 2015 at 2:46

1 Answer 1

1

Try this:

sqlplus -s ${USER}/${PWD}@${DATABASE}
spool your_file_name.log
@@${LOADDIR}/VV_validation.sql
spool off
Sign up to request clarification or add additional context in comments.

2 Comments

this is working, but spool is overwriting my log file, which was written already by previous statements.... is there anyway i can append ?
I tried with APPEND like this 'sqlplus -s ${USER}/${PWD}@${DATABASE} spool your_file_name.log APPEND @@${LOADDIR}/VV_validation.sql spool off' and it worked... thanks @StephaneM

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.