Skip to content

Routine Backup Strategies (2/5) - Incremental level 0+1 Backups

  • by
Routine Backup Strategies (1/5) - All Full Backups
In Oracle, an incremental level 0 backup is equivalent to a full backup, and an incremental level 1 backup is to backup the changes since very last backup. Please note that the terminology of backup in Oracle is different from the industrial convention.

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.
Since it requires a full backup, several incremental backups and several logs to recover a database, so the consumed recovery time could be considerable. Here are the scripts we use:

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

Routine Backup Strategies (3/5) - Incremental 0+1 cumulative Backups

Leave a Reply

Your email address will not be published.