Friday, November 9, 2012

Oracle RMAN Incrmental Backups and Block Change Tracking

Incremental backups capture on a block-by-block basis changes in your database since a previous incremental backup.The starting point for an incremental backup strategy is a level 0 incremental backup that backs up all blocks in the database. The Level 1 incremental backups which are taken at regular intervals contain only changed blocks since a previous incremental backup

Types of incremental Backups:

You can make two types of incremental backups

1. Differential Incremental Backups
2. Cumulative Incremental Backups

Differential Incremental Backups:

Its the backup of al data blocks that changes after level  or a level 1 backup. RMAN first looks for a level 1 backup, if not available to goes on finding level 0 backup and backups every change since that level 0 backup.

Here how to make a level 0 backup

RMAN> backup incremental level 0 database;

Note that level 0 backup can be an image copy or in backup set form

Here is how you make level 1 backup

RMAN> backup incremental level 1 database;

Cumulative Incremental Backups

Backups all the data block changes since the last level 0 backup.

Here is how to make cumulative incremental backup

RMAN> backup incremental level 1 cumulative database;

Recovery of Incremental Backups:

Recovery from an incremental backup is faster than recovery using redo logs alone. During a restore from incremental backup, the level 0 backup is used as the starting point, then changed blocks are updated based on level 1 backups where possible to avoid re-applying changes from redo one at a time. Recovering with incremental backups requires no additional effort on your part. If incremental backups are available, RMAN will use them during recovery.

Change tracking file:

Enterprise Edition includes RMAN's change tracking feature for incremental backups which 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.

Find out if Block change tracking is enabled:

SQL> desc v$block_change_tracking

Name                     Null?                   Type
-------------------      --------------          ------------------
STATUS                                         VARCHAR2(10)
FILENAME                                    VARCHAR2(513)
BYTES                                            NUMBER

The status tells if the file is enabled or disabled. The filename tells the name of the file along with its size in the BYTES column.

If the file is in use, than how effective it is ?

The V$BACKUP_DATAFILE view contains a column called USED_CHANGE_TRACKING.
A value of YES for this column for an incremenat backup level > 0 means that RMAN used
the tracking file to speed up the incremental backup. This can help determine how effective
the the tracking file in minimizing the I/O activity during an incremental backup. The following
query can be used:

SQL> select file#,
                    avg(blocks_read/datafile_blocks) * 100 as “% read for backup”
          from   v$backup_datafile
          where  incremental_level > 0
             and  used_change_tracking = ‘YES’
          group  by file#
          order  by file#;

How to enable block change tracking:

SQL> alter database enable block change tracking   using file ‘/u01/oradata/change_tracking.f’;

REUSE clause can be specified if the file already exists.

SQL> alter database enable block change tracking using file ‘/u01/oradata/change_tracking.f’ reuse;

Alternatively, if you have the DB_CREATE_FILE_DEST parameter set (for Oracle Managed Files),
then you can simply issue:

SQL> alter database enable block change tracking;

In this case, Oracle crates an Oracle Managed File (OMF) in the directory specified by DB_CREATE_FILE_DEST to keep track of block changes.

If DB_CREATE_FILE_DEST is not set and you do not specify a file name, following error will result:

ORA-19773: must specify change tracking file name

Disabling block change tracking:

SQL> alter database disable block change tracking.

This command also removes the change tracking file.

Note :  Fast Incremental Backups were not possible on standby databases till 10g but from 11g Fast Incremental Backups are available on standby databases also.

Source: RMAN Fast Incremental Backups [ID 262853.1]

No comments:

Post a Comment