Restore RMAN
Backup on other Machine having Different Physical Structure:
following documentation is a step by step guide and can be used for to restore rman backup on other machine with different directories structure or database migration from one server to other or database version migration from 64/32 bit to 32/64 bit.
Source machine:
OS: Windows Server 2012
Database: Oracle 11.2.0.2.0
Target machine:
OS: Windows Server 2012
Database: Oracle 11.2.0.2.0
-------------------------------------------------------------------------------
Steps:
1.1- Create Required
Directories:
Create required directories on target machine.
1.2- Copy Pfile from
source:
create pfile='d"\pfile.ora' from spfile;
1.3- Copy this pfile to target and start database in nomount
state from this pfile:
startup nomount pfile='d'\pfile.ora';
1.4- Set
DBID:
set dbid=1275888
1.5- Restore control
File:
restore controlfile from 'D:\test\control_ORCL_2m9KC0e_92';
1.6- Mount
Database:
alter database mount;
1.7- Generating the SET NEWNAME
command:
Generating the SET NEWNAME command for each tempfile in the
database using below script:
select 'set newname for datafile '||file_id||' to
'''||'+DATA'||''';' from dba_data_files;
1.8- 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\APP_USER1.DBF';
SET NEWNAME FOR DATAFILE 7 TO
'D:\app\Administrator\oradata\ORCL\APP_USER2.DBF';
SET NEWNAME FOR DATAFILE 8 TO
'D:\app\Administrator\oradata\ORCL\APP_USERS_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
1.9- Resolving of this
issue:
First shutdown the database.
shu immediate;
startup database;
then open database with resetlogs
alter database open resetlogs;
-------------------------------------------------------------------------------
Convert DB from 64Bit to 32Bit or vice versa
If you want to migrate from a 64/32 bit machine to 32/64 bit then follow all above steps and also use following extra steps
-------------------------------------------------------------------------------
SHUTDOWN IMMEDIATE;
2.2- Startup database with
upgrade option
startup upgrade;
2.3- 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;
No comments:
Post a Comment