Exploring options of using RMAN configure to simplify backup

3 min read
Jul 24, 2014 12:00:00 AM

I am a simple person who likes simple things, especially RMAN backup implementation. I have yet to understand why many RMAN backup implementations do not use the CONFIGURE command. If you have a good explanation for avoiding it, please share.


1. Practical Examples of the RMAN CONFIGURE Command

Using the CONFIGURE command allows you to set persistent settings within the Oracle control file. This simplifies your backup scripts by removing the need to manually allocate channels or define formats every time you run a job.

Common Configuration Parameters

  • Parallelism and Compression: configure device type disk parallelism 2 backup type to compressed backupset;
  • Default Backup Formats: configure channel device type disk format '/oradata/backup/%d_%I_%T_%U' maxopenfiles 1; configure channel 1 device type disk format '/oradata/backup1/%d_%I_%T_%U' maxopenfiles 1;
  • Deletion Policies: configure archivelog deletion policy to backed up 2 times to disk;
  • Optimization: configure backup optimization on;

Verifying Your Setup

Do you know if your backup is using parallelism? Where is the backup going? Is it headed to tape or disk? You can answer all these questions instantly with a single command:

RMAN> show all;

RMAN configuration parameters for database with db_unique_name SAN are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/backup/%d_%F.ctl'; CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/oradata/backup/%d_%I_%T_%U' MAXOPENFILES 1; CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/oradata/backup1/%d_%I_%T_%U' MAXOPENFILES 1; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_san.f'; # default 

2. Implementing a Simplified RMAN Script

Because we have used persistent configurations, our actual backup script becomes incredibly clean and easy to read.

The Backup Script

set echo on; connect target; show all; backup incremental level 0 check logical database filesperset 1 tag "fulldb" plus archivelog filesperset 8 tag "archivelog"; 

Execution Output

When you run this script, notice how RMAN automatically allocates the channels and applies the compression settings we configured earlier:

$ rman @simple.rman ... RMAN> backup incremental level 0 check logical database filesperset 1 tag "fulldb" 5> plus archivelog filesperset 8 tag "archivelog";  allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=20 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=108 device type=DISK channel ORA_DISK_1: starting compressed archived log backup set ... Finished backup at 2014-JUL-24 11:14:47 

3. The Power of Deletion Policies

If the previous examples didn't convince you, consider the safety net provided by a proper deletion policy. Imagine someone—maybe yourself—accidentally tries to delete archived logs before they are safely stored.

Prevention of Accidental Deletion

With our policy set to BACKED UP 2 TIMES TO DISK, RMAN will block an accidental manual deletion if the requirements aren't met:

RMAN> delete noprompt archivelog all;  RMAN-08138: WARNING: archived log not deleted - must create more backups archived log file name=/oradata/SAN/archivelog/arc_845895297_1_326.dbf thread=1 sequence=326 

Overriding the Policy

To force the deletion, you must explicitly change the configuration to NONE:

RMAN> configure archivelog deletion policy to none; RMAN> delete noprompt archivelog all;  deleted archived log archived log file name=/oradata/SAN/archivelog/arc_845895297_1_326.dbf RECID=337 STAMP=853758742 Deleted 2 objects 

Using CONFIGURE makes your environment more robust, your scripts more portable, and your job much easier. Will you be using it for your next RMAN implementation?

Oracle Database Consulting Services

Ready to optimize your Oracle Database for the future?

On this page

Ready to unlock value from your data?

With Pythian, you can accomplish your data transformation goals and more.