Incremental Updated Backup or Rolling Forward Backup



#!/bin/bash
# Declare your environment variables
export ORACLE_SID=xxxxx
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
log_date=$(date +%Y%m%d)
rman target=/ << EOF
spool log to /u03/fast_recovery_area/xxxxx/RMAN/backup_logs_$ORACLE_SID_${log_date}.log
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/fast_recovery_area/xxxxx/RMAN/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC';
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
# List of Database Incarnations
list incarnation;

# Incrementally updated backup with a retention policy of 7 days
# The backup is set to check for logical corruption   (BACKUP CHECK LOGICAL)
run {
RECOVER COPY OF DATABASE with TAG 'xxxxx_LVL0_MERGE_INCR' UNTIL TIME 'SYSDATE-8';
ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK FORMAT '/u03/fast_recovery_area/xxxxx/RMAN/bkp_%d_set%s_%T_%U';
BACKUP CHECK LOGICAL INCREMENTAL LEVEL 1 FOR RECOVER OF COPY with TAG 'xxxxx_LVL0_MERGE_INCR' DATABASE plus archivelogs;
}


run {
CROSSCHECK BACKUP;
CROSSCHECK COPY;
CROSSCHECK ARCHIVELOG ALL;
REPORT OBSOLETE;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED COPY;
}
# Validate Database Backup
restore validate database;

EXIT;
exit;
EOF

rman catalog rman/xxxxx@RMAN target=sys/xxxxxxxx@xxxxx_MH << EOF
resync catalog;
exit
EOF

No comments:

Post a Comment