RMAN Incremental Level 1 Differential and Cumulative Database Backup Scripts in Oracle

RMAN Incremental Level 1 Differential and Cumulative Database Backup Scripts in Oracle


In this article, we are going to prepare a script for RMAN Incremental and differential Level 1 (L1) database backup which includes backup of datafiles (L1), control files, spfile along with archives.

RMAN incremental backups back up only datafile blocks that have changed since a specified previous backup. You can make incremental backups of databases, individual tablespaces, or datafiles. There are two types of incremental level 1 (L1) backup:

1. Differential Incremental Backup
2. Cumulative Incremental Backup

Generally, we do take backup of the database every day as scheduled and business continuity either FULL or INCREMENTAL but sometimes also we do take backup manually whenever require like prior to schedule activities, migration/restore purpose, before the upgrade, etc. In this demonstration, we will prepare RMAN Incremental Level 1 (L1) scripts which will create a backup in a specified location (local directory) on the database server and also in Flash Recovery Area (FRA).


1. Differential Incremental Backup


differential incremental backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0. In case no level 1 (L1) backup is available then RMAN copies all changed blocks since the last level 0 (L0) backup, refers to the below illustration for more clarification on differential incremental backups and differential incremental backup is the default for Incremental backup

Differential Incremental Backups (Default)

In the above illustration following things will happen:

On Sunday, An incremental level 0 (L0) backup backs up all blocks of the database.

On the day of Monday to Saturday will occur a differential level 1 backup of all changed blocks since the last incremental backup of level 0 or level 1 i.e on Monday Incremental level 1 RMAN backup copies changed block since Sunday level 0 backup, Tuesday RMAN backup copies changed block since Monday Level 1 backup and so on.

OPTION 01: Differential Incremental LEVEL 1 (L1) command to take database backup using RMAN utility in a specified location (local directory) on the database server, click here for the complete output of the command.

RMAN> run
{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT '/oradata/backup/LABDBDUP/INCR/labdbdup_%U';
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK FORMAT '/oradata/backup/LABDBDUP/INCR/labdbdup_%U';
BACKUP tag 'INCR1_DB' INCREMENTAL LEVEL=1 DATABASE PLUS ARCHIVELOG;
BACKUP CURRENT CONTROLFILE TAG 'INCR1_CTL' FORMAT '/oradata/backup/LABDBDUP/INCR/labdbdupCTL_%U';
BACKUP SPFILE TAG 'INCR1_SPFILE' FORMAT '/oradata/backup/LABDBDUP/INCR/labdbdupSPF_%U';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
}
$ cd /oradata/backup/LABDBDUP/INCR
$ ls -lrt


OPTION 02: Differential Incremental LEVEL 1 (L1) command to take database backup using RMAN utility in Flash Recovery Area (FRA) on the database server, click here for the complete output of the command.

RMAN> run
{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
BACKUP tag 'INCR1_DB' INCREMENTAL LEVEL 1 DATABASE PLUS ARCHIVELOG;
BACKUP CURRENT CONTROLFILE TAG 'INCR1_CTL';
BACKUP SPFILE TAG 'INCR1_SPFILE';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
}
$ cd /oradata/LABDBDUP/FRA/LABDBDUP/backupset/2021_09_30/
$ ls -lrt *INCR1_*


2. Cumulative Incremental Backup


Cumulative Incremental backup, which backs up all changed blocks after the most recent incremental backup at level 0. Cumulative incremental is more efficient in terms of restore where ti’s require only one incremental backup from any particular level so it reduces the workload. Compare to differential backups require more space for Cumulative incremental backups since it requires to backup duplicate blocks from previous backups at the same level, refers to the below illustration for more clarification on cumulative incremental backups.

Cumulative Incremental Backups

In the above illustration following things will happen:

On Sunday, An incremental level 0 (L0) backup backs up all blocks of the database.

On the day of Monday to Saturday will occur a cumulative incremental level 1 backup of all changed blocks since the last incremental backup of level 0 (L0) i.e on Monday to Saturday incremental level 1 (L1) RMAN backup copies changed block since Sunday level 0 backup.

In the above illustration following things will happen:

On Sunday, An incremental level 0 (L0) backup backs up all blocks of the database.

On the day of Monday to Saturday will occur a differential level 1 backup of all changed blocks since the last incremental backup of level 0 or level 1 i.e on Monday Incremental level 1 RMAN backup copies changed block since Sunday level 0 backup, Tuesday RMAN backup copies changed block since Monday Level 1 backup and so on.

OPTION 01: Cumulative Incremental LEVEL 1 (L1) command to take database backup using RMAN utility in a specified location (local directory) on the database server, click here for the complete output of the command.

RMAN> run
{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT '/oradata/backup/LABDBDUP/CUMU/labdbdup_%U';
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK FORMAT '/oradata/backup/LABDBDUP/CUMU/labdbdup_%U';
BACKUP tag 'INCR_CUMUL1_DB' INCREMENTAL LEVEL=1 CUMULATIVE DATABASE PLUS ARCHIVELOG;
BACKUP CURRENT CONTROLFILE TAG 'INCR_CUMUL1_CTL' FORMAT '/oradata/backup/LABDBDUP/CUMU/labdbdupCTL_%U';
BACKUP SPFILE TAG 'INCR_CUMUL1_SPFILE' FORMAT '/oradata/backup/LABDBDUP/CUMU/labdbdupSPF_%U';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
}
$ cd /oradata/backup/LABDBDUP/CUMU
$ ls -lrt


OPTION 02: Cumulative Incremental LEVEL 1 (L1) command to take database backup using RMAN utility in Flash Recovery Area (FRA) on the database server, click here for the complete output of the command.

RMAN> run
{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
BACKUP tag 'INCR_CUMUL1_DB' INCREMENTAL LEVEL 1 CUMULATIVE DATABASE PLUS ARCHIVELOG;
BACKUP CURRENT CONTROLFILE TAG 'INCR_CUMUL1_CTL';
BACKUP SPFILE TAG 'INCR_CUMUL1_SPFILE';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
}
$ cd /oradata/LABDBDUP/FRA/LABDBDUP/backupset/2021_09_30/
$ ls -lrt *INCR_CUMUL1_*


Note:
Make sure you enable block change tracking (BCT) so RMAN will read BCT’s file to identify changed block in datafiles instead of full scan of datafiles. Click here to know more about How to Enable & Disable Block Change Tracking (BCT) in Database Oracle.


We always encourage the technical person to visit 
section SCRIPTS to get more daily usage SQL commands.


Hope so you like this script
!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the latest update. Click here to know more about our pursuit.


Related Articles

BACKUP | BACKUP AND RECOVERY | DATABASE | ORACLE | SCRIPTS


 311 Total Views,  3 Views Today

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Spread the Knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × three =