Sie sind auf Seite 1von 5

Restoring oracle 10g Cold backup on different host with different directory

structure.
This is very common to restore our database from one system to another system with the same
database name but having different directory structure. I try to do it with cold backup. I am
using windows XP and oracle 10.2.0

Steps are as follow.

1.) Go to your source database server.


C:\Documents and Settings\Administrator>sqlplus sys as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 18 17:08:31 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

2.) This is my file structure at the source database server.

SQL> select file_name from dba_data_files;

FILE_NAME
------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF

SQL> select name from v$controlfile;


NAME
------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL
SQL> select member from v$logfile;
MEMBER
------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG

SQL> create pfile from spfile;


File created.

SQL> shutdown immediate

3.) Now copy your datafiles, controlfile, redolog file and pfile to the destination system using
os copy command at place where you want it.

4.) At destination system first to create instance using (only in case of windows OS)

Z:\> oradim -new -sid orcl -intpwd a123 -startmode M


Instance created.

You can check it in the services name as OracleServiceorcl running.


i.e. your instance is created.

5.) At destination pfile named as initorcl.ora should be at /database i.e. in my case


D:\oracle\product\10.2.0\db_1\database\initorcl.ora

In linux it is should be at
D:\oracle\product\10.2.0\db_1\dbs\initorcl.ora

6.) Here a little change is required. I am changing only place of my datafiles, controlfile,
redolog file so in iniorcl.ora file I change accordingly. rest of the parameters like bdump,
adump etc are same as source database

control_files='D:\oracle\product\10.2.0/oradata/control01.ctl','D:\oracle\product\10.2.0/oradat
a/control02.ctl','D:\oracle\product\10.2.0/oradata/control03.ctl'

This shows my controlfile new path.

While at source it was like

control_files='D:\oracle\product\10.2.0/oradata/orcl/control01.ctl','D:\oracle\product\10.2.0/or
adata/ orcl/control02.ctl','D:\oracle\product\10.2.0/oradata/orcl/control03.ctl'

7.) Now start your database in nomount stage using.

8.) Z:\>set oracle_sid=orcl


SQL> startup nomount
ORACLE instance started.

Total System Global Area 612368384 bytes


Fixed Size 1250428 bytes
Variable Size 171969412 bytes
Database Buffers 432013312 bytes
Redo Buffers 7135232 bytes

And then open its controlfile using command

SQL> alter database mount;


Database altered.

Now you can read the path for datafiles, controlfile, redolog which we need to change.

SQL> select file_name from dba_data_files;

FILE_NAME
------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF

SQL> select member from v$logfile;

MEMBER
------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG

As it is clear it points to source database server path which we need to change.

9.) Now command to change files path according to new server.


SQL> alter database rename file
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF' to
'D:\oracle\product\10.2.0\oradata\SYSTEM01.DBF';
Database altered.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\SYSTEM01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF' to
'D:\oracle\product\10.2.0\oradata\UNDOTBS01.DBF';

Database altered.

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF' to
'D:\oracle\product\10.2.0\oradata\SYSAUX01.DBF';

Database altered.

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF' to
'D:\oracle\product\10.2.0\oradata\USERS01.DBF';

Database altered.

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' to
'D:\oracle\product\10.2.0\oradata\REDO03.LOG';

Database altered.

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' to
'D:\oracle\product\10.2.0\oradata\REDO02.LOG';

Database altered.

SQL> alter database rename file


'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' to
'D:\oracle\product\10.2.0\oradata\REDO01.LOG';

Database altered.

10.) Now you can open your database with command

SQL> alter database open;


Database altered.

Now your database is ready to use.

Please share your feedback about this article.

You might also like:


Cloning a database in Oracle 10g Using RMAN in Windows OS on same system

Important Changes to Oracle Database Patch Sets Starting With 11.2.0.2

Step By Step Manual Database Upgrade to 11.2.0.2

Das könnte Ihnen auch gefallen