Home > Oracle > rman restore of controlfile and spfile

rman restore of controlfile and spfile

RESTORE CONTROLFILE USING RMAN

backups on disk no catalog  

RMAN> set DBID xxxxxxx
RMAN> restore controlfile from  {'<path>' | autobackup};

backups on disk with catalog  

RMAN> restore controlfile

Restore of the control file from controlfile autobackup
Database state : Nomount

RMAN> set dbid xxxxxx

RMAN> restore controlfile from autobackup;

The restored control file is written to all locations listed in the CONTROL_FILES initialization parameter.

Database state : OPEN

RMAN> restore until time 'sysdate-1' CONTROLFILE to '/u02/oradata/20130218_control01.ctl' from autobackup;

Note: The until time clause set the time validity for controlfile. By default RMAN looks for autobackup for 7 days.
If you want to override this then simply use this:

RMAN> restore until time 'sysdate-1 'CONTROLFILE to '/u02/oradata/20130218_control01.ctl' from autobackup maxdays 31;

if you multiple backups of the controlfile on a particular day , restore from autobackup always
restores the latest copy
If you need to restore controlfile from a specific backup then we need to use “SET UNTIL TIME”


run
{
set until time "to_date('20130218:12:01','yyyymmdd:hh24:mi')";
restore controlfile from autobackup preview;
}

Restore Controlfile to a new location

restore controlfile to ‘d:\controlfile_backup\04042012_control01.ctl’;

you can run the above command when the database is in a nomount/mount / open  states as you are not overwritting the controlfile

restore controlfile from a know position

rman> restore controlfile from 'filename';

RESTORING THE SERVER PARAMETER FILE (SPFILE) FROM BACKUP

using recovery catalog

rman> connect target /

rman> startup force mount; -- ( rman starts the instance with a dummy parameter file)

rman> restore spfile  from autobackup ;

to restore to a non default location

rman> restore spfile to '/tmp/spfiletest.ora' from autobackup ;

Using controlfile autobackups

rman> set dbid xxxxxxx;  ( if you need to get the dbid refer to http://arjudba.blogspot.co.uk/2008/05/how-to-discover-find-dbid.html )

rman> restore spfile from autobackup;

if you need to serach past the 7 days default

rman> restore until time 'sysdate-1' SPFILE to '/tmp/spfiletest.ora' from autobackup maxdays 100;

Example of recovering spfile and controlfile using rman

rman target =/

rman> set dbid = xxxxxx  if you need to get the dbid refer to http://arjudba.blogspot.co.uk/2008/05/how-to-discover-find-dbid.html )
rman>
run
{
set controlfile autobackup format for device type disk to '/rmanbackup/oradata/uknppp/cf_%F';
restore spfile from autobackup;
}

rman> shutdown;

rman> startup force nomount;

rman> run
{

set controlfile autobackup format for device type disk to '/rmanbackup/oradata/uknppp/cf_%F';
restore controlfile from autobackup;

}

Advertisements
Categories: Oracle
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: