Pages

Thursday, July 5, 2012

RMAN - Restoring SPFILE and Control File

Recovering a Lost Control File

If you are running NOARCHIVELOG mode

rman target /
startup nomount;
restore controlfile from autobackup;
alter database mount;
recover database noredo;
alter database open resetlogs;

If you are running ARCHIVELOG mode, recovery is only slightly different:

rman target /
startup nomount;
restore controlfile from autobackup;
alter database mount;
recover database;
alter database open resetlogs;

Restoring the server parameter file (SPFILE)

If you lose your server parameter file (SPFILE), RMAN can restore it to its default location or to a location of your choice.  Unlike the loss of the control file, the loss of your SPFILE does not cause your instance to immediately stop.  Your instance may continue operating, although you will have to shut it down and restart it after restoring the SPFILE.

1. If the database is up at the time of the loss of the SPFILE, connect to the target database.

rman target /


If the database it not up when the SPFILE is lost, and you are not using a recovery catalog, then you must set the DBID of the target database.

2. Shut down the instance and restart it without mounting. When the SPFILE is not available, RMAN starts the instance with a dummy parameter file.

startup force nomount;


3. Restore the server parameter file. If restoring to the default location, then run:

restore spfile from autobackup;


If restoring to a nondefault location, then you could run commands as in the following example;

restore spfile to '/home/oracle/spfileTEMP.ora' from autobackup;


4. Restart the instance with the restored file. If restarting with a server parameter file in a nondefault location, then create a new client-side initialization parameter file with the single line SPFILE=new_location, where new_location is the path name of the restored server parameter file. Then, restart the instance with the client-side initialization parameter file.

For example, create a file /tmp/init.ora which contains the single line:
SPFILE=/home/oracle/spfileTEMP.ora


Then use this RMAN command, to restart the instance based on the restored SPFILE:

startup force pfile=/tmp/init.ora;



No comments:

Post a Comment