SlideShare a Scribd company logo
RMAN Database Cloning Process
For the sake of clarity, this document will refer to the database being cloned as the target
(source), and the cloning target will be referred to as the auxiliary (target).
Same Server
Ensure that there is enough space in the database filesystems for a cloned copy of the
database.
1. Create new locations for the target datafiles to ensure that the current datafiles are
not overwritten.
2. Create a new init.ora file for the cloned database. Use a copy of the current
init.ora parameter file and change DB_NAME. CONTROL_FILES, and other
destinations for the cloned database. Ensure that the database’s initialization
parameter remote_login_passwordfile is set to EXCLUSIVE or SHARED.
3. Create an Oracle password file for the auxiliary database with the orapwd
command and modify the listener.ora and tnsnames.ora files to create a new
listener and connect string for the cloned database.
4. Connect to the target database and execute “alter database backup controlfile to
trace resetlogs;”.
5. Execute the following query:
select 'set newname for datafile '||file_id||' to '||''''||
file_name||''''||';'
from dba_data_files
order by file_id;
The results:
set newname for datafile 1 to '/u04/oradata/oemtest/system01.dbf';
set newname for datafile 2 to '/u02/oradata/oemtest/undotbs01.dbf';
set newname for datafile 3 to '/u04/oradata/oemtest/sysaux01.dbf';
set newname for datafile 4 to '/u01/oradata/oemtest/undotbs01.dbf';
set newname for datafile 5 to '/u01/oradata/oemtest/data01.dbf';
set newname for datafile 6 to '/u02/oradata/oemtest/data02.dbf';
set newname for datafile 7 to '/u03/oradata/oemtest/data03.dbf';
set newname for datafile 8 to '/u04/oradata/oemtest/data04.dbf';
set newname for datafile 9 to '/u01/oradata/oemtest/index01.dbf';
set newname for datafile 10 to '/u02/oradata/oemtest/index02.dbf';
set newname for datafile 11 to '/u03/oradata/oemtest/index03.dbf';
set newname for datafile 12 to '/u04/oradata/oemtest/index04.dbf';
Copy these results to a text editor session.
6. Go to the udump location and open the latest trace file. Copy the entire logfile
clause to the same text editor session where you put the query results from the last
step. The logfile section will look like this:
LOGFILE
GROUP 1 (
'/u01/oradata/oemclone/redo01.log',
'/u04/oradata/oemclone/redo02.log'
) SIZE 100M,
GROUP 2 (
'/u02/oradata/oemclone/redo03.log',
'/u03/oradata/oemclone/redo04.log'
) SIZE 100M,
GROUP 3 (
'/u03/oradata/oemclone/redo05.log',
'/u02/oradata/oemclone/redo06.log'
) SIZE 100M,
GROUP 4 (
'/u04/oradata/oemclone/redo07.log',
'/u01/oradata/oemclone/redo08.log'
) SIZE 100M
7. Edit the information in the text editor session so that the paths for the new data
and logfiles are correct and the result looks like this (pay attention to the areas in
bold text):
run
{
set newname for datafile 1 to '/u04/oradata/oemclone/system01.dbf';
set newname for datafile 2 to '/u02/oradata/oemclone/undotbs01.dbf';
set newname for datafile 3 to '/u04/oradata/oemclone/sysaux01.dbf';
set newname for datafile 4 to '/u01/oradata/oemclone/undotbs01.dbf';
set newname for datafile 5 to '/u01/oradata/oemclone/data01.dbf';
set newname for datafile 6 to '/u02/oradata/oemclone/data02.dbf';
set newname for datafile 7 to '/u03/oradata/oemclone/data03.dbf';
set newname for datafile 8 to '/u04/oradata/oemclone/data04.dbf';
set newname for datafile 9 to '/u01/oradata/oemclone/index01.dbf';
set newname for datafile 10 to '/u02/oradata/oemclone/index02.dbf';
set newname for datafile 11 to '/u03/oradata/oemclone/index03.dbf';
set newname for datafile 12 to '/u04/oradata/oemclone/index04.dbf';
duplicate target database to <cloned DB sid>
LOGFILE
GROUP 1 (
'/u01/oradata/oemclone/redo01.log',
'/u04/oradata/oemclone/redo02.log'
) SIZE 100M,
GROUP 2 (
'/u02/oradata/oemclone/redo03.log',
'/u03/oradata/oemclone/redo04.log'
) SIZE 100M,
GROUP 3 (
'/u03/oradata/oemclone/redo05.log',
'/u02/oradata/oemclone/redo06.log'
) SIZE 100M,
GROUP 4 (
'/u04/oradata/oemclone/redo07.log',
'/u01/oradata/oemclone/redo08.log'
) SIZE 100M;
}
8. Set the ORACLE_SID environment variable to the cloned database SID and start
an SQL*Plus session.
9. Start the cloned instance in nomount mode.
startup nomount pfile=$ORACLE_HOME/dbs/init<sid>.ora
10. Start an RMAN session and execute the following commands:
a. Connect target sys/<password>@<current DB>
b. Connect rcvcat rcvcat/rcvcat@OEMPROD
c. Connect auxiliary /
11. Copy and paste the duplicate command from the text editor into the RMAN
session. If there are too many lines (datafiles), you can create a Unix shell script
with the following format:
#!/bin/ksh
#rman_archivelog_backup.ksh
. $HOME/.profile
rman <<!
connect target /;
sys/<password>@<auxiliary>
<put cloning commands here>
!
13. Once the process is complete, the new cloned database is ready to use.
Different Servers (Refresh)
1. The Tivoli backup software and IBM Data Protection for Oracle needs to be
installed and configured on the auxiliary server. See the “RMAN – Tivoli
configuration.doc” document for the steps to accomplish this. Perform steps 1
through 6 only.
2. On the auxiliary server, edit the /usr/tivoli/tsm/client/oracle/bin64/tdpo.opt file
and change the value of TDPO_NODE to the name of the server where the
target database will be cloned from.
3. Ask the Tivoli admin to create a password file on the auxiliary server based on
the change to the tdpo.opt file in the last step.
4. Create the necessary link on the auxiliary server by performing step 9 of the
“RMAN – Tivoli configuration.doc” document.
5. Ensure that the auxiliary server has enough space in the database filesystems
for a copy of the target database. You can run the following query to find out
how much space is allocated in the source database:
select to_char(sum(a.bytes + b.bytes + nvl(c.bytes,0)),
'999,999,999,999,999,990') "DB Total Size (Bytes)"
from (select sum(bytes) bytes
from dba_data_files) a,
(select (sum(bytes*members)) bytes
from v$log) b,
(select sum(bytes) bytes
from v$tempfile) c;
6. On the auxiliary server, create locations for the target datafiles if they do not
already exist. Note – If the datafile names and locations are to be identical
between the two servers, you MUST use the NOFILENAMECHECK
option of the database duplicate command. See the command is step 12
for details.
7. On the auxiliary server, create a new init.ora file for the cloned database. Use
a copy of the target init.ora parameter file and change the CONTROL_FILES
location (if necessary), and other destinations for the new database. LEAVE
THE DB_NAME PARAMETER UNCHANGED. Ensure that the parameter
remote_login_passwordfile is set to EXCLUSIVE.
8. On the auxiliary server, create an Oracle password file for the new database
with the orapwd command (i.e orapwd file=orapw<SID>
password=<password> )
9. On the auxiliary server, modify the listener.ora and tnsnames.ora files to
create a new listener and connect string for the new database.
10. On the target server, connect to the current database and execute “alter
database backup controlfile to trace resetlogs;”.
11. Execute the following query:
select 'set newname for datafile '||file_id||' to '||''''||
file_name||''''||';'
from dba_data_files
order by file_id;
The results:
set newname for datafile 1 to '/u04/oradata/oemtest/system01.dbf';
set newname for datafile 2 to '/u02/oradata/oemtest/undotbs01.dbf';
set newname for datafile 3 to '/u04/oradata/oemtest/sysaux01.dbf';
set newname for datafile 4 to '/u01/oradata/oemtest/undotbs01.dbf';
set newname for datafile 5 to '/u01/oradata/oemtest/data01.dbf';
set newname for datafile 6 to '/u02/oradata/oemtest/data02.dbf';
set newname for datafile 7 to '/u03/oradata/oemtest/data03.dbf';
set newname for datafile 8 to '/u04/oradata/oemtest/data04.dbf';
set newname for datafile 9 to '/u01/oradata/oemtest/index01.dbf';
set newname for datafile 10 to '/u02/oradata/oemtest/index02.dbf';
set newname for datafile 11 to '/u03/oradata/oemtest/index03.dbf';
set newname for datafile 12 to '/u04/oradata/oemtest/index04.dbf';
Copy these results to a text editor session.
12. Go to the udump location and open the latest trace file (the last file after an ‘ls
–lart’ command). Copy the entire logfile clause to the same text editor session
where you put the query results from the last step. The logfile section will
look like this:
LOGFILE
GROUP 1 (
'/u01/oradata/oemclone/redo01.log',
'/u04/oradata/oemclone/redo02.log'
) SIZE 100M,
GROUP 2 (
'/u02/oradata/oemclone/redo03.log',
'/u03/oradata/oemclone/redo04.log'
) SIZE 100M,
GROUP 3 (
'/u03/oradata/oemclone/redo05.log',
'/u02/oradata/oemclone/redo06.log'
) SIZE 100M,
GROUP 4 (
'/u04/oradata/oemclone/redo07.log',
'/u01/oradata/oemclone/redo08.log'
) SIZE 100M
13. Edit the information in a text editor session so that the paths for the new data
and logfiles are correct and the result looks like this (pay attention to the areas
in bold text):
run
{
set newname for datafile 1 to '/u04/oradata/oemclone/system01.dbf';
set newname for datafile 2 to '/u02/oradata/oemclone/undotbs01.dbf';
set newname for datafile 3 to '/u04/oradata/oemclone/sysaux01.dbf';
set newname for datafile 4 to '/u01/oradata/oemclone/undotbs01.dbf';
set newname for datafile 5 to '/u01/oradata/oemclone/data01.dbf';
set newname for datafile 6 to '/u02/oradata/oemclone/data02.dbf';
set newname for datafile 7 to '/u03/oradata/oemclone/data03.dbf';
set newname for datafile 8 to '/u04/oradata/oemclone/data04.dbf';
set newname for datafile 9 to '/u01/oradata/oemclone/index01.dbf';
set newname for datafile 10 to '/u02/oradata/oemclone/index02.dbf';
set newname for datafile 11 to '/u03/oradata/oemclone/index03.dbf';
set newname for datafile 12 to '/u04/oradata/oemclone/index04.dbf';
duplicate target database to <target DB sid>
nofilenamecheck (Only necessary if datafile names &locations are identical between servers)
LOGFILE
GROUP 1 (
'/u01/oradata/oemclone/redo01.log',
'/u04/oradata/oemclone/redo02.log'
) SIZE 100M,
GROUP 2 (
'/u02/oradata/oemclone/redo03.log',
'/u03/oradata/oemclone/redo04.log'
) SIZE 100M,
GROUP 3 (
'/u03/oradata/oemclone/redo05.log',
'/u02/oradata/oemclone/redo06.log'
) SIZE 100M,
GROUP 4 (
'/u04/oradata/oemclone/redo07.log',
'/u01/oradata/oemclone/redo08.log'
) SIZE 100M;
}
14. On the auxiliary server, set the ORACLE_SID environment variable to the
new database SID and start an SQL*Plus session.
15. On the auxiliary server, start the new instance in nomount mode with the
following command:
startup nomount pfile=$ORACLE_HOME/dbs/init<sid>.ora
16. On the target server, add a connect string to the
$ORACLE_HOME/network/admin/tnsnames.ora file to connect to the
auxiliary instance. The name of the connect string can be anything you loke,
but the name of the auxiliary SID will be the same name of the target SID.
17. On the target server, start an RMAN session and execute the following
commands:
a. connect target /
b. connect auxiliary sys/<password>@<connect_string>
18. Copy and paste the duplicate command from the text editor into the RMAN
session. If there are too many lines (datafiles), you can create a Unix shell
script with the following format:
#!/bin/ksh
#rman_archivelog_backup.ksh
. $HOME/.profile
rman <<!
connect target /;
sys/<password>@<auxiliary>
<put cloning commands here>
!
…Or you can save the duplicate commands in a .sql file and execute it from the RMAN>
prompt as you would from an SQL*Plus session using the @ sign (i.e.
@rman_clone_commands.sql)
19. Once the process is complete, the new cloned database is ready to use.
However, if you want to change the name of the cloned database, you need to
go through the process of creating a new control file with the following steps:
a. Start an SQL*Plus session and execute the command “alter database
backup controlfile to trace resetlogs;”
b. Execute “show parameter user_dump_dest” to find the location of the
trace file you just created.
c. Shutdown the database and exit the SQL*Plus session.
d. Modify the init.ora file to reflect the new name of the database. Examine
the names and locations of the control, log, and dump files. You may
need to create new locations. Create a new password file if necessary with
the orapwd command.
e. Go to the user_dump_dest location and open the latest trace file (the last
file after an ‘ls –lart’ command). Edit the file so that it appears like this
(pay special attention to the areas in bold text and ensure they are correct):
STARTUP NOMOUNT PFILE=/oracle/product/9.2.0/dbs/initoemclone.ora
CREATE CONTROLFILE SET DATABASE "OEMPROD" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 255
MAXINSTANCES 8
MAXLOGHISTORY 454
LOGFILE
GROUP 1 (
'/u01/oradata/oemprod/redo01.log',
'/u04/oradata/oemprod/redo02.log'
) SIZE 100M,
GROUP 2 (
'/u02/oradata/oemprod/redo03.log',
'/u03/oradata/oemprod/redo04.log'
) SIZE 100M,
GROUP 3 (
'/u03/oradata/oemprod/redo05.log',
'/u02/oradata/oemprod/redo06.log'
) SIZE 100M,
GROUP 4 (
'/u04/oradata/oemprod/redo07.log',
'/u01/oradata/oemprod/redo08.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/u04/oradata/oemprod/system01.dbf',
'/u01/oradata/oemprod/undotbs01.dbf',
'/u03/oradata/oemprod/sysaux01.dbf',
'/u01/oradata/oemprod/data01.dbf',
'/u02/oradata/oemprod/data02.dbf',
'/u03/oradata/oemprod/data03.dbf',
'/u04/oradata/oemprod/data04.dbf',
'/u01/oradata/oemprod/index01.dbf',
'/u02/oradata/oemprod/index02.dbf',
'/u03/oradata/oemprod/index03.dbf',
'/u04/oradata/oemprod/index04.dbf',
'/u02/oradata/oemprod/undotbs02.dbf',
'/u02/oradata/oemprod/tools01.dbf'
CHARACTER SET AL32UTF8
;
--RECOVER DATABASE USING BACKUP CONTROLFILE
--ALTER DATABASE OPEN RESETLOGS;
Save the file as an SQL script.
f. Change the ORACLE_SID environment variable to reflect the name
change.
g. Start an SQL*Plus session
h. Execute the SQL script create in step e.
i. When the message “Controlfile created” appears, execute “alter database
open resetlogs;”. When the message “Database altered” appears, the
change is complete.
j. If this is a new production database, go through the steps to register and
back it up with RMAN.

More Related Content

PPTX
Cloning Oracle EBS R12: A Step by Step Procedure
DOCX
Rman cloning when both directory and db name are same.
DOCX
Creating a physical standby database 11g on windows
PDF
Oracle applications 11i hot backup cloning with rapid clone
DOC
Oracle applications 11i hot backup cloning with rapid clone
TXT
oracle dba
PDF
Step by Step Restore rman to different host
DOCX
Content server installation guide
Cloning Oracle EBS R12: A Step by Step Procedure
Rman cloning when both directory and db name are same.
Creating a physical standby database 11g on windows
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
oracle dba
Step by Step Restore rman to different host
Content server installation guide

What's hot (16)

DOCX
Physical_Standby_Database_R12.2.4
PPTX
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
PPT
2011 384 hackworth_ppt
PDF
FIXING BLOCK CORRUPTION (RMAN) on 11G
 
PDF
Basic - Oracle Edition Based Redefinition Presentation
 
DOC
Rac nonrac clone
PDF
Backup andrecoverychecklist
TXT
Scripts related to temp tablespace
PPT
Les 10 Tune Rman
PDF
Maa wp-10g-racprimaryracphysicalsta-131940
PDF
How to create a non managed standby database
DOCX
Change DB Name
PPTX
Reduce Resource Consumption & Clone in Seconds your Oracle Virtual Environmen...
DOCX
Dbm 438 Enthusiastic Study / snaptutorial.com
DOCX
Backup and Restore of database on 2-Node RAC
PDF
Beginbackup
Physical_Standby_Database_R12.2.4
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
2011 384 hackworth_ppt
FIXING BLOCK CORRUPTION (RMAN) on 11G
 
Basic - Oracle Edition Based Redefinition Presentation
 
Rac nonrac clone
Backup andrecoverychecklist
Scripts related to temp tablespace
Les 10 Tune Rman
Maa wp-10g-racprimaryracphysicalsta-131940
How to create a non managed standby database
Change DB Name
Reduce Resource Consumption & Clone in Seconds your Oracle Virtual Environmen...
Dbm 438 Enthusiastic Study / snaptutorial.com
Backup and Restore of database on 2-Node RAC
Beginbackup
Ad

Viewers also liked (15)

PPT
Less06 users
PPTX
Index Reorganization and Rebuilding for Success
PPTX
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
PPT
Les 06 Perform Rec
PPT
Les 07 Rman Rec
PPT
Top 10 Oracle SQL tuning tips
PPT
Les 11 Fb Queries
PDF
RMAN – The Pocket Knife of a DBA
PPT
Les 08 Dupe Db
PPT
Less03 D B D B C A
PPT
Les 09 Tspitr
PPT
Les 20 dup_db
PDF
Rman Presentation
PDF
RMAN best practices for RAC
PPT
Oracle Sql Tuning
Less06 users
Index Reorganization and Rebuilding for Success
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Les 06 Perform Rec
Les 07 Rman Rec
Top 10 Oracle SQL tuning tips
Les 11 Fb Queries
RMAN – The Pocket Knife of a DBA
Les 08 Dupe Db
Less03 D B D B C A
Les 09 Tspitr
Les 20 dup_db
Rman Presentation
RMAN best practices for RAC
Oracle Sql Tuning
Ad

Similar to Rman cloning guide (20)

PDF
Createclone
DOCX
Migrate from database file system to asm
DOCX
Cloning database using srdf copy
PPT
15362590.ppt
DOCX
Moving 12c database from NON-ASM to ASM
DOC
Rman duplicate-database-on-the-same-host1
DOCX
12c database migration from ASM storage to NON-ASM storage
PDF
Rman workshop short
DOC
br_test_lossof-datafile_10g.doc
PDF
Oracle 12c New Features_RMAN_slides
PDF
gDBClone - Database Clone “onecommand Automation Tool”
PDF
Oracle Database Backup Cloud Service
PDF
6048618 cloning-procedure-of-r12-single-tier
PPT
4714649_2.ppt
PPT
4714649.ppt
PPT
Backup and Recovery Implementation
PPT
Dueling duplications RMAN vs Delphix
PDF
Clone database using_active_duplicate
PPTX
OakTable World Sep14 clonedb
PPT
Oracle backup and recovery
Createclone
Migrate from database file system to asm
Cloning database using srdf copy
15362590.ppt
Moving 12c database from NON-ASM to ASM
Rman duplicate-database-on-the-same-host1
12c database migration from ASM storage to NON-ASM storage
Rman workshop short
br_test_lossof-datafile_10g.doc
Oracle 12c New Features_RMAN_slides
gDBClone - Database Clone “onecommand Automation Tool”
Oracle Database Backup Cloud Service
6048618 cloning-procedure-of-r12-single-tier
4714649_2.ppt
4714649.ppt
Backup and Recovery Implementation
Dueling duplications RMAN vs Delphix
Clone database using_active_duplicate
OakTable World Sep14 clonedb
Oracle backup and recovery

Recently uploaded (20)

PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
Internet___Basics___Styled_ presentation
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
Introduction to the IoT system, how the IoT system works
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
DOCX
Unit-3 cyber security network security of internet system
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
t_and_OpenAI_Combined_two_pressentations
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
Mathew Digital SEO Checklist Guidlines 2025
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPTX
Database Information System - Management Information System
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
newyork.pptxirantrafgshenepalchinachinane
PPTX
Funds Management Learning Material for Beg
Exploring VPS Hosting Trends for SMBs in 2025
Internet___Basics___Styled_ presentation
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Introduction to the IoT system, how the IoT system works
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Unit-3 cyber security network security of internet system
Power Point - Lesson 3_2.pptx grad school presentation
t_and_OpenAI_Combined_two_pressentations
The New Creative Director: How AI Tools for Social Media Content Creation Are...
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Mathew Digital SEO Checklist Guidlines 2025
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Database Information System - Management Information System
Unit-1 introduction to cyber security discuss about how to secure a system
SASE Traffic Flow - ZTNA Connector-1.pdf
newyork.pptxirantrafgshenepalchinachinane
Funds Management Learning Material for Beg

Rman cloning guide

  • 1. RMAN Database Cloning Process For the sake of clarity, this document will refer to the database being cloned as the target (source), and the cloning target will be referred to as the auxiliary (target). Same Server Ensure that there is enough space in the database filesystems for a cloned copy of the database. 1. Create new locations for the target datafiles to ensure that the current datafiles are not overwritten. 2. Create a new init.ora file for the cloned database. Use a copy of the current init.ora parameter file and change DB_NAME. CONTROL_FILES, and other destinations for the cloned database. Ensure that the database’s initialization parameter remote_login_passwordfile is set to EXCLUSIVE or SHARED. 3. Create an Oracle password file for the auxiliary database with the orapwd command and modify the listener.ora and tnsnames.ora files to create a new listener and connect string for the cloned database. 4. Connect to the target database and execute “alter database backup controlfile to trace resetlogs;”. 5. Execute the following query: select 'set newname for datafile '||file_id||' to '||''''|| file_name||''''||';' from dba_data_files order by file_id; The results: set newname for datafile 1 to '/u04/oradata/oemtest/system01.dbf'; set newname for datafile 2 to '/u02/oradata/oemtest/undotbs01.dbf'; set newname for datafile 3 to '/u04/oradata/oemtest/sysaux01.dbf'; set newname for datafile 4 to '/u01/oradata/oemtest/undotbs01.dbf'; set newname for datafile 5 to '/u01/oradata/oemtest/data01.dbf'; set newname for datafile 6 to '/u02/oradata/oemtest/data02.dbf'; set newname for datafile 7 to '/u03/oradata/oemtest/data03.dbf'; set newname for datafile 8 to '/u04/oradata/oemtest/data04.dbf'; set newname for datafile 9 to '/u01/oradata/oemtest/index01.dbf'; set newname for datafile 10 to '/u02/oradata/oemtest/index02.dbf'; set newname for datafile 11 to '/u03/oradata/oemtest/index03.dbf'; set newname for datafile 12 to '/u04/oradata/oemtest/index04.dbf'; Copy these results to a text editor session. 6. Go to the udump location and open the latest trace file. Copy the entire logfile clause to the same text editor session where you put the query results from the last step. The logfile section will look like this:
  • 2. LOGFILE GROUP 1 ( '/u01/oradata/oemclone/redo01.log', '/u04/oradata/oemclone/redo02.log' ) SIZE 100M, GROUP 2 ( '/u02/oradata/oemclone/redo03.log', '/u03/oradata/oemclone/redo04.log' ) SIZE 100M, GROUP 3 ( '/u03/oradata/oemclone/redo05.log', '/u02/oradata/oemclone/redo06.log' ) SIZE 100M, GROUP 4 ( '/u04/oradata/oemclone/redo07.log', '/u01/oradata/oemclone/redo08.log' ) SIZE 100M 7. Edit the information in the text editor session so that the paths for the new data and logfiles are correct and the result looks like this (pay attention to the areas in bold text): run { set newname for datafile 1 to '/u04/oradata/oemclone/system01.dbf'; set newname for datafile 2 to '/u02/oradata/oemclone/undotbs01.dbf'; set newname for datafile 3 to '/u04/oradata/oemclone/sysaux01.dbf'; set newname for datafile 4 to '/u01/oradata/oemclone/undotbs01.dbf'; set newname for datafile 5 to '/u01/oradata/oemclone/data01.dbf'; set newname for datafile 6 to '/u02/oradata/oemclone/data02.dbf'; set newname for datafile 7 to '/u03/oradata/oemclone/data03.dbf'; set newname for datafile 8 to '/u04/oradata/oemclone/data04.dbf'; set newname for datafile 9 to '/u01/oradata/oemclone/index01.dbf'; set newname for datafile 10 to '/u02/oradata/oemclone/index02.dbf'; set newname for datafile 11 to '/u03/oradata/oemclone/index03.dbf'; set newname for datafile 12 to '/u04/oradata/oemclone/index04.dbf'; duplicate target database to <cloned DB sid> LOGFILE GROUP 1 ( '/u01/oradata/oemclone/redo01.log', '/u04/oradata/oemclone/redo02.log' ) SIZE 100M, GROUP 2 ( '/u02/oradata/oemclone/redo03.log', '/u03/oradata/oemclone/redo04.log' ) SIZE 100M,
  • 3. GROUP 3 ( '/u03/oradata/oemclone/redo05.log', '/u02/oradata/oemclone/redo06.log' ) SIZE 100M, GROUP 4 ( '/u04/oradata/oemclone/redo07.log', '/u01/oradata/oemclone/redo08.log' ) SIZE 100M; } 8. Set the ORACLE_SID environment variable to the cloned database SID and start an SQL*Plus session. 9. Start the cloned instance in nomount mode. startup nomount pfile=$ORACLE_HOME/dbs/init<sid>.ora 10. Start an RMAN session and execute the following commands: a. Connect target sys/<password>@<current DB> b. Connect rcvcat rcvcat/rcvcat@OEMPROD c. Connect auxiliary / 11. Copy and paste the duplicate command from the text editor into the RMAN session. If there are too many lines (datafiles), you can create a Unix shell script with the following format: #!/bin/ksh #rman_archivelog_backup.ksh . $HOME/.profile rman <<! connect target /; sys/<password>@<auxiliary> <put cloning commands here> ! 13. Once the process is complete, the new cloned database is ready to use. Different Servers (Refresh) 1. The Tivoli backup software and IBM Data Protection for Oracle needs to be installed and configured on the auxiliary server. See the “RMAN – Tivoli configuration.doc” document for the steps to accomplish this. Perform steps 1 through 6 only.
  • 4. 2. On the auxiliary server, edit the /usr/tivoli/tsm/client/oracle/bin64/tdpo.opt file and change the value of TDPO_NODE to the name of the server where the target database will be cloned from. 3. Ask the Tivoli admin to create a password file on the auxiliary server based on the change to the tdpo.opt file in the last step. 4. Create the necessary link on the auxiliary server by performing step 9 of the “RMAN – Tivoli configuration.doc” document. 5. Ensure that the auxiliary server has enough space in the database filesystems for a copy of the target database. You can run the following query to find out how much space is allocated in the source database: select to_char(sum(a.bytes + b.bytes + nvl(c.bytes,0)), '999,999,999,999,999,990') "DB Total Size (Bytes)" from (select sum(bytes) bytes from dba_data_files) a, (select (sum(bytes*members)) bytes from v$log) b, (select sum(bytes) bytes from v$tempfile) c; 6. On the auxiliary server, create locations for the target datafiles if they do not already exist. Note – If the datafile names and locations are to be identical between the two servers, you MUST use the NOFILENAMECHECK option of the database duplicate command. See the command is step 12 for details. 7. On the auxiliary server, create a new init.ora file for the cloned database. Use a copy of the target init.ora parameter file and change the CONTROL_FILES location (if necessary), and other destinations for the new database. LEAVE THE DB_NAME PARAMETER UNCHANGED. Ensure that the parameter remote_login_passwordfile is set to EXCLUSIVE. 8. On the auxiliary server, create an Oracle password file for the new database with the orapwd command (i.e orapwd file=orapw<SID> password=<password> ) 9. On the auxiliary server, modify the listener.ora and tnsnames.ora files to create a new listener and connect string for the new database. 10. On the target server, connect to the current database and execute “alter database backup controlfile to trace resetlogs;”. 11. Execute the following query: select 'set newname for datafile '||file_id||' to '||''''|| file_name||''''||';' from dba_data_files order by file_id; The results: set newname for datafile 1 to '/u04/oradata/oemtest/system01.dbf'; set newname for datafile 2 to '/u02/oradata/oemtest/undotbs01.dbf';
  • 5. set newname for datafile 3 to '/u04/oradata/oemtest/sysaux01.dbf'; set newname for datafile 4 to '/u01/oradata/oemtest/undotbs01.dbf'; set newname for datafile 5 to '/u01/oradata/oemtest/data01.dbf'; set newname for datafile 6 to '/u02/oradata/oemtest/data02.dbf'; set newname for datafile 7 to '/u03/oradata/oemtest/data03.dbf'; set newname for datafile 8 to '/u04/oradata/oemtest/data04.dbf'; set newname for datafile 9 to '/u01/oradata/oemtest/index01.dbf'; set newname for datafile 10 to '/u02/oradata/oemtest/index02.dbf'; set newname for datafile 11 to '/u03/oradata/oemtest/index03.dbf'; set newname for datafile 12 to '/u04/oradata/oemtest/index04.dbf'; Copy these results to a text editor session. 12. Go to the udump location and open the latest trace file (the last file after an ‘ls –lart’ command). Copy the entire logfile clause to the same text editor session where you put the query results from the last step. The logfile section will look like this: LOGFILE GROUP 1 ( '/u01/oradata/oemclone/redo01.log', '/u04/oradata/oemclone/redo02.log' ) SIZE 100M, GROUP 2 ( '/u02/oradata/oemclone/redo03.log', '/u03/oradata/oemclone/redo04.log' ) SIZE 100M, GROUP 3 ( '/u03/oradata/oemclone/redo05.log', '/u02/oradata/oemclone/redo06.log' ) SIZE 100M, GROUP 4 ( '/u04/oradata/oemclone/redo07.log', '/u01/oradata/oemclone/redo08.log' ) SIZE 100M 13. Edit the information in a text editor session so that the paths for the new data and logfiles are correct and the result looks like this (pay attention to the areas in bold text): run { set newname for datafile 1 to '/u04/oradata/oemclone/system01.dbf'; set newname for datafile 2 to '/u02/oradata/oemclone/undotbs01.dbf'; set newname for datafile 3 to '/u04/oradata/oemclone/sysaux01.dbf'; set newname for datafile 4 to '/u01/oradata/oemclone/undotbs01.dbf';
  • 6. set newname for datafile 5 to '/u01/oradata/oemclone/data01.dbf'; set newname for datafile 6 to '/u02/oradata/oemclone/data02.dbf'; set newname for datafile 7 to '/u03/oradata/oemclone/data03.dbf'; set newname for datafile 8 to '/u04/oradata/oemclone/data04.dbf'; set newname for datafile 9 to '/u01/oradata/oemclone/index01.dbf'; set newname for datafile 10 to '/u02/oradata/oemclone/index02.dbf'; set newname for datafile 11 to '/u03/oradata/oemclone/index03.dbf'; set newname for datafile 12 to '/u04/oradata/oemclone/index04.dbf'; duplicate target database to <target DB sid> nofilenamecheck (Only necessary if datafile names &locations are identical between servers) LOGFILE GROUP 1 ( '/u01/oradata/oemclone/redo01.log', '/u04/oradata/oemclone/redo02.log' ) SIZE 100M, GROUP 2 ( '/u02/oradata/oemclone/redo03.log', '/u03/oradata/oemclone/redo04.log' ) SIZE 100M, GROUP 3 ( '/u03/oradata/oemclone/redo05.log', '/u02/oradata/oemclone/redo06.log' ) SIZE 100M, GROUP 4 ( '/u04/oradata/oemclone/redo07.log', '/u01/oradata/oemclone/redo08.log' ) SIZE 100M; } 14. On the auxiliary server, set the ORACLE_SID environment variable to the new database SID and start an SQL*Plus session. 15. On the auxiliary server, start the new instance in nomount mode with the following command: startup nomount pfile=$ORACLE_HOME/dbs/init<sid>.ora 16. On the target server, add a connect string to the $ORACLE_HOME/network/admin/tnsnames.ora file to connect to the auxiliary instance. The name of the connect string can be anything you loke, but the name of the auxiliary SID will be the same name of the target SID. 17. On the target server, start an RMAN session and execute the following commands: a. connect target / b. connect auxiliary sys/<password>@<connect_string>
  • 7. 18. Copy and paste the duplicate command from the text editor into the RMAN session. If there are too many lines (datafiles), you can create a Unix shell script with the following format: #!/bin/ksh #rman_archivelog_backup.ksh . $HOME/.profile rman <<! connect target /; sys/<password>@<auxiliary> <put cloning commands here> ! …Or you can save the duplicate commands in a .sql file and execute it from the RMAN> prompt as you would from an SQL*Plus session using the @ sign (i.e. @rman_clone_commands.sql) 19. Once the process is complete, the new cloned database is ready to use. However, if you want to change the name of the cloned database, you need to go through the process of creating a new control file with the following steps: a. Start an SQL*Plus session and execute the command “alter database backup controlfile to trace resetlogs;” b. Execute “show parameter user_dump_dest” to find the location of the trace file you just created. c. Shutdown the database and exit the SQL*Plus session. d. Modify the init.ora file to reflect the new name of the database. Examine the names and locations of the control, log, and dump files. You may need to create new locations. Create a new password file if necessary with the orapwd command. e. Go to the user_dump_dest location and open the latest trace file (the last file after an ‘ls –lart’ command). Edit the file so that it appears like this (pay special attention to the areas in bold text and ensure they are correct): STARTUP NOMOUNT PFILE=/oracle/product/9.2.0/dbs/initoemclone.ora CREATE CONTROLFILE SET DATABASE "OEMPROD" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 255 MAXINSTANCES 8 MAXLOGHISTORY 454 LOGFILE GROUP 1 (
  • 8. '/u01/oradata/oemprod/redo01.log', '/u04/oradata/oemprod/redo02.log' ) SIZE 100M, GROUP 2 ( '/u02/oradata/oemprod/redo03.log', '/u03/oradata/oemprod/redo04.log' ) SIZE 100M, GROUP 3 ( '/u03/oradata/oemprod/redo05.log', '/u02/oradata/oemprod/redo06.log' ) SIZE 100M, GROUP 4 ( '/u04/oradata/oemprod/redo07.log', '/u01/oradata/oemprod/redo08.log' ) SIZE 100M -- STANDBY LOGFILE DATAFILE '/u04/oradata/oemprod/system01.dbf', '/u01/oradata/oemprod/undotbs01.dbf', '/u03/oradata/oemprod/sysaux01.dbf', '/u01/oradata/oemprod/data01.dbf', '/u02/oradata/oemprod/data02.dbf', '/u03/oradata/oemprod/data03.dbf', '/u04/oradata/oemprod/data04.dbf', '/u01/oradata/oemprod/index01.dbf', '/u02/oradata/oemprod/index02.dbf', '/u03/oradata/oemprod/index03.dbf', '/u04/oradata/oemprod/index04.dbf', '/u02/oradata/oemprod/undotbs02.dbf', '/u02/oradata/oemprod/tools01.dbf' CHARACTER SET AL32UTF8 ; --RECOVER DATABASE USING BACKUP CONTROLFILE --ALTER DATABASE OPEN RESETLOGS; Save the file as an SQL script. f. Change the ORACLE_SID environment variable to reflect the name change. g. Start an SQL*Plus session h. Execute the SQL script create in step e. i. When the message “Controlfile created” appears, execute “alter database open resetlogs;”. When the message “Database altered” appears, the change is complete. j. If this is a new production database, go through the steps to register and back it up with RMAN.