11011110000
MIS
Oracle rman backup with Netbackup.
The problem is that unlike TSM you cannot put the 'su - oracle -c scriptname' inside the scheduler and have it run. The only way I have found so far is to write a script that does an 'su - oracle -c "scriptname"' to have scriptname run. Can anyone think of a way to su to oracle and have the script run within the same script?
I don't want to create multiple su scripts to do this.
The rman script
The problem is that unlike TSM you cannot put the 'su - oracle -c scriptname' inside the scheduler and have it run. The only way I have found so far is to write a script that does an 'su - oracle -c "scriptname"' to have scriptname run. Can anyone think of a way to su to oracle and have the script run within the same script?
I don't want to create multiple su scripts to do this.
The rman script
Code:
#!/bin/ksh
export scripts=/`uname -n`/oracle/scripts
. $scripts/set_localqnoldv01.sh
###############################################################
cd $scripts
export RMAN_LOG=$scripts/logs/Rarch_${ORACLE_SID}_$(date +%m%d%y_%T).log
export JOB_TYPE=" Arch only "
find $scripts/scripts -name ${ORACLE_SID}_del_arch_back.scr -exec rm {} \; >/dev/null
cat <<EOF > $scripts/scripts/${ORACLE_SID}_del_arch_back.scr
run {
sql 'alter system checkpoint' ;
allocate channel dev1 type 'SBT_TAPE'
send 'NB_ORA_POLICY=oracle_`hostname` , NB_ORA_SERV=nbuhost' ;
allocate channel dev2 type 'SBT_TAPE'
send 'NB_ORA_POLICY=oracle_`hostname` , NB_ORA_SERV=nbuhost' ;
sql 'alter system checkpoint' ;
sql 'alter system archive log current';
backup
filesperset 40
format 'al_%d_$(date +%H%M_%d%m%y)_%s_%p'
(archivelog from time '08 OCT 2004 11:25:00' until time 'SYSDATE' delete input) ;
release channel dev1 ;
release channel dev2 ;
}
###############################################################
EOF
echo "Job Started at:" `date +(%b %d %T) |cut -c2-16` > $RMAN_LOG
$CATALOG cmdfile=$scripts/${ORACLE_SID}_del_arch_back.scr msglog=$RMAN_LOG append
echo " Completed at:" `date +(%b %d %T) |cut -c2-16` >> $RMAN_LOG
find $scripts/ -name ${ORACLE_SID}_del_arch_back.scr -exec rm {} \; >/dev/null