Thursday, August 19, 2010

Database cloning with hot backup (if directory structure is same)


Posted by Pavan Kumar on March 26, 2010
Here are the steps for performing database cloning using hot backup to a different server. I am assuming you are using same directory structure in the target server also.
Assumed Oracle version : 10.2.0.4, OS version : Linux 5
Step 1 : Take database hot backup as follows
sql> alter system switch logfile;
sql> alter database begin backup;
$ cp *.dbf to backup location (as it is hot backup, we will not take backup of redolog files)
sql> alter database end backup;
sql> alter system switch logfile;
$ cp *.ctl to backup location
Note: If you are using 9i database, use “tablespace begin backup/end backup” clauses
step 2 : Take backup of spfile or pfile of source database and also archives
step 3 : Install oracle software in target server (select “software only” option in OUI)
step 4 : copy the files to target server either using FTP or any methods
step 5 : place pfile or spfile in dbs directory
step 6 : copy all files (datafiles, controlfiles and archives) to respective locations
step 7 : do the following
sql> startup nomount
sql> alter database mount;
sql> recover database using backup controlfile until cancel;
here it will ask to apply archives and will give suggestion as file name and path. apply required archives
step 8 : finally, open your database with resetlogs option
sql> alter database open resetlogs;
Sometimes you may get following error while doing hot backup cloning
ORA-01194 file 1 needs more recovery to be consistent error
in such cases, do a switch logfile in source server and copy & apply that archive logfile in target server

No comments:

Post a Comment