Professional Documents
Culture Documents
1-8
Cloning an ORACLE Database
Table of Contents
Cloning an Oracle Database
................................................................................................
1
Table of Contents.............................................................................................................2
1. Purpose of the document..............................................................................................3
2. Document Usage..........................................................................................................3
3. Overview of the Procedure..........................................................................................3
3.1 Introduction............................................................................................................3
3.2 Environments.........................................................................................................4
3.3 Assumption............................................................................................................4
3.4 Cloning Process.....................................................................................................4
3.4.1 Steps to be followed in Primary database:..........................................................4
3.4.2 Steps to be followed in the Secondary database server:.....................................5
5. Conclusion...................................................................................................................8
2-8
Cloning an ORACLE Database
Overview
Environments
Assumptions
Cloning process
2. Document Usage
This document can be useful for any Oracle DBA for cloning an Oracle database. Generally
cloning databases with the help of source database hot backup is a standard process to
effectively and efficiently create a replica of the source database. The process illustrated in this
document can be used by any DBA who wants to create a replica of an Oracle database with the
help of hot backup and the associated archive logs.
Cloning database is one of the routine DBA activities. Any DBA who administers various
environments and is supporting the application development team for database activities has to
periodically synchronize the acceptance/testing/development with the Production data.
This frequency of synchronization depends upon the business and application development
teams requirements. Generally this process can be done with the below mentioned procedures
1) EXPORT/IMPORT utilities
2) DATA PUMP
3) Cold Backup Restoration
4) Hot Backup Recovery
Each of the above mentioned process has got its own pros and cons. To state a few vital reasons
why Hot backup recovery process is chosen widely
3-8
Cloning an ORACLE Database
3.2 Environments
3.3 Assumption
4-8
Cloning an ORACLE Database
Where SID is the instance name given above in the edited pfile
3) In the control file trace Use the “SET #2. RESTLOGS case” CREATE CONTROLFILE
section (Since we don’t use the primary database redolog files, we use this option). In that
section Copy from “CREATE CONTROLFILE” to “CHARACTER SET <value>” to another file.
Save the file as cr_control.sql
5-8
Cloning an ORACLE Database
4) Move the ftp ed Hot backup DATAFILE from temporary location of specific location as
specified in the control file cr_control.sql
5) Move the archived logs from temporary location to the location specified in log_archive_dest
in pfile
6) If Windows,
Create an oracle service using ORADIM utility
ORADIM -NEW -SID sid | -SRVC service [-INTPWD password] [-MAXUSERS number]
[-STARTMODE a|m] [-PFILE file] [-TIMEOUT secs]
SET ORACLE_SID=<NEW_SID>
Sqlplus “/ as sysdba”
7) If UNIX,
In the $ prompt give
EXPORT ORACLE_SID=<new_sid>
Sqlplus “/ as sysdba”
STARTUP NOMOUNT
If Windows
@<path>/cr_control.sql
If Unix
@<path>\cr_control.sql if in Unix
6-8
Cloning an ORACLE Database
9) Recover the database using backup control file. In the SQL> prompt give
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
Note: this can also be done with UNTIL TIME or UNTIL SCN provided you know the time or the SCN until which you
want to perform the recovery
10) The recovery process will keep prompting for archive logs. Give return for each prompt of
archive log.
Since the required archive logs from Primary database are restored in archive_log_dest of
secondary, it will get applied for every return you give in the prompt.
Once the recovery process prompts for the archive log with the LSN number noted in
the Primary database, in step 2) of Steps to be done in Primary database section
Database opened.
SHUTDOWN IMMEDIATE;
STARTUP;
16) Compare the users, objects, size with the Primary database
17) Take a complete cold back up and maintain that as generation 0 backup.
You have cloned the database.
7-8
Cloning an ORACLE Database
5. Conclusion
Hot backup recovery is one of the best methods to clone database because there is no
outage or down time required in the primary database and data is replicated in secondary
database to the most recent time period.
8-8