Restore and Recover database to a new host  

Posted by Mawahid in


In this case DBID of the database will be the same as of original database. But whenever your purpose is to create a new copy of the database then use RMAN DUPLICATE; this will change the DBID of the new database.

In this example my database name dbase1 and it is running on host1, I will be taking backup on host1, transfer them to host2 and restore-recovery.


1)  On Host1 (dbase1)

RMAN> backup database; 

piece handle=/oradata2/flash_recovery_area/DBASE1/backupset/2008_05_06/o1_mf_nnndf_TAG20080506T150716_421c355f_.bkp tag=TAG20080506T150716 comment=NONE

Starting Control File and SPFILE Autobackup 
piece handle=/oradata2/flash_recovery_area/DBASE1/autobackup/2008_05_06/o1_mf_s_654016132_421c64vl_.bkp
Finished Control File and SPFILE Autobackup



2) Now transfer these files to host2 

3) Determine the DBID of source machine(Dbase1)

SQL> select dbid from v$database;
DBID
----------
3386862614


4) Now perform task on target machine(host2 here).

First set ORACLE_SID,


-bash-3.00$export ORACLE_SID=dbase1

 
Then connect to rman,


-bash-3.00$ rman target /


5) Set DBID and restore spfile to pfile.
 
RMAN> set dbid 3386862614


RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes
Fixed Size 2019224 bytes
Variable Size 67108968 bytes
Database Buffers 83886080 bytes
Redo Buffers 6369280 bytes

RMAN> restore spfile to pfile '/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora' from '/oradata2/o1_mf_s_654016132_421c64vl_.bkp';


6) start the instance with pfile.
 
RMAN> STARTUP FORCE NOMOUNT PFILE='/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora';
 

7) Restore controlfile and mount the database.

RMAN> RESTORE CONTROLFILE FROM '/oradata2/o1_mf_s_654016132_421c64vl_.bkp';
 
RMAN> ALTER DATABASE MOUNT; 

8) From SQL*Plus determine the data file and redo log file name.

SQL> COLUMN NAME FORMAT a70
SELECT FILE# AS "File/Grp#", NAME FROM V$DATAFILE UNION SELECT GROUP#,MEMBER FROM V$LOGFILE;


9) Catalog your backuppiece.

RMAN> catalog backuppiece '/oradata2/o1_mf_nnndf_TAG20080506T150716_421c355f_.bkp';
 
RMAN> list backup; 

Here we get dbfiles and scn information, which will be useful in next step. 

10) Make a script by issuing SET NEWNAME if you want different file name other than source.

In the script issue SET UNTIL clause and restore and recover database.

RMAN> run{
set newname for datafile 1 to '/oradata2/DBase1/system01.dbf';
set newname for datafile 2 to '/oradata2/DBase1/undotbs01.dbf';
set newname for datafile 3 to '/oradata2/DBase1/sysaux01.dbf';
set newname for datafile 4 to '/oradata2/DBase1/users01.dbf';
set newname for datafile 5 to '/oradata2/DBase1/tbs201.dbf';
set newname for datafile 6 to '/oradata2/DBase1/after_01.dbf';
set newname for datafile 7 to '/oradata2/DBase1/after_02.dbf';
set newname for datafile 8 to '/oradata2/DBase1/after_03.dbf';
set newname for datafile 1 to '/oradata2/DBase1/system01.dbf';

SET UNTIL SCN 745212;
RESTORE DATABASE;
SWITCH DATAFILE ALL;
RECOVER DATABASE;
}


11) Open the Database resetlogs option.
 
RMAN> alter database open resetlogs;

database opened.


 

This entry was posted on Tuesday, January 11, 2011 at 9:04 AM and is filed under . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment