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!

calling oracle scripts from a unix shell and piping to log

851698Aug 24 2011 — edited Aug 24 2011
I have a unix shell script that among other things spools large files to an output directory. I send certain things in my shell to a log file.
#!/bin/csh -f

main_dir='/home/michelle/'
log_dir=$main_dir'log_files/'
sh_dir=$main_dir'shell_scripts/'
in_dir=$main_dir'input_files/'
sql_dir=$main_dir'sql_scripts/'
out_dir=$main_dir'output_files/'
ldate=`date +%Y%m%d`
log='output1_'$ldate

. /usr/sysops/setAppEnv.sh

echo '(1) EXPORT OUTPUT1' > $log
sqlplus -s $user1/$pswd1@$db1 @$sql_dir'output1.sql'
Output1.sql has:
set pagesize 0
set trimspool on
set linesize 4000
set echo off
SET VERIFY OFF
set serveroutput off
set feedback off
set long 4000
set wrap off

spool /home/michelle/output_files/Output1.csv

[SQL STATEMENT THAT PULLS THE DATA FOR THE EXPORT]

spool off

exit
I execute my shell by typing:
nohup sh export_files.sh &
I do not know much about shell scripting - it has just been introduced to me. I would like the log to include what I pipe to it plus any errors from oracle but I do not want the spooled data. The spooled data is somehow getting in the log file which has large amounts of data too large to open to view.

Thank you,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2011
Added on Aug 24 2011
3 comments
1,023 views