rman_backup.sh
. /u02/PROD_gtebsdb1p.env
CDATE=`date +%d-%m-%Y-%H-%M`
export CDATE;
mkdir -p /backups/rman/rman_backup/$CDATE
export LOGFILE=/backups/rman/rman_backup/$CDATE/rman_backup_log_${CDATE}.log
touch $LOGFILE
rman target / << EOF | tee -i $LOGFILE
run {
sql "alter system archive log current";
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
backup format='/backups/rman/rman_backup/$CDATE/Tp_cntl_%Y%M%D_%d_%s_%p_1.ctl' current controlfile;
backup as compressed backupset format='/backups/rman/rman_backup/$CDATE/%U' database;
backup format='/backups/rman/rman_backup/$CDATE/%d_%s_%p_%c_%t.arc' archivelog FROM TIME 'SYSDATE-2' UNTIL TIME 'SYSDATE';
backup format='/backups/rman/rman_backup/$CDATE/Tp_cntl_%Y%M%D_%d_%s_%p_2.ctl' current controlfile;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
}
exit
No comments:
Post a Comment