Wednesday, April 27, 2011

RMAN Incremental Backup:


This type of backup back-up only those blocks that have changed since a specified previous backup.


Why should I use Incremental backup?

-To reduce the amount of time needed for daily backups
-To save network bandwidth when backing up over a network
-To get adequate backup performance when the aggregate tape bandwidth available for tape write I/Os is much less than the aggregate disk bandwidth for disk read I/Os
-To be able to recover changes to objects created with the NOLOGGING option. For example, direct load inserts do not create redo log entries and their changes cannot be reproduced with media recovery. They do, however, change data blocks and so are captured by incremental backups.

How does it work?

Each data block in a datafile contains a system change number (SCN), which is the SCN at which the most recent change was made to the block. During an incremental backup, RMAN reads the SCN of each data block in the input file and compares it to the checkpoint SCN of the parent incremental backup. If the SCN in the input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN copies the block.

Types of Incremental Backup:

·         A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0(n or n-1)

·         A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0(n)

Differential Incremental Backups

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;







  • Sunday :An incremental level 0 backup backs up all blocks that have ever been in use in this database.
  • Monday - 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. So, 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.
  • The cycle is repeated for the next week.

Cumulative Incremental Backup

BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;





  • 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.
  • The cycle is repeated for the next week.

Which type of backup I should use? Well this is based on the below factors have looks at them:

Recovery speed:  Cumulative backups are faster to restore from than differential backups because fewer incremental backups need to be applied during recovery.



Backup speed:  For daily backup speed, differential backups run faster than cumulative backups because to don’t duplicate the work done by previous backups.  However, differential backups take longer when doing a recovery.


Disk space usage: Cumulative backups take more disk space because they duplicate the work   done by previous backups

Change tracking in incremental backup:

RMAN's change tracking feature for incremental backups improves incremental backup performance by recording changed blocks in each datafile in a change tracking file. If change tracking is enabled, RMAN uses the change tracking file to identify changed blocks for incremental backup, thus avoiding the need to scan every block in the datafile.

Change tracking is disabled by default, because it does introduce some minimal performance overhead on your database during normal operations
One change tracking file is created for the whole database. By default, the change tracking file is created as an Oracle managed file in DB_CREATE_FILE_DEST.

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE 'c:\rman_change_track.f' REUSE;

You can query V$BLOCK_CHANGE_TRACKING.STATUS to determine whether change tracking is enabled