Reference
This information is taken from pp.394-397 of OCP Oracle Database 11g New Features for Administrators Exam Guide (exam 1Z0-050) .
Prerequisites
RMAN catalogue is needed both for backup and restore of a database from an archival backup.
Overview
“The database switches the redo logs so it can archive the current online redo log. RMAN needs the current redo information to make the database consistent upon a database restoration.” (p.396)
“RMAN backs up all the datafiles, archived redo logs, the control file, and the server parameter file.” (p.396)
“RMAN backs up only those archived redo logs necessary to recover the database to a consistent state.” (p.396)
Important Keywords
KEEP
To keep a backup for a full year:
KEEP UNTIL TIME 'sysdate + 365'
To keep a backup forever:
KEEP FOREVER
RESTORE POINT
“If you specify the optional
restore point
clause, the database will create a restore point that captures the SCN at the time RMAN backup completes.” (p.396)
“The control file autobackup stores the restore point so RMAN can utilize it when you restore the control file.” (p.396)
RESTORE POINT fy2011
Sample Commands
Create an Archival Backup
BACKUP DATABASE
FORMAT '/backup/%U.bkp'
TAG 'yearly'
KEEP FOREVER
RESTORE POINT fy2011;
Change a Regular Backup to an Archival One
CHANGE BACKUP TAG 'yearly' KEEP FOREVER;
Change Archival Backup to Regular One
CHANGE COPY OF DATABASE CONTROLFILE NOKEEP;
Resoring an Archival Backup
CONNECT TARGET SYS/pw@target CONNECT CATALOG RMAN/pw@rmancat CONNECT AUXILIARY / LIST RESTORE POINT ALL; DUPLICATE DATABASE TO newdb UNTIL RESTORE POINT fy2011 DB_FILE_CONVERT= '+DATA/TARGET','+DATA/NEWDB' PFILE='/u01/app/oracle/product/11.1.0/dbs/pfilenewdb.ora';
Demonstration
I have created an archival backup on the
EXAMPLE
database on
BANKSTOWN
:
RMAN> backup database 2> format "/u01/app/oracle/backup/example/%U.bkp" 3> keep forever 4> restore point "initial_backup" 5> ; Starting backup at 12-JAN-12 current log archived using channel ORA_DISK_1 backup will never be obsolete 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=+DATA/example/datafile/system.275.772293495 input datafile file number=00002 name=+DATA/example/datafile/sysaux.273.772293497 input datafile file number=00005 name=+DATA/example/datafile/example.258.772293901 input datafile file number=00006 name=+DATA/example/datafile/encrypted_ts.264.772374221 input datafile file number=00003 name=+DATA/example/datafile/undotbs1.272.772293497 input datafile file number=00004 name=+DATA/example/datafile/users.271.772293497 channel ORA_DISK_1: starting piece 1 at 12-JAN-12 channel ORA_DISK_1: finished piece 1 at 12-JAN-12 piece handle=/u01/app/oracle/backup/example/04n0j11i_1_1.bkp tag=TAG20120112T124639 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:04:20 current log archived using channel ORA_DISK_1 backup will never be obsolete 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=8 RECID=7 STAMP=772375865 channel ORA_DISK_1: starting piece 1 at 12-JAN-12 channel ORA_DISK_1: finished piece 1 at 12-JAN-12 piece handle=/u01/app/oracle/backup/example/05n0j19r_1_1.bkp tag=TAG20120112T124639 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 backup will never be obsolete 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 12-JAN-12 channel ORA_DISK_1: finished piece 1 at 12-JAN-12 piece handle=/u01/app/oracle/backup/example/06n0j19s_1_1.bkp tag=TAG20120112T124639 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 backup will never be obsolete 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 12-JAN-12 channel ORA_DISK_1: finished piece 1 at 12-JAN-12 piece handle=/u01/app/oracle/backup/example/07n0j19t_1_1.bkp tag=TAG20120112T124639 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 12-JAN-12 RMAN> list restore point all; starting full resync of recovery catalog full resync complete SCN RSP Time Type Time Name ---------------- --------- ---------- --------- ---- 620161 12-JAN-12 initial_backup