How to do Oracle RMAN Incremental Backup.

In this article we will discuss about Oracle RMAN Incremental Backup. An Incremental backup is those backup that only backup datafile blocks that have changed since a specified previous backup.
You can make incremental backups of whole databases, individual tablespaces or datafiles.

The purpose of an incremental backup is to backup only those data blocks that have changed since a previous backup.
 
 
The actual reason behind incremental backup are following.
     
Reduce the time needed to take the full backup.
Save network bandwidth while backup taking over network.
Minimize the Disk I/O’s and server resource utilization.
 
 
Level 0 and Level 1 Incremental Backups:-
 
Incremental backups can be either level 0 or level 1. A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data, backing the datafile up into a backup set just as a full backup would. The only difference between a level 0 incremental backup and a full backup is that a full backup is never included in an incremental strategy.
 
There are two types of Oracle RMAN Incremental Backup.
 
1>   Differential Incremental Backup.
2>   Cumulative Incremental Backup.
 
    1>Differential Incremental Backup:-differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0. Basically when using differential incremental backup (the default type of incremental backup), RMAN looks for changed data blocks which were changed after last level 1 incremental backup. It there’s no level 1 backup made before it, it takes a backup of the changed data blocks which were made after level 0 incremental backup.
 
 
RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;  
 
Oracle RMAN Incremental Backup
 
    
   2>Cumulative Incremental Backup:- In a cumulative incremental backup RMAN takes backup of all changed data blocks after level 0 or level 1 incremental backup.  Like a differential backup, incremental backups also back up only the changed data blocks, but an incremental backup only backs up the data that has changed since the last backup.  If the last backup was also an incremental backup, the current incremental backups only records “changes to the changes“, a much smaller set of block changes, and hence, a much smaller recovery time than a differential backup.
  
    
    RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
 
 
Oracle RMAN Incremental Backup
                      
 
L0 Increment  Backup Scripts:- A level 0 incremental backup is physically identical to a full backup and it includes every data block in the file except empty blocks. The only difference is that the level 0 backup is recorded as an incremental backup in the RMAN repository, so it can be used as the parent for a level 1 backup. 
 
RUN {
BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0
DEVICE TYPE DISK
TAG = ‘DAILY_INC_FULL’ FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_DB_%u_%s_%p’ database;
 
#*** DAILY CONTROLFILE BACKUP
 
BACKUP AS BACKUPSET
DEVICE TYPE DISK
TAG = ‘DAILY_CONTROLFILE’
FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_CTL_%u_%s_%p’
CURRENT CONTROLFILE;
 
#***** DAILY SPFILE BACKUP
 
BACKUP AS BACKUPSET
DEVICE TYPE DISK
TAG = ‘DAILY SPFILE’
FORMAT ‘/ backup01/RMAN_HOTBACKUP/PROD_DB/%d_SPFILE_%u_%s_%p’
SPFILE;
 
#*******ARCHIVELOG BACKUP****
 
sql ‘alter system archive log current’;
BACKUP
AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0
DEVICE TYPE DISK
TAG = ‘DAILY_INCR_CUM_ARCHIVEDLOG’
FORMAT ‘/ backup01/RMAN_HOTBACKUP/PROD_DB/%d_ARC_%u_%s_%p’
ARCHIVELOG ALL;
 
#*****Remove backuped archivelog before 6 day’s******#
DELETE ARCHIVELOG UNTIL TIME ‘sysdate-6’ BACKED UP 1 TIMES TO DEVICE TYPE DISK;
 
#****MAINTENANCE********#
DELETE EXPIRED BACKUP;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED COPY;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
DELETE OBSOLETE REDUNDANCY = 14;
CROSSCHECK COPY;
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
}
 
 
L1 Incremental Backup Script:- A level 1 backup includes only those blocks that have been changed since the “parent” backup was taken. Remember a parent backup may be either a level 0 or a level 1 backup.
 
RUN {
BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1
DEVICE TYPE DISK
TAG = ‘DAILY_INC_L1_BACKUP’ FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_DB_%u_%s_%p’ database;
 
#*** DAILY CONTROLFILE BACKUP
 
BACKUP AS BACKUPSET
DEVICE TYPE DISK
TAG = ‘DAILY_CONTROLFILE’
FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_CTL_%u_%s_%p’
CURRENT CONTROLFILE;
 
#***** DAILY SPFILE BACKUP
 
BACKUP AS BACKUPSET
DEVICE TYPE DISK
TAG = ‘DAILY SPFILE’
FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_SPFILE_%u_%s_%p’
SPFILE;
 
#*******ARCHIVELOG BACKUP****
 
sql ‘alter system archive log current’;
BACKUP
AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1
DEVICE TYPE DISK
TAG = ‘DAILY_INCR_L1_ARCHIVEDLOG’
FORMAT ‘/backup01/RMAN_HOTBACKUP/PROD_DB/%d_ARC_%u_%s_%p’
ARCHIVELOG ALL;
 
#*****Remove backuped archivelog before 6 day’s******#
DELETE ARCHIVELOG UNTIL TIME ‘sysdate-6’ BACKED UP 1 TIMES TO DEVICE TYPE DISK;
 
#****MAINTENANCE********#
DELETE EXPIRED BACKUP;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED COPY;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
DELETE OBSOLETE REDUNDANCY = 14;
CROSSCHECK COPY;
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
}

Hope this article helpful to you. For more details about RMAN backup click Here.

Leave a Comment