Saturday, August 23, 2008

The Basics of Incremental backups

The Goal of incremental backups is to back up only those data blocks that have changed since a previous backup.

- Reducing the amount of time for backups
- Save network bandwidth when backing up over a network

The Incremental Backup Alogorithm

Ech 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.


Level 0 and Level 1 Backups

A Level 0 incremental backup is the base for subsequent incremental backups. It copies allblocks containing data.

A Level 1 can be either Differential or cumulative
Incremental backups are differential by default.

- Differential backs up all blocks changed since the most recent incremental backup at evel 0 or 1
Rman determines which level 1 backup occured most recently and backs up all blocks modified after that backup. If no level 1 is available, Rman copies all blocks changed since the level 0 backup.


- Cumulative backs ups all blocks changed after the most recent incremental backup at level 0.
Cumulative reduce work needed to restore, by using only one incremental backup, but take longer to backup.


Performing a incremental backup:

RMAN> backup incremental level 0 database plus archivelog;

Run the following sql from sqlplus shows how much data was backed up

SQL> select file#, incremental_level, completion_time, blocks, datafile_blocks
from v$backup_datafile
where incremental_level >= 0;



FILE# INCR_LEVEL COMPLETIO BLKS DATAFILE_BLKS
--------- ----------------- --------- ---------- ---------------
1 0 24-AUG-08 120585 131840
2 0 24-AUG-08 49646 73864
5 0 24-AUG-08 8818 12800
3 0 24-AUG-08 63 5120

4 0 24-AUG-08 290 640


Now i run a small update to a dummy table...

Now i do a incremental level 1 (differential by default)

RMAN> backup incremental level 1 database plus archivelog;

SQL> select file#, incremental_level, completion_time, blocks, datafile_blocks
from v$backup_datafile
where incremental_level >=1

FILE# INCREMENTAL_LEVEL COMPLETIO BLOCKS DATAFILE_BLOCKS
---------- ----------------- --------- ---------- ---------------
1 1 24-AUG-08 98 131840
2 1 24-AUG-08 367 73992
5 1 24-AUG-08 1 12800
3 1 24-AUG-08 629 5120
4 1 24-AUG-08 1 640

No comments: