Category - RMAN

RMAN Practices - PART 2- Back to Basics

RMAN Practices - PART 2- Back to Basics

In this article we will discuss below topics

1=> Incremental Backups

An incremental backup copies/backup only those data blocks that have changed since a previous backup.

Full Backups (Non-Incrementai Backup)
By default, RMAN makes full backups. A full backup of a data file includes every allocated block in the file being backed up.
A full backup of a data file can be an image copy, in which case every data block is backed up.
It can also be stored in a backup set, in which case data file blocks not in use may be skipped.

A full backup has no effect on subsequent incremental backups. Image copies are always full backups because they include every data block in a data file.
A backup set is by default a full backup because it can potentially include every data block in a data file, although umused block compression means that blocks never used are excluded and, in some cases, currently unused blocks are excluded.

A full backup cannot be part of an incremental backup strategy; that is, it cannot be the parent for a subsequent incremental backup.

Multilevel Incremental Backups

RMAN can create multilevel incremental backups. Each incremental level is denoted by a value of 0 or 1.

A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data.
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.
Thus, an incremental level 0 backup is a full backup that happens to be the parent of incremental backups whose level is greater than 0.

A level 1 incremental backup can be either of the following types:
=> A differential incremental backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0
=> A cumulative incremental backup, which backs up all blocks changed after the most recent incremental backup at level 0

Incremental backups at level 0 can be either backup sets or image copies, but incremental backups at level 1 can only be backup sets.

Differential & Cumulative Incremental Backups

About Differential Incremental Backups

In a differential level 1 backup, RMAN backs up all blocks that have changed since the most recent incremental backup at level 1 (cumulative or differential) or level 0.

For example, in a differential level 1 backup, RMAN determines which level 1 backup occurred most recently and backs up all blocks modified after that backup.
If no level 1 is available, then RMAN copies all blocks changed since the base level 0 backup.


In the example shown in Figure 8-2, the following activity occurs each week:

    Sunday

    An incremental level 0 backup backs up all blocks that have ever been in use in this database.

    Monday through Saturday

    On each day from Monday through Saturday, a differential incremental level 1 backup backs up all blocks that have changed since the most recent incremental backup at level 1 or 0.
    The Monday backup copies blocks changed since Sunday level 0 backup, the Tuesday backup copies blocks changed since the Monday level 1 backup, and so forth.
 

If There is NO INCREMENTAL Backup available on location Then RMAN will start taking as LEVEL0 as below,

RMAN> run
{
backup incremental level 1 datafile 1 format '/ora_home/bkp/file_1_%U';
}2> 3> 4> 

Starting backup at 25-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=270 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=396 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=17 instance=TNT1 device type=DISK
no parent backup or copy of datafile 1 found
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 25-SEP-22
channel ORA_DISK_1: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_3m18igdt_1_1 tag=TAG20220925T005837 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-SEP-22

Starting Control File and SPFILE Autobackup at 25-SEP-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_09_25/s_1116291521.766.1116291523 comment=NONE
Finished Control File and SPFILE Autobackup at 25-SEP-22

Take Level 0 Backup as below.

[oracle@racsetn1 bkp]$ 
[oracle@racsetn1 bkp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 25 01:00:58 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TNT (DBID=1427195521)

RMAN> run
{
backup incremental level 0 datafile 1 format '/ora_home/bkp/file_1_%U';
}
2> 3> 4> 
Starting backup at 25-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=280 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=409 instance=TNT1 device type=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 25-SEP-22
channel ORA_DISK_2: starting incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
channel ORA_DISK_3: starting incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_3: starting piece 1 at 25-SEP-22
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 25-SEP-22
channel ORA_DISK_3: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_3q18igik_1_1 tag=TAG20220925T010107 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_3o18igij_1_1 tag=TAG20220925T010107 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_2: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_3p18igik_1_1 tag=TAG20220925T010107 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
Finished backup at 25-SEP-22

Take Level 1 Backup as below.
oracle@racsetn1 bkp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 25 01:07:33 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TNT (DBID=1427195521)

RMAN> run
{
backup incremental level 1 datafile 1 format '/ora_home/bkp/file_1_%U';
}
2> 3> 4> 
Starting backup at 25-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=280 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=409 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=17 instance=TNT1 device type=DISK
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 25-SEP-22
channel ORA_DISK_1: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_4018igur_1_1 tag=TAG20220925T010739 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-SEP-22

Starting Control File and SPFILE Autobackup at 25-SEP-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_09_25/s_1116292063.745.1116292065 comment=NONE
Finished Control File and SPFILE Autobackup at 25-SEP-22

RMAN> exit

Recovery Manager complete.

About Cumulative Incremental Backups

In a cumulative level 1 backup, RMAN backs up all blocks used since the most recent level 0 incremental backup in either the current or parent incarnation.

Cumulative incremental backups reduce the work needed for a restore operation by ensuring that you only need one incremental backup from any particular level.
Cumulative backups require more space and time than differential backups because they duplicate the work done by previous backups at the same level.

In the example shown in Figure 8-3, the following occurs each week:

    Sunday

    An incremental level 0 backup backs up all blocks that have ever been in use in this database.

    Monday - Saturday

A cumulative incremental level 1 backup copies all blocks changed since the most recent level 0 backup.
Because the most recent level 0 backup was created on Sunday, the level 1 backup on each day Monday through Saturday backs up all blocks changed since the Sunday backup.

[oracle@racsetn1 bkp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 25 01:09:13 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TNT (DBID=1427195521)

RMAN> run
{
backup incremental level 1 CUMULATIVE datafile 1 format '/ora_home/bkp/file_1_%U';
}2> 3> 4> 

Starting backup at 25-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=280 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=406 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=17 instance=TNT1 device type=DISK
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 25-SEP-22
channel ORA_DISK_1: finished piece 1 at 25-SEP-22
piece handle=/ora_home/bkp/file_1_4218ih1u_1_1 tag=TAG20220925T010917 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-SEP-22

Starting Control File and SPFILE Autobackup at 25-SEP-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_09_25/s_1116292161.743.1116292163 comment=NONE
Finished Control File and SPFILE Autobackup at 25-SEP-22

RMAN> exit

About the Incremental Backup Algorithm

The following concepts are essential for understanding the algorithm that RMAN uses to make incremental backups:

  • Checkpoint SCN

    Every data file has a data file checkpoint SCN, which you can view in V$DATAFILE.CHECKPOINT_CHANGE#. All changes with an SCN lower than this SCN are guaranteed to be in the file. When a level 0 incremental backup is restored, the restored data file contains the checkpoint SCN that it had when the level 0 was created. When a level 1 incremental backup is applied to a file, the checkpoint SCN of the file is advanced to the checkpoint SCN that the file had when the incremental level 1 backup was created.

  • Incremental start SCN

    This SCN applies only to level 1 incremental backups. All blocks whose SCN is greater than or equal to the incremental start SCN are included in the backup. Blocks whose SCN is lower than the incremental start SCN are not included in the backup. The incremental start SCN is most often the checkpoint SCN of the parent of the level 1 backup.

  • Block SCN

    Every data block in a data file records the SCN at which the most recent change was made to the block.

When RMAN makes a level 1 incremental backup of a file, RMAN reads the file, examines the SCN of every block, and backs up blocks whose SCN is greater than or equal to the incremental start SCN for this backup. If the backup is differential, then the incremental start SCN is the checkpoint SCN of the most recent level 1 backup. If the backup is cumulative, then the incremental start SCN is the checkpoint SCN of the most recent level 0 backup.

When block change tracking is enabled, RMAN uses bitmaps to avoid reading blocks that have not changed during the range from incremental start SCN to checkpoint SCN. RMAN still examines every block that is read and uses the SCN in the block to decide which blocks to include in the backup.

One consequence of the incremental backup algorithm is that RMAN applies all blocks containing changed data during recovery, even if the change is to an object created with the NOLOGGING option. Thus, if you restore a backup made before NOLOGGING changes were made, then incremental backups are the only way to recover these changes.