It all starts with a full backup of the database, including the archived redo logs, database spfile and control files:


  1. [oracle@vm501 ~]$ . oraenv  
  2. ORACLE_SID = [orcle] ? orcl2  
  3. The Oracle base has been set to /u01/app/oracle  
  4.   
  5. [oracle@vm501 ~]$ rman target /  
  6. connected to target database: ORCL2 (DBID=843703910)  
  7. RMAN> configure controlfile autobackup on;  
  8. RMAN> backup database plus archivelog delete input;  
  9.       


Note the DBID when connecting with RMAN to the database, which will be required when restoring the database controlfile from autobackup.

A full database backup will always include a copy of the database spfile and control file, however, with RMAN autobackup enabled, the restore process will be easier to manage. The option "delete all input" is not required, but usually a good practice to save disk space, since archived redo logs can build up and occupy a substantial amount of disk space.

The autobackup information will be shown at the the end of the backup.


  1. Starting Control File and SPFILE Autobackup at 10-MAY-15  
  2. piece handle=/u03/fast_recovery_area/ORCL2/autobackup/2015_05_10/o1_mf_s_879364591_bnz6yhy5_.bkp comment=NONE  
  3. Finished Control File and SPFILE Autobackup at 10-MAY-15  
  4.           


Delete all database files:


  1. [oracle@vm501 ~]$ echo "shutdown abort;" | sqlplus / as sysdba  
  2.   
  3. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_system_bnz5okkg_.dbf  
  4. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_sysaux_bnz5okll_.dbf  
  5. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_undotbs1_bnz5okn4_.dbf  
  6. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_users_bnz5oknl_.dbf  
  7. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_example_bnz5okmm_.dbf  
  8. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/datafile/o1_mf_temp_bnz68bpj_.tmp  
  9. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/onlinelog/o1_mf_3_bnz6887c_.log  
  10. [oracle@vm501 ~]$rm -f /u03/fast_recovery_area/ORCL2/onlinelog/o1_mf_3_bnz688b0_.log  
  11. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/onlinelog/o1_mf_2_bnz687so_.log  
  12. [oracle@vm501 ~]$rm -f /u03/fast_recovery_area/ORCL2/onlinelog/o1_mf_2_bnz687wt_.log  
  13. [oracle@vm501 ~]$rm -f /u02/oradata/ORCL2/onlinelog/o1_mf_1_bnz687c6_.log  
  14. [oracle@vm501 ~]$rm -f /u03/fast_recovery_area/ORCL2/onlinelog/o1_mf_1_bnz687g2_.log  
  15.           


In order for a database instance to know about previous data files, it is necessary to restore the database control file and spfile. Don't forget to delete the previous spfile! Otherwise, using "startup nomount" would use the already existing spfile for the instance and would not allow to restore the spfile from autobackup. When a database instance is started using nomount without a spfile, Oracle will automatically use a dummy pfile.


  1. [oracle@vm501 ~]$rm -f $ORACLE_HOME/dbs/spfileorcl2.ora  
  2.     


To restore any database files, RMAN requires a database instance. A database instance does not require any database files and only provides the process and memory structures that can be used by an Oracle database. Using the "startup nomount" command, the Oracle instance creates the necessary processes and memory structures, but does not access the database control file and has no knowledge about the database data files. Once the spfile has been restored, we can start the database instance with the appropriate parameters and continue with restoring the database control and data files.

After the database has been restored, the database needs to be recovered. The following shows the commands:


  1. [oracle@vm501 ~]$ . oraenv  
  2. ORACLE_SID = [orcl2] ? orcl2  
  3. The Oracle base remains unchanged with value /u01/app/oracle  
  4.   
  5. [oracle@vm501 ~]$ rman target /  
  6.   
  7. connected to target database (not started)  
  8.   
  9. RMAN> set DBID 843703910  
  10. RMAN> startup nomount  
  11. RMAN> restore spfile from autobackup  
  12.       db_recovery_file_dest='/u03/fast_recovery_area' db_name='ORCL2';  
  13. RMAN> startup force nomount  
  14. RMAN> restore controlfile from autobackup;  
  15. RMAN> startup force mount  
  16. RMAN> restore database;  
  17. RMAN> recover database;  
  18.   
  19. RMAN-06054: media recovery requesting unknown archived log for thread 1  
  20.           


The RMAN-06054 error in this case is benign. It appears because the recovery procedure continues requesting the next archive log, however, the database has been already been recovered to a consistent state and there are no more archived redo logs to apply. The error could be avoided by using the UNTIL clause and specifying the last database SCN or archivelog sequence that needs to be applied, like it is done when performing a database point in time restore and recovery (PITR), but it is not necessary in this case.

The database needs to be opened with RESETLOGS, which is always necessary when restoring an RMAN backup control file, or when the online redo logs are unavailable or cannot be applied. RESETLOG creates a new database incarnation resetting the log sequence to 1 and either resets or creates new redo log files according to the database init parameter (spfile).


  1. RMAN> alter database open resetlogs;  
  2. database opened  
  3.           


That's all there is and the database has been restored and recovered. Since the recovery process did not use the online redo logs, this will be called an incomplete recovery and most recent information might be lost.


As outlined earlier, a full backup will always include the spfile file and database control file. If your RMAN configuration did not include "autobackup", you can still restore the spfile and control file. The process in such scenario is more difficult because you have to restore the spfile and control file by specifying the appropriate RMAN backupset. Since this information is stored in the database control file, you cannot access such information prior to restoring the spfile and control file, unless you made an appropriate note or synchronized the RMAN backup repository with an optional RMAN catalog database.

For example:


  1. including current control file in backup set  
  2. including current SPFILE in backup set  
  3. channel ORA_DISK_1: starting piece 1 at 10-MAY-15  
  4. channel ORA_DISK_1: finished piece 1 at 10-MAY-15  
  5. piece handle=/u03/fast_recovery_area/ORCL2/backupset/2015_05_10/o1_mf_ncsnf_TAG20150510T183149_bnz20tdn_.bkp  
  6.           



  1. RMAN> restore spfile from '/u03/fast_recovery_area/ORCL2/backupset/2015_05_10/o1_mf_ncsnf_TAG20150510T183149_bnz20tdn_.bkp';  
  2. RMAN> restore controlfile from '/u03/fast_recovery_area/ORCL2/backupset/2015_05_10/o1_mf_ncsnf_TAG20150510T183149_bnz20tdn_.bkp'  
  3.