Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Clone Database
Steps to Clone a Database
Joe LaCascio 10-JUL-96
connect internal; startup; exit;
3. Create a backup controlfile of the database you wish to clone.
From within SVRMGRL
connect internal; alter database backup controlfile to trace; exit;
This will create a trace file under the current sid's udump directory if a udump directory exists as specified in this sid's initSID.ora file. If a udump directory does not exists, the trace file will be under either the default trace dump directory.
Here's an example of the output of this command:
Dump file /u1092/oracle/admin/TTTT/udump/ora_9965.trc
Oracle7 Server Release 7.1.4.1.1 - Production Release
With the distributed option
PL/SQL Release 2.1.4.0.0 - Production
ORACLE_HOME = /u1092/oracle/product/v714
ORACLE_SID = TTTT
Oracle process number: 6 Unix process id: 9965 System name: OSF1 Node name: tyger Release: V3.2 Version: 17 Machine: alpha
Wed Jul 10 11:36:48 1996
Wed Jul 10 11:36:48 1996
connect internal; shutdown; exit;
5. Copy all datafiles and redo log files identified in the backup
controlfile to the new location where the new databases files are to reside. Note that you should change the names of the files to reflect the new name of the database.
For example, if cloning a PROD database to be called PREP:
cp /u0032/oradata/PROD/dbsPRODs1.dbf /u0023/oradata/PREP/dbsPREPs1.dbf
6. Create a new SID directory for the new database under the $ORACLE_HOME/admin
directory. Create the pfile, udump, cdump, bdump directories as well. Copy the database's initSID.ora and confSID.ora from it's pfile directory to the new database's pfile directory. Change the following parameters:
db_name = new SID Change the name in control_files = ( ..... ) line to reflect new names. make sure the permissions on the initSID.ora are set correctly. if the above parameters are in a configSID.ora, make the changes there, and make sure the permissions on this file are set correctly. link the new initSID.ora to the $ORACLE_HOME/product/v716/dbs directory.
7. Modify the backup controlfile you created in step 3 as follows:
Remove all trace comments and information. Remove the reuse command Remove the NORESETLOGS Change the name of the SID to the new SID name with the SET DATABASE Remove the recover command Add the resetlogs command Modify the alter database open command to include resetlogs. Change all pathnames of data and redo log files to the new location. save the file as an sql command (create_clone_db.sql) Here's what the trace file should be modified to:
STARTUP NOMOUNT
CREATE CONTROLFILE
SET DATABASE NEWSID NOARCHIVELOG
MAXLOGFILES 255 MAXLOGMEMBERS 5 MAXDATAFILES 1022 MAXINSTANCES 1 MAXLOGHISTORY 100 LOGFILE GROUP 1 (
'/u1111/oradata/logNEWSID1a.dbf',
'/u1111/oradata/logNEWSID1b.dbf'
) SIZE 3M, GROUP 2 (
'/u1111/oradata/logNEWSID2a.dbf',
'/u1111/oradata/logNEWSID2b.dbf'
) SIZE 3M, GROUP 3 (
'/u1111/oradata/logNEWSID3a.dbf',
'/u1111/oradata/logNEWSID3b.dbf'
) SIZE 3M
'/u1111/oradata/dbsNEWSIDs1.dbf' SIZE 300M, '/u1111/oradata/dbsNEWSIDt1.dbf' SIZE 75M, '/u1111/oradata/dbsNEWSIDd1.dbf' SIZE 190M;
connect internal; @create_clone_db
If all has gone well, the statement will be processesd.
connect internal; shutdown; exit;
9. Reset your oracle_sid to the original SID and start that database.
This is to assure that the two databases are distinct. From within SVRMGRL:
connect internal; startup mount; alter database open resetlogs; exit;
additional control files, modify initSID.ora parameters, backup etc ...
Joe
Joe LaCascio
Oracle DBA, Unix Administrator
Wheaton College, MA 508.286.3405
On Tue, 7 May 2002, Ramon E. Estevez wrote:
> I have to refresh a development database every day with the production DB. > The size of the DB is 70GB and import last like 7 hours. Does anyone in the > list has the steps to clone a database, not using import. > > TIA > > Ramon E. Estevez >
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Joe LaCascio INET: jlacasci_at_wheatonma.edu Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue May 07 2002 - 15:56:37 CDT