1. RMAN Incremental Level 0 Disk Backup with archivelog
oracle@d**db1 [/u02/app/oracle]$ cat 01.daily_rman_level0_disk_backup.sh
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=d**db1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6
dt=`date '+%d%m%Y%H%M'`
LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL0_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 0 BACKUP STARTED on `date` " >$LOG_FILE
rman <<! >>$LOG_FILE
connect target r**nbkp/r**nbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
sql "alter system switch logfile";
backup incremental level 0 AS COMPRESSED BACKUPSET database tag 'LEV0_T24_DB_$dt' format '/db_rmanbackup/t24_db_l0_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'daily_arch_bkp_disk' format '/db_rmanbackup/t24_arch_%p_%s_$dt.bkp';
backup current controlfile tag T24_CTL_$dt format '/db_rmanbackup/t24_ctl_lv0_%p_%s_$dt.bkp';
backup spfile tag T24_SPF_$dt format '/db_rmanbackup/t24_spf_lv0_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB DAILY LEVEL 0 BACKUP FINISHIED on `date` " >>$LOG_FILE
exit 0
oracle@d**db1 [/u02/app/oracle]$
2. RMAN Incremental Level 1 Disk Backup with Archivelog
oracle@d**db1 [/u02/app/oracle]$ cat 02.daily_rman_level1_disk_backup.sh
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=d**db1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6
dt=`date '+%d%m%Y%H%M'`
LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL1_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 1 BACKUP STARTED on `date` " >$LOG_FILE
rman <<! >>$LOG_FILE
connect target r**nbkp/r**nbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
sql "alter system switch logfile";
backup incremental level 1 cumulative AS COMPRESSED BACKUPSET database tag 'LEV1_T24_DB_$dt' format '/db_rmanbackup/t24_db_l1_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'daily_arch_bkp_disk' format '/db_rmanbackup/t24_arch_%p_%s_$dt.bkp';
backup current controlfile tag T24_CTL_$dt format '/db_rmanbackup/t24_ctl_lv0_%p_%s_$dt.bkp';
backup spfile tag T24_SPF_$dt format '/db_rmanbackup/t24_spf_lv0_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB LEVEL 1 BACKUP FINISHIED on `date` " >>$LOG_FILE
exit 0
oracle@d**db1 [/u02/app/oracle]$
3. RMAN level 0 disk backup (Monthly)
oracle@d**db1 [/u02/app/oracle]$ cat 03.monthly_rman_level0_disk_backup.sh
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=d**db1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6
dt=`date '+%d%m%Y%H%M'`
LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_Monthly_LEVEL0_BACKUP_${dt}.log
echo "DCPDB MONTHLY LEVEL 0 BACKUP STARTED on `date` " >$LOG_FILE
rman <<! >>$LOG_FILE
connect target r**nbkp/r**nbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
sql "alter system switch logfile";
backup incremental level 0 AS COMPRESSED BACKUPSET database tag 'MONTHLY_L0_T24_DB_$dt' format '/db_rmanbackup/t24_db_month_%p_%s_$dt.bkp' keep until time 'sysdate+1095';
backup AS COMPRESSED BACKUPSET archivelog all tag 'monthly_arch_bkp_disk' format '/db_rmanbackup/t24_arch_%p_%s_$dt.bkp' keep until time 'sysdate+1095';
backup current controlfile tag T24_CTL_$dt format '/db_rmanbackup/t24_ctl_lv0_%p_%s_$dt.bkp';
backup spfile tag T24_SPF_$dt format '/db_rmanbackup/t24_spf_lv0_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB MONTHLY LEVEL 0 BACKUP FINISHIED on `date` " >>$LOG_FILE
exit 0
oracle@d**db1 [/u02/app/oracle]$
3. RMAN level 0 disk backup (Yearly)
oracle@dcpdb1 [/u02/app/oracle]$ cat 04.yearly_rman_level0_disk_backup.sh
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=d**db1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6
dt=`date '+%d%m%Y%H%M'`
LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_Yearly_LEVEL0_BACKUP_${dt}.log
echo "DCPDB YEARLY LEVEL 0 BACKUP STARTED on `date` " >$LOG_FILE
rman <<! >>$LOG_FILE
connect target r**nbkp/r**nbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
sql "alter system switch logfile";
backup incremental level 0 AS COMPRESSED BACKUPSET database tag 'YEARLY_L0_T24_DB_$dt' format '/db_rmanbackup/t24_db_year_l0_%p_%s_$dt.bkp' keep until time 'sysdate+3650';
backup AS COMPRESSED BACKUPSET archivelog all tag 'yearly_arch_bkp_disk' format '/db_rmanbackup/t24_arch_%p_%s_$dt.bkp' keep until time 'sysdate+3650';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB YEARLY LEVEL 0 BACKUP FINISHIED on `date` " >>$LOG_FILE
exit 0
oracle@d**db1 [/u02/app/oracle]$
No comments:
Post a Comment