Please refer to the following post for learning 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 backups on other week nights. This could be the most popular strategy to backup database.
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 differential backup.
- Thursday: Incremental level 1 differential backup.
- Friday: Incremental level 1 differential backup.
- Saturday: Incremental level 1 differential backup.
Create a new incremental level 0 RMAN script.
[oracle@primary01 rman_scripts]$ vi incremental_0_full.rman
run {
backup
incremental level 0
database;
backup
archivelog all not backed up;
}
Create a new incremental level 1 RMAN script.
[oracle@primary01 rman_scripts]$ vi incremental_1_differential.rman
run {
backup
incremental level 1
database;
backup
archivelog all not backed up;
}
Modify the shell script. You can see 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_differential.rman
fi
rman target / @$EXEC_FILE >> $WORK_DIR/backup_log_`date +%Y%m%d`.log