The following is a simple example how to use RMAN to backup a running Oracle 11g database and how to fully restore and recover it when all database files are lost or have been destroyed. It assumes that the database is running in Archive Log mode and that the Fast Recovery Area (FRA) has been configured for easier data management. Please see the Oracle documentation for more information.

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

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.

Starting Control File and SPFILE Autobackup at 10-MAY-15
piece handle=/u03/fast_recovery_area/ORCL2/autobackup/2015_05_10/o1_mf_s_879364591_bnz6yhy5_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 10-MAY-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.

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

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:

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).

RMAN> alter database open resetlogs;
database opened

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:

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