Please refer to the following post for knowing the terminology differences.
How to Distinguish Confusing Terminology on Oracle Backup Strategies
In this strategy, we schedule an incremental level 0 backup on Sunday night, and incremental level 1 cumulative backups on the other week night. It always requires a full backup, a cumulative backup and several logs to recover a database. Here are the scripts we use:
For more clearly demonstrate the strategy, I list the backup mode with the day of week below:
- Sunday: Incremental level 0 backup, it's a full backup.
- Monday: Incremental level 1 cumulative backup.
- Tuesday: Incremental level 1 cumulative backup.
- Wednesday: Incremental level 1 cumulative backup.
- Thursday: Incremental level 1 cumulative backup.
- Friday: Incremental level 1 cumulative backup.
- Saturday: Incremental level 1 cumulative backup.
[oracle@primary01 rman_scripts]$ vi incremental_1_cumulative.rman
run {
backup
incremental level 1 cumulative
database;
backup
archivelog all not backed up;
}
Modify the shell script. The script is able to execute the right RMAN script according to the weekday.
[oracle@primary01 rman_scripts]$ vi run_rman_daily_backup.sh
#!/bin/bash
. /home/oracle/.bash_profile
WORK_DIR=/home/oracle/rman_scripts
if [ `date +%u` = 7 ] ;
then
EXEC_FILE=$WORK_DIR/incremental_0_full.rman
else
EXEC_FILE=$WORK_DIR/incremental_1_cumulative.rman
fi
rman target / @$EXEC_FILE >> $WORK_DIR/backup_log_`date +%Y%m%d`.log