Create incremental backup with Rman

Preliminary

Of course, before doing any incremental backup of database, datafile or tablespace, you need to do a full backup. So, if you still didn't do it, go here to known how to do this first full backup !

Incremental backup

Actually, there is two way to do an incremental backup :

  1. Differential backup : which backs up all blocks changed after the most recent incremental backup at level 1 or 0
  2. Cumulative backup : which backs up all blocks changed after the most recent incremental backup at level 0

Note that by default, rman choose incremental backups as differential.
You can find here an explanation of Cumulative backup on oracle web site, and here an explanation for Cumulative backup on oracle web site.
So, if you choose to do a Differential backup, this can be done with this command :

RMAN> backup incremental level 1 database;

Otherwise, to do a Cumulative backup, you have to enter this command in your rman prompt :
RMAN> backup incremental level 1 cumulative database;

Speed up your incremental backup

When you do an incremental backup of a database, normally rman will scan every block of the datafiles. Thus, this process can take a long time if the datafile is quite big. So, what can Oracle do, is to create a file that keep record of each block updated of a datafile since the last full backup ! So, we avoid scanning every block of the datafile to do our incremental backup.
First thing to do is to create a file that we will keep a list of each updated block of the datafiles :

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/directory/rman_change_track_file.f' REUSE;

The keyword :

REUSE

will tell RMAN to overwrite any existing file with the specified name.
If you want after disable this feature of rman, you can disable change tracking file with this command :

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

And if you only want to check if this feature is enable or not, execute this query with sysdba privilege :
SELECT status,filename FROM V$BLOCK_CHANGE_TRACKING;

Important
Note that if you enable this feature of RMAN it has some performance impact on your database, so before doing anything to our production database, test the feature and check if it is worth doing it! The explication is that after a block is updated, the database still need to write something to our change tracking file. Note also, that it is worth enable this feature only if you are doing incremental backup, otherwise, you won't gain anything !

More information

  1. Rman Incremental backup on oracle web site
  2. Change tracking file for fast incremental backup on oracle web site
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License