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 differential backup.
- Tuesday: Incremental level 1 differential backup.
- Wednesday: Incremental level 1 cumulative backup.
- Thursday: Incremental level 1 differential backup.
- Friday: Incremental level 1 differential backup.
- Saturday: Incremental level 1 differential backup.
Here are the scripts we use:
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
elif [ `date +%u` = 3 ] ;
then
EXEC_FILE=$WORK_DIR/incremental_1_cumulative.rman
else
EXEC_FILE=$WORK_DIR/incremental_1_differential.rman
fi
rman target / @$EXEC_FILE >> $WORK_DIR/backup_log_`date +%Y%m%d`.log