** Myself
export RMAN_DIR=/oraback
export LOGDIR=${RMAN_DIR}/log
export RMAN_LOG=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.log
export RMAN_ERR=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.err 
############# Delete old archivelog last 2 date####################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
rman nocatalog<<END_SQL
connect target;
run {
 set command id to 'rman';
 crosscheck archivelog all;
 allocate channel t1 type sbt;
 backup filesperset 5 archivelog until time 'Sysdate-2' all delete input;
 release channel t1;
 }
exit
END_SQL 
############# Hot Backup database #################################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
run {
set command id to 'rman';
allocate channel t1 type sby;
backup
filesperset 5
database;
release channel t1;
}
exit
END_SQL 
############# Backup archive logs #################################
rman nocatalog<<END_SQL
connect target;
run {
 set command id to 'rman';
 allocate channel t1 type sbt;
 backup filesperset 5  
 archivelog all;
 release channel t1;
 }
exit
END_SQL
0 comments:
Post a Comment