RMAN Restore Command

RMAN restores are performed using the RESTORE statement

A restore operation copies one or more files from the backup media back to disk. Following a restore operation, RECOVER operation is required to ensure that the restored files are consistent.

To restore the entire database from a backup use:

RESTORE DATABASE;

To restore a specific data file use RESTORE DATAFILE. For example:

RESTORE DATAFILE '/u01/app/oradata/TEST/users01.dbf';

Altermatively specify the data file number. For example:

RESTORE DATAFILE 4;

The data file number can be obtained from V$DATAFILE. For example:

SELECT file#, name FROM v$datafile;

To restore the control file from an autobackup use:

  RESTORE CONTROLFILE FROM AUTOBACKUP;

For example:

RUN
{
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/backup/TEST/%F';
  ALLOCATE CHANNEL ch11 DEVICE TYPE DISK FORMAT '/u01/backup/TEST/%F';
  RESTORE CONTROLFILE FROM AUTOBACKUP;
}

Restore Preview

To generate a preview of a restore operation use:

RMAN> RESTORE DATABASE PREVIEW;

Note that this operation uses metadata to generate output. It does not scan the backup files

For example:

RMAN> RESTORE DATABASE PREVIEW;

Starting restore at 23-SEP-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
57      Full    1.13G      DISK        00:02:29     23-SEP-15
        BP Key: 60   Status: AVAILABLE  Compressed: NO  Tag: TAG20150923T044455
        Piece Name: /u03/app/oracle/fast_recovery_area/TEST/backupset/2015_09_23/o1_mf_nnndf_TAG20150923T044455_c0481qyb_.bkp
  List of Datafiles in backup set 57
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 4456951    23-SEP-15 /u01/app/oradata/TEST/system01.dbf
  2       Full 4456951    23-SEP-15 /u01/app/oradata/TEST/sysaux01.dbf
  3       Full 4456951    23-SEP-15 /u01/app/oradata/TEST/undotbs01.dbf
  4       Full 4456951    23-SEP-15 /u01/app/oradata/TEST/users01.dbf
using channel ORA_DISK_1

archived logs generated after SCN 4453629 not found in repository
Media recovery start SCN is 4453629
Recovery must be done beyond SCN 4456951 to clear datafile fuzziness
Finished restore at 23-SEP-15

To generate a summary of a restore operation preview use:

RMAN> RESTORE DATABASE PREVIEW SUMMARY;

For example:

RMAN> RESTORE DATABASE PREVIEW SUMMARY;

Starting restore at 23-SEP-15
using channel ORA_DISK_1


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
57      B  F  A DISK        23-SEP-15       1       1       NO         TAG20150923T044455

archived logs generated after SCN 4453629 not found in repository
Media recovery start SCN is 4453629
Recovery must be done beyond SCN 4456951 to clear datafile fuzziness
Finished restore at 23-SEP-15