Wednesday, 11 December 2013

Steps for performing database cloning using hot backup


 Below steps helps you in performing database cloning using hot backup
...

Assumptions:

1. directory structure is different in both source and target servers
2. Oracle version : 10.2.0.5
3. OS version : Linux 5
4. target database name is same as source database name
5. DATABASE SHOULD BE IN ARCHIVEMODE

step 1 : Take the hot backup of source database

If the souce database in not in Archivemode, alter database to archivemode.

SQL> STARTUP MOUNT;

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE OPEN;

sql> alter database begin backup;
 
Check the status whether the datafiles are in backup mode.
select * from v$backup;
FILE# STATUS CHANGE# TIME
===========================
1 ACTIVE 000007 22-DEC-11
2 ACTIVE 000007 22-DEC-11

 
 
 $ copy datafiles to backup location

select name from v$datafile;
NAME
================================================
/oradata/test123/system01.dbf
/oradata/test123/undotbs01.dbf
SQL>exit
$ cd /u04/app/oracle/product/10.2.0/oradata/test/
$ ls -lrt
-rw-r-- 1 oracle staff 209723392 DEC 22 10:00 undotbs01.dbf
-rw-r-- 1 oracle staff 429924352 DEC 22 10:00 system01.dbf
$ cp *.dbf /oradata/clonedb/data

 sql> alter database end backup;

step 2 : Take controlfile trace and pfile or spfile (that was using by the source database)

step 3 : Install Oracle software on another machine (choose “Install only” option in OUI). Don’t create any database

step 4 : Copy all the files (including trace file and pfile or spfile) from source server to target server either using FTP or rcp
Note: Not necessary in copying control files and redologfiles

step 5 : Place pfile or spfile in “dbs” directory on target

step 6 : Copy the remaining files to their respective locations (If any directories are missing, do create them)

step 7 : Connect as sysdba and Startup the database in nomount stage

step 8 : Edit the trace file (that was copied) and generate a create controlfile script from it.
Modify the script and specify the new locations of the files.

step 9 : Execute the controlfile script which will create controlfiles in the location specified in CONTROL_FILES parameter.
Once control files are created, database will be forwarded to MOUNT state.

sql> @create_controlfile.sql

step 10 : Finally, Open the database with resetlogs option

sql> startup nomount

sql> alter database mount;

sql> recover database using backup controlfile until cancel;

sql> alter database open resetlogs;



No comments:

Post a comment