Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Database Cloning

----------------
Scenerio:
---------
We are going to clone production database called "PROD" to Test database called
"TEST"
Steps:
------
Production Database:
--------------------
1.In production database login as a sys user:
$ORACLE_SID=prod
$sqlplus "/as sysdba"
2.Take controlfile trace copy of the prod database.Issue this command to do.
sql>alter database backup controlfile to trace;
3.This trace file will get stored at Udump location.
4.Shutdown the prod database.
sql>shutdown immediate

Test Database:
--------------
5.copy all datafiles of the prod database to destination location where you are
going to clone tha database.
6.copy and edit the controlfile from udump location of the prod to destination
location
7.Edit the controlfile lines like
old>CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS
new>CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS
8.Remove the two lines from controlfile.
1.Recover database
2.alter database open
# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;
9.Saved the edited control file as SQL file.(Here i mentioned db_create.sql)
10.If you rename the datafile in destination location you must update this at
controfile.Othervise it willnot work.
11.Create Bdump,Udump,Cdump directories at destination location.
12.Copy the old init.ora parameter file from production database to testdatabase
and if necessary edit it.
13.Start the new database.after that issue
sql>@db_create.sql

You might also like