Tuesday, November 22, 2011

Difference b/w Oracle Restore and Recovery

Restore and recovery are two separate steps. Restore is the process of copying back data-files from the backup files.
Recovery is the process of applying transaction information to the data-files to recover them to the state they were in just before the failure occurred.

See the sample example below in case the database has to recovered with the loss of any datafile assuming the controls file, archived redo log file and online redo log files are available.

RMAN> connect target / RMAN> startup mount; RMAN> restore database;

You’ll see several lines of output as RMAN tells you what it is restoring.

Next recover your database as follows:

RMAN> recover database;

You can now open your database for use with the alter database opencommand:

RMAN> alter database open;
database opened

How It Works

RMAN uses information stored in the control file to determine where to retrieve backups and which files to restore and recover.

When you issue the recover database command, RMAN will automatically apply redo to any datafiles that need recovery. The recovery process includes applying changes found in the following:

•Incremental backup pieces (applicable only if using incremental backups)
•Archived redo log files (generated since the last backup or last incremental backup that is applied)
•Online redo log files (current and unarchived)

You can open your database after the restore and recovery process is complete. If you restore from a backup control file, you are required to open your database with the open resetlogs command.