RMAN has the ability to make an archival backup that is exempt from the configured retention policy. An archival backup is an all inclusive self-contained backup of the database at specific point in time. Archival backups are commonly used to satisfy regulatory requirements such as end year or quarter backups.
The RMAN command BACKUP … KEEP
is used to make archival backups. Archival backups can be kept either forever using the FOREVER clause or until a specific date using the UNTIL TIME clause. A recovery catalog is required when using the FOREVER
clause. The archival backup can be written to tape or disk.
Archival backups are self-contained backups of data files, control files, SPFILE and all archived redo logs to ensure that the database can be recovered to a consistent state. Multiple backup sets are created as result of the KEEP
option so the FORMAT
option needs to be able to handle multiple backup pieces.
Below is an example of an archival backup.
[oracle@odlinux archivalbkup]$ rman Recovery Manager: Release 11.2.0.1.0 - Production on Sun Aug 29 14:08:43 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target / connected to target database: ODLIN11G (DBID=2071040209) RMAN> @abup.sql RMAN> run { 2> backup database 3> format '/u01/app/oracle/oradata/odlin11g/archivalbkup/%U' 4> tag biannual_01 5> keep until time 'sysdate+182' 6> restore point archbup; 7> } Starting backup at 29-AUG-10 using target database control file instead of recovery catalog current log archived allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=39 device type=DISK backup will be obsolete on date 27-FEB-11 archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/odlin11g/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/odlin11g/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/odlin11g/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/odlin11g/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/odlin11g/users01.dbf channel ORA_DISK_1: starting piece 1 at 29-AUG-10 channel ORA_DISK_1: finished piece 1 at 29-AUG-10 piece handle=/u01/app/oracle/oradata/odlin11g/archivalbkup/05lmiejm_1_1 tag=BIANNUAL_01 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:56 using channel ORA_DISK_1 backup will be obsolete on date 27-FEB-11 archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 29-AUG-10 channel ORA_DISK_1: finished piece 1 at 29-AUG-10 piece handle=/u01/app/oracle/oradata/odlin11g/archivalbkup/06lmiena_1_1 tag=BIANNUAL_01 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 current log archived using channel ORA_DISK_1 backup will be obsolete on date 27-FEB-11 archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=13 RECID=8 STAMP=728316651 channel ORA_DISK_1: starting piece 1 at 29-AUG-10 channel ORA_DISK_1: finished piece 1 at 29-AUG-10 piece handle=/u01/app/oracle/oradata/odlin11g/archivalbkup/07lmienc_1_1 tag=BIANNUAL_01 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 backup will be obsolete on date 27-FEB-11 archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 29-AUG-10 channel ORA_DISK_1: finished piece 1 at 29-AUG-10 piece handle=/u01/app/oracle/oradata/odlin11g/archivalbkup/08lmiend_1_1 tag=BIANNUAL_01 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 29-AUG-10 RMAN> RMAN> **end-of-file** RMAN>
This backup will become obsolete on February 27th 2011. If you find that this backup no longer needs to be exempt from the retention policy you can use the CHANGE
command.
RMAN> change backup tag biannual_01 nokeep; using channel ORA_DISK_1 keep attributes for the backup are deleted backup set key=5 RECID=5 STAMP=728316642 keep attributes for the backup are deleted backup set key=6 RECID=6 STAMP=728316650 keep attributes for the backup are deleted backup set key=7 RECID=7 STAMP=728316652 keep attributes for the backup are deleted backup set key=8 RECID=8 STAMP=728316657 RMAN>
The CHANGE
command can also be used on existing backup to exempt the backup from the current retention policy.
RMAN> change backup tag biannual_01 keep until time 'sysdate+182'; using channel ORA_DISK_1 keep attributes for the backup are changed backup will be obsolete on date 27-FEB-11 backup set key=5 RECID=5 STAMP=728316642 keep attributes for the backup are changed backup will be obsolete on date 27-FEB-11 backup set key=6 RECID=6 STAMP=728316650 keep attributes for the backup are changed backup will be obsolete on date 27-FEB-11 backup set key=7 RECID=7 STAMP=728316652 keep attributes for the backup are changed backup will be obsolete on date 27-FEB-11 backup set key=8 RECID=8 STAMP=728316657 RMAN>
With the CHANGE
command you alter any existing database backup to an archival backup and or alter the time in which the backup is to be exempt from the configured retention policy.
How would you recommend doing a restore with a different DB name and directory structure on the same server?