Tuesday, 27 November 2012

RMAN Incremental Backups
This example performs an incremental (online) backup of the Oracle database using RMAN. In this example, it is assumed that you want to take one full database backup once a week, and one incremental database backup every day. The backup cycle starts on Friday. A full backup is taken on Friday, and an incremental backup is then taken every day.
Also in this example, it is assumed that I will be using RMAN default configurations. One of the parameters I set is "CONFIGURE RETENTION POLICY TO REDUNDANCY 3". The retention policy of REDUNDANCY 3 applies only to full (not incremental) backups, so the combination of that policy and this backup schedule ensures that you can restore to any incremental backup time for the last 3 weeks.

run {
    # -----------------------------------------------------------
    # The following RMAN commands are run each Friday to start 
    # the backup cycle.
    # The steps are:
    #   - Backup database with incremental level 0.
    #   - Backup (and then delete) all archivelog files.
    # -----------------------------------------------------------
    backup
        incremental level 0
        filesperset 4
        (database);
    backup
        archivelog all
        delete input;
}
Now, let's look at what happens on those other days. The following commands can be run from Saturday through Thursday to take cumulative incremental backups. Notice that LEVEL 1 is specified with the BACKUP command. Also notice that the options LEVEL 1 CUMULATIVE indicate that only the blocks that have changed since the last level 0 backup will be backed up. If the CUMULATIVE option was not specified, then only the blocks that have changed since the last LEVEL 1 backup will be backed up. The advantage of a cumulative backup is that only one incremental backup ever needs to be applied during recovery.
run {
    backup
        incremental level 1 cumulative
        filesperset 4
        (database);
}

No comments:

Post a Comment