Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
14Activity
0 of .
Results for:
No results containing your search query
P. 1
Copy and Rename an Oracle Database

Copy and Rename an Oracle Database

Ratings: (0)|Views: 189|Likes:
Published by SHAHID FAROOQ

More info:

Published by: SHAHID FAROOQ on Aug 29, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/23/2010

pdf

text

original

 
Copy and Rename an Oracle Database -
(without export/import)
 
by Jeff Hunter, Sr. Database Administrator 
 You may find it necessary to duplicate (clone) an Oracle database. One method is to use import/export.This method can work fine, but what if your database is too big? Another method is to make a copy of the current database and rename it. This month I will present an article that explains the stepsnecessary to copy and rename a database. This article will assume that the original database is calledPROD and you want to create a TEST duplicate database.
1.) Copy production database files and init.ora
 The first step is to locate and copy all database files to their new location. You can use the viewV$DATAFILE in the PROD database to locate these files. Before running the query fromV$DATAFILE, ensure that you are connected to the PROD database by selecting fromV$DATABASE:
SQL> select name from v$database;NAME---------------------------------------PRODSQL> select name from v$datafile;NAME---------------------------------------/u08/app/oradata/PROD/system01.dbf/u06/app/oradata/PROD/rbs01.dbf/u07/app/oradata/PROD/temp01.dbf/u10/app/oradata/PROD/userd01.dbf/u09/app/oradata/PROD/userx01.dbf
After recording these files, shutdown the PROD database and perform an operating system copy of alldatabase files to another location and/or machine. In my example, I will copy all datafiles to a newlocation as shown in the following table:
Old LocationNew Location
/u08/app/oradata/PROD/system01.dbf/u08/app/oradata/TEST/system01.dbf/u06/app/oradata/PROD/rbs01.dbf/u06/app/oradata/TEST/rbs01.dbf/u07/app/oradata/PROD/temp01.dbf/u07/app/oradata/TEST/temp01.dbf/u10/app/oradata/PROD/userd01.dbf/u10/app/oradata/TEST/userd01.dbf/u09/app/oradata/PROD/userx01.dbf/u09/app/oradata/TEST/userx01.dbf
After copying all files to their new location, startup the PROD database.From the production database, get a copy of the initPROD.ora file and copy it to initTEST.ora. In theinitTEST.ora file, change the value of "db_name" from PROD to TEST. Keep in mind that you mayalso need to change:
audit_file_dest
 background_dump_dest
control_files
 
core_dump_dest
log_archive_dest
user_dump_destIf the TEST database is going to be on a different machine, copy the initTEST.ora file to that machinein the proper directory.
2.) Create the script that will re-create the controlfile
 Using SVRMGR on the PROD database, create a script that will be able to re-create the controlfile for the database.
PROD on testdb: svrmgrlSVRMGR> connect internalConnected.SVRMGR> alter database backup controlfile to trace;Statement processed.
The above statement will put a text copy of the controlfile in the USER_DUMP_DEST directory. Youwill need to search for the newest trace file in this directory. In UNIX you can use the "ls -lt"command. Once you find the correct trace file, rename it to cr_control.sql and edit it as follows:
Remove everything up to the "START NOMOUNT" statement and everything after thesemicolon at the end of the "CREATE CONTROLFILE" statement.
Edit the line starting with "CREATE CONTROLFILE" and replace the word "REUSE"with the word "SET" right before the keyword DATABASE.
On the same line, modify the database name changing it from PROD to TEST.
On the same line, change the keyword NORESETLOGS to RESETLOGS.Your script should now read:
Edited file cr_control.sql
STARTUP NOMOUNTCREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS NOARCHIVELOGMAXLOGFILES 32MAXLOGMEMBERS 5MAXDATAFILES 600MAXINSTANCES 10MAXLOGHISTORY 1000LOGFILEGROUP 1 ('/u03/app/oradata/TEST/redo_g01a.log','/u04/app/oradata/TEST/redo_g01b.log','/u05/app/oradata/TEST/redo_g01c.log') SIZE 200K,GROUP 2 ('/u03/app/oradata/TEST/redo_g02a.log','/u04/app/oradata/TEST/redo_g02b.log','/u05/app/oradata/TEST/redo_g02c.log') SIZE 200K,GROUP 3 ('/u03/app/oradata/TEST/redo_g03a.log','/u04/app/oradata/TEST/redo_g03b.log','/u05/app/oradata/TEST/redo_g03c.log') SIZE 200KDATAFILE'/u08/app/oradata/TEST/system01.dbf',

Activity (14)

You've already reviewed this. Edit your review.
1 hundred reads
sunny_dba liked this
brijesh1747 liked this
dayasc liked this
shiva liked this
mailmsgill8561 liked this
vino5bora liked this
schow906291 liked this
kpbn liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->