RMAN backup optimization is another feature to minimize backup size. Enabling this feature, RMAN BACKUP will skip backup of files that comes in certain condition or exactly identical to the file already backup up.

As the name indicates the feature is for optimizing the RMAN backups. When you turn on this backup optimization parameter, RMAN skips the backing up the files which has been already been backed up to the same device. The main benefit out of this is it will reduce the unwanted space usage.

This is how the RMAN determines the identical files for different categories. Below mentioned are the only applicable categories of files.

Datafile: File must be offline-normal or read-only or closed normally; with same DBID, checkpoint SCN, creation SCN and resetlogs SCN and time as a datafile already in the backup.

Archived Log: the file must be with same DBID, thread, sequence number and resetlogs SCN and time.

Backup Set: The file must be with same DBID, backupset record ID and time stamp.

Below are the criteria when RMAN check which files can be skipped from the backup.

  1. In case of datafile RMAN compares the DBID, checkpoint SCN, creation SCN, and RESETLOGS SCN and time as a datafile already in a backup. If they are identical then skip to take backup again.
  2. In case of archived redo log RMAN compares thread, sequence number, and RESETLOGS SCN and time.
  3. In case of backupset RMAN compares recid and stamp.

By default the backup optimization will be turned off. You have to use following command to enable the same.

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;

You can override the optimization at any time by using FORCE option on the backup command.

  • BACKUP DATABASE FORCE;
  • BACKUP ARCHIVELOG ALL FORCE;
  • BACKUP BACKUPSET ALL;

By Default it is set to OFF:

RMAN> SHOW BACKUP OPTIMIZATION;

RMAN configuration parameters for database with db_unique_name ORACLE are:

CONFIGURE BACKUP OPTIMIZATION OFF; # default

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;

new RMAN configuration parameters:

CONFIGURE BACKUP OPTIMIZATION ON;

new RMAN configuration parameters are successfully stored

RMAN>

Example:

Initiating archivelog backup

RMAN> backup archivelog all;

Starting backup at 06-NOV-12

current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=304 RECID=610 STAMP=798616536

channel ORA_DISK_1: starting piece 1 at 06-NOV-12

channel ORA_DISK_2: starting compressed archived log backup set

channel ORA_DISK_2: specifying archived log(s) in backup set

input archived log thread=2 sequence=306 RECID=611 STAMP=798616541

channel ORA_DISK_2: starting piece 1 at 06-NOV-12

channel ORA_DISK_1: finished piece 1 at 06-NOV-12

piece handle=+RECO_MXEXT/devqa/backups/s9npjqut_1_1 tag=TAG20121106T055541 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_2: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/sanpjqut_1_1 tag=TAG20121106T055541 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01

Finished backup at 06-NOV-12

Starting Control File and SPFILE Autobackup at 06-NOV-12

piece handle=+RECO/devqa/backups/devqa_cf_c-2666024444-20121106-0a comment=NONE

Finished Control File and SPFILE Autobackup at 06-NOV-12

In second backup it will skip the files which are already backed up.

RMAN> backup archivelog all;

Starting backup at 06-NOV-12

current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

skipping archived log file+RECO/devqa/archivelog/2012_11_06/thread_1_seq_304.19117.798616537; already backed up 1 time(s)

skipping archived log file +RECO/devqa/archivelog/2012_11_06/thread_2_seq_306.3346.798616541; already backed up 1 time(s)

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=305 RECID=612 STAMP=798616557

channel ORA_DISK_1: starting piece 1 at 06-NOV-12

channel ORA_DISK_2: starting compressed archived log backup set

channel ORA_DISK_2: specifying archived log(s) in backup set

input archived log thread=2 sequence=307 RECID=613 STAMP=798616559

channel ORA_DISK_2: starting piece 1 at 06-NOV-12

channel ORA_DISK_1: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/scnpjqvh_1_1 tag=TAG20121106T055601 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_2: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/sdnpjqvh_1_1 tag=TAG20121106T055601 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01

Finished backup at 06-NOV-12

Starting Control File and SPFILE Autobackup at 06-NOV-12

piece handle=+RECO/devqa/backups/devqa_cf_c-2666024444-20121106-0b comment=NONE

Finished Control File and SPFILE Autobackup at 06-NOV-12

The force option will take the backup of all available archivelog files even if it is backed up already.

RMAN> backup archivelog all force;
Starting backup at 06-NOV-12
current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=304 RECID=610 STAMP=798616536

channel ORA_DISK_1: starting piece 1 at 06-NOV-12

channel ORA_DISK_2: starting compressed archived log backup set

channel ORA_DISK_2: specifying archived log(s) in backup set

input archived log thread=2 sequence=306 RECID=611 STAMP=798616541

input archived log thread=1 sequence=305 RECID=612 STAMP=798616557

channel ORA_DISK_2: starting piece 1 at 06-NOV-12

channel ORA_DISK_3: starting compressed archived log backup set

channel ORA_DISK_3: specifying archived log(s) in backup set

input archived log thread=2 sequence=307 RECID=613 STAMP=798616559

input archived log thread=1 sequence=306 RECID=615 STAMP=798616596

channel ORA_DISK_3: starting piece 1 at 06-NOV-12

channel ORA_DISK_4: starting compressed archived log backup set

channel ORA_DISK_4: specifying archived log(s) in backup set

input archived log thread=2 sequence=308 RECID=614 STAMP=798616595

input archived log thread=2 sequence=309 RECID=617 STAMP=798616769

channel ORA_DISK_4: starting piece 1 at 06-NOV-12

channel ORA_DISK_1: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/sinpjr63_1_1 tag=TAG20121106T055931 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=307 RECID=616 STAMP=798616767

channel ORA_DISK_1: starting piece 1 at 06-NOV-12

channel ORA_DISK_2: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/sjnpjr63_1_1 tag=TAG20121106T055931 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_3: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backupset/2012_11_06/annnf0_tag20121106t055931_0.5571.798616773 tag=TAG20121106T055931 comment=NONE

channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_4: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backupset/2012_11_06/annnf0_tag20121106t055931_0.16702.798616773 tag=TAG20121106T055931 comment=NONE

channel ORA_DISK_4: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_1: finished piece 1 at 06-NOV-12

piece handle=+RECO/devqa/backups/smnpjr65_1_1 tag=TAG20121106T055931 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 06-NOV-12

Starting Control File and SPFILE Autobackup at 06-NOV-12

piece handle=+RECO/devqa/backups/devqa_cf_c-2666024444-20121106-0d comment=NONE

Finished Control File and SPFILE Autobackup at 06-NOV-12

Source

For More Detail , You can join us follow:

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.