Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

stdout, stderr, and sqlplus

EdStevensAug 13 2012 — edited Aug 13 2012
Oracle 11.2.0.1.0 and 10.2.0.4.0
OL 5.6 x86-64

This kind of comes in the cracks between Oracle and Linux ...

At this shop, any ouput of a cron job that is not redirected is sent by email to the owner of the job. So if I have a crontab entry
* * * * * /home/snuffy/myscript.sh 
all stdout and errout gets emailed from "Cron Daemon" to the owner of the crontab.

If the line is
* * * * * /home/snuffy/myscript.sh > /tmp/snuffy.lis
of course the stdout goes to the file, but errout - not being redirected - still gets emailed.

Now here's the weird part, and why I'm posting to the db forum and not the Linux forum.

In my shell script I have this:
sqlplus -s /nolog <<EOF! >>$logfile
-- some sqlpluse commands and sql statements
EOF!
So all of the ouput of sqlplus should be appended to $logfile.
However, if there are any ORA- messages generated (like say 'ORA-00942: table or view does not exist') that still gets emailed by cron daemon, as if it were errout.
But the messages are also being written to $logfile.
I even modified the script to read
sqlplus -s /nolog <<EOF! >>$logfile 2>&1
And the ORA- messages (only) still got the email from cron daemon ....

Color me ... perplexed.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2012
Added on Aug 13 2012
1 comment
1,165 views