Tuesday 25 June 2013

Steps to Restore RMAN Backup on other Machine having Different Physical Structure

------------------------------------------------------------------------------------------------------
Steps to Restore RMAN Backup on other Machine having Different Physical Structure
------------------------------------------------------------------------------------------------------
------------------------Create Required Directories---------------------------------------------------
---------------------------Copy Pfile from source----------------------------------------------------

create pfile='d"\pfile.ora' from spfile;

Copy this pfile to target and start Database in nomount state from this pfile.

startup nomount pfile='d'\pfile.ora';
------------------------------------------------------------------------------------------------------
-------------------------------------Set DBID---------------------------------------------------------

 set dbid=1275888
------------------------------------------------------------------------------------------------------
------------------------------Restore control File----------------------------------------------------

restore controlfile from 'D:\test\control_ORCL_2m9KC0e_92';

------------------------------------------------------------------------------------------------------
------------------------------Mount Database----------------------------------------------------------

alter database mount;

------------------------------------------------------------------------------------------------------
----------------RMAN Block to rename Datafiles and restore database-----------------------------------
RUN
{
SET NEWNAME FOR DATAFILE 1 TO 'D:\app\Administrator\oradata\ORCL\SYSTEM01.DBF';
SET NEWNAME FOR DATAFILE 2 TO 'D:\app\Administrator\oradata\ORCL\SYSAUX01.DBF';
SET NEWNAME FOR DATAFILE 3 TO 'D:\app\Administrator\oradata\ORCL\UNDOTBS01.DBF';
SET NEWNAME FOR DATAFILE 4 TO 'D:\app\Administrator\oradata\ORCL\USERS01.DBF';
SET NEWNAME FOR DATAFILE 5 TO 'D:\app\Administrator\oradata\ORCL\EXAMPLE01.DBF';
SET NEWNAME FOR DATAFILE 6 TO 'D:\app\Administrator\oradata\ORCL\EPARS_MSG_COMM_FBR.DBF';
SET NEWNAME FOR DATAFILE 7 TO 'D:\app\Administrator\oradata\ORCL\EPARS_TCH_APP_FBR.DBF';
SET NEWNAME FOR DATAFILE 8 TO 'D:\app\Administrator\oradata\ORCL\EPARS_INDEXES.DBF';
SQL "ALTER DATABASE RENAME FILE ''S:\app\Administrator\oradata\ORCL\redo01.log''
      TO ''D:\app\Administrator\oradata\ORCL\redo01.log'' ";
  SQL "ALTER DATABASE RENAME FILE ''S:\app\Administrator\oradata\ORCL\redo02.log''
      TO ''D:\app\Administrator\oradata\ORCL\redo02.log'' ";
SQL "ALTER DATABASE RENAME FILE ''S:\app\Administrator\oradata\ORCL\redo03.log''
      TO ''D:\app\Administrator\oradata\ORCL\redo03.log'' ";
  # Do a SET UNTIL to prevent recovery of the online logs
  #set until time "to_date('2011-13-04:11:40:00', 'yyyy-dd-mm:hh24:mi:ss')";
  # restore the database and switch the datafile names
  RESTORE DATABASE;
  SWITCH DATAFILE ALL;
  # recover the database
  RECOVER DATABASE;
}
------------------------------------------------------------------------------------------------------
----------------------------------Output of RMAN command---------------------------------------------

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/25/2004 15:59:41
RMAN-06054: media recovery requesting unknown log: thread 1 scn 140830

------------------------------------------------------------------------------------------------------
------------------------------Resolving of this issue-------------------------------------------------

First down the DB.
startup database
then open database with resetlogs
------------------------------------------------------------------------------------------------------
----------------------------------Down the Database---------------------------------------------------

shutdown immediate;
-------------------------------------------------------------------------------------------------------
---------------------------------Startup database------------------------------------------------------

startup;
-------------------------------------------------------------------------------------------------------
-----------------------------------Open database with resetlogs----------------------------------------

alter database open resetlogs;
--------------------------------------------------------------------------------------------------------
------------------------------------Resoloving virsion problem------------------------------------------

If you convert DB from 64Bit to 32Bit then use following steps

--------------------------------------------------------------------------------------------------------

SHUTDOWN IMMEDIATE;

--------------------------------------------------------------------------------------------------------
--------------------------------------Startup database with upgrade option------------------------------

startup upgrade;

--------------------------------------------------------------------------------------------------------
-----------------------------------------Now run do following steps-------------------------------------

1) startup upgrade;
2) @?/rdbms/admin/utlirp.sql
3) shutdown immediate;
4) startup;
5) drop user QCSITEADMIN_DB0 cascade;
6) shutdown immediate;
7) startup upgrade;
8) @?/rdbms/admin/utlirp.sql
9) shutdown immediate;
10) startup;
---------------------------------------------------------------------------------------------------------
----------------------------------------------END--------------------------------------------------------