Re: Testing an rman backup

On 6/8/07, Schauss, Peter <peter.schauss@xxxxxxx> wrote:

Environment: Oracle 10.2.0.2.0 HP-UX B 11.23

I am performing hot backups with rman in nocatalog mode.


The first thing you should consider is to start using a database
based recovery catalog.

Yes, nearly everything can be done with a controlfile only, but
the list of operations that become very difficult without the catalog
is rather long.


I would like to
test restore procedures on the same node without destroying the existing
database.


Consider using RESTORE DATABASE VALIDATE CHECK LOGICAL


At this point I do not have the luxury of a clean server on which to run
this test, but I do have sufficient disk space for a second copy of the
instance.

Any suggestions?


Here are some note I have on doing a manual restore.
This is best first done on a server where you can test the procedures.
Disclaimer: Please don't do it for the first time ona production box!

I am assuming that autobackup is turned on.  If not, you will need to
do a little more work (Robert Freeman's book would help here) to recover
the spfile and control files.

==== Restore the spfile



Create a new instance on the recovery server.

Note: If the source server is 64 bit, the recovery server must also be 64
bit, else any attempts to recover will fail.



Get the DBID of the database to be restored.  If not available, then get it
from the backup logs of the server.  You may need to restore the log files
somewhere to read them.



Assume the following:



ORIGINAL database: pr09

     NEW database: ts01



ORACLE_SID=ts01


$> $ORACLE_HOME/bin/rman target /  nocatalog



RMAN>

set DBID=293478129771;

startup nomount;



run {

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';



restore spfile from autobackup;



RELEASE CHANNEL ch00;

}



This will restore the spfile.  This will then need to be saved as a text
based init.ora file.



Logon as SYSDBA;



$> sqlplus '/ as sysdba'



SQL> shutdown immediate;

SQL> startup nomount;

SQL> create pfile='/u01/app/oracle/product/9.2.0/orcldev/dbs/initts01.ora'
from spfile;

SQL> shutdown immediate;



Rename the newly restore spfile so that it will not be used:



$> mv spfilets01.ora spfilets01.ora.restored



Edit the newly used initts01.ora file, changing paths to be correct for the
new database, changing database name, etc.

Use db_file_name_convert and log_file_name_convert in the init.ora to set
the new file names, as this is the simplest method, avoiding the need to
manually use the "SWITCH DATAFILE" command.



Logon as sysdba, and start the database instance in nomount mode:



SQL> startup nomount
pfile='/u01/app/oracle/product/9.2.0/orcldev/dbs/initts01.ora';



Use the following query to verify that the control files will be restored
where you expect:



SQL> select a.KSPPINM NAME , b.KSPPSTVL VALUE

  from X$KSPPI a, X$KSPPCV b

  where a.indx = b.indx

  and  a.KSPPINM = 'control_files';



This is especially important if the restore is taking place on the same
server as the source database.



When you are sure all is correct, restore the controlfiles:



RMAN>

set DBID=293478129771;

startup nomount;



run {

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';



restore controlfile from autobackup;



RELEASE CHANNEL ch00;

}




At this point you can restore the database.  Depending on

where the backup files are located (Tape) it may require setting

some environment variables to get the MML to allow you to

restore the fiiles, though if on the same server, it may not

be a problem.


Did I mention to try this on a test server first?

HTH

--
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: