fildien
07-24-2008, 12:13 PM
I need to capture the exit code of the actual RMAN part of this script and not the other stuff. I know the answer is staring me in the face but I can't think of a simple way to do this without evaluating the exit of each step and dumping them to a file and the parsing the file. Seems bulky, there has to be an easier way, please help if you can.
I always get a fricking exit code of 0 no matter what I do.
#!/usr/bin/ksh
# 07-23-08 created
# 07-24-08 removed mailx line
set -x
export ORACLE_HOME=/u01/app/oracle/product/9.2.0.8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=kprd
export LD_LIBRARY_PATH=/opt/CA/SharedComponents/JRE/1.4.2/lib:/u01/app/oracle/product/9.2.0.8/lib:/u01/app/oracle/product/9.2.0.8/jd
bc/lib
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=kprd
export PATH=/usr/bin:/usr/local/bin:/usr/bin/sh:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.:/u01/app/oracle/produc
t/9.2.0.8/bin:/u01/app/oracle/scripts
export CLASSPATH=/opt/CA/SharedComponents/JRE/1.4.2/lib/tools.jar:/u01/app/oracle/product/9.2.0.8/jdbc/lib/classes12.zip
TimeStamp=`date +%Y%m%d_%H%M%S`
export LOG=/backup1/rman_bkp_logs/kprd/${ORACLE_SID}_archive_log-${TimeStamp}.log
echo "Starting Time: `date`" > ${LOG}
/u01/app/oracle/product/9.2.0.8/bin/rman target / catalog rman/blahblahblah@rman1 <<! | tee -a ${LOG}
set echo on;
change archivelog all validate;
resync catalog;
run {
allocate channel t1 device type sbt format 'kprd_arch_%u_%p_%c'
parms='SBT_LIBRARY=/opt/CA/BABoraagt/libobk64.so' ;
BACKUP ARCHIVELOG ALL;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 3 TIMES TO DEVICE TYPE 'SBT_TAPE';
}
exit 3
I always get a fricking exit code of 0 no matter what I do.
#!/usr/bin/ksh
# 07-23-08 created
# 07-24-08 removed mailx line
set -x
export ORACLE_HOME=/u01/app/oracle/product/9.2.0.8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=kprd
export LD_LIBRARY_PATH=/opt/CA/SharedComponents/JRE/1.4.2/lib:/u01/app/oracle/product/9.2.0.8/lib:/u01/app/oracle/product/9.2.0.8/jd
bc/lib
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=kprd
export PATH=/usr/bin:/usr/local/bin:/usr/bin/sh:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.:/u01/app/oracle/produc
t/9.2.0.8/bin:/u01/app/oracle/scripts
export CLASSPATH=/opt/CA/SharedComponents/JRE/1.4.2/lib/tools.jar:/u01/app/oracle/product/9.2.0.8/jdbc/lib/classes12.zip
TimeStamp=`date +%Y%m%d_%H%M%S`
export LOG=/backup1/rman_bkp_logs/kprd/${ORACLE_SID}_archive_log-${TimeStamp}.log
echo "Starting Time: `date`" > ${LOG}
/u01/app/oracle/product/9.2.0.8/bin/rman target / catalog rman/blahblahblah@rman1 <<! | tee -a ${LOG}
set echo on;
change archivelog all validate;
resync catalog;
run {
allocate channel t1 device type sbt format 'kprd_arch_%u_%p_%c'
parms='SBT_LIBRARY=/opt/CA/BABoraagt/libobk64.so' ;
BACKUP ARCHIVELOG ALL;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 3 TIMES TO DEVICE TYPE 'SBT_TAPE';
}
exit 3