0% found this document useful (0 votes)
25 views40 pages

Ask Tom - DB Cloning - What Is It and Why

Uploaded by

Help Desk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views40 pages

Ask Tom - DB Cloning - What Is It and Why

Uploaded by

Help Desk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Questions Resources Archives Links Popular Hot Files

Home > Question Details

Stanley -- Thanks for the question regarding "db cloning -- what is it and why", version 8.0.4
Submitted on 18-Aug-2000 2:10 Central time zone Tom's latest followup | Bookmark | Bottom
Last updated 28-Dec-2010 15:25

You Asked

What is Database cloning?


What are the procedures involved in cloning a database?
What are the advantages & uses?

and we said...

cloning is as it sounds -- making a copy of. It is basically taking a backup of an


instance and restoring it elsewhere. You've "cloned" the database.

Procedures are: backup, restore it elsewhere (typically on another machine in exactly


the same directory structure but you can restore it onto the same machine, you'll want to
change the sid and database name, see

http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:318216852435

for how to do that)

Advantages and uses -- people use it to test with mostly. You clone a production
instance onto a test machine to try out new things -- "what if I changed this init.ora
parameter", "what if my code did this instead" and so on...

Reviews

unable to clone July 19, 2002 - 2pm Central time zone Bookmark | Bottom | Top
Reviewer: Ravi Kumar from Chicago, IL USA

Hi Tom,

I am trying to clone one of my database and getting errors. I am on WIN2K and Oracle 8.1.7. I am
giving here the steps that I followed.

. On the source machine, I stopped the services.


. Zipped and copied d:\oracle\admin and d:\oracle\oradata folders to the target machine.
. Unzipped the files to c:\oracle\admin and c:\oracle\oradata folders. ( Oracle is installed in C
on target machine)
. I tried to start the service and I got this error.
ORA-27101 shared memory realm does not exist
. Later I realized the variation in C: and D: drives. So, I edited the init.ora file to replaced d:
with c: for control files and also dump files.
. After restarting my machine and try to connect, this time I am getting
ORA-01033: ORACLE initialization or shutdown in progress.
. I copied my original init.ora file (install version) to c:\oracle\admin\<SID>\pfile and still
getting the same error.

I have only one version of oracle installed and only one DB on both the machines.

In your previous answer I noticed you mentioning "exactly the same directory structure". Is that
what I am messing in this situation? If so, what should I do?

Please help.

Thanks,
Ravi.

Followup July 19, 2002 - 5pm Central time zone:

did you create a database on the other machine? have you read about oradim and how to use it to
register an instance on the other machine? I don't see that step in there. Refer to the NT admin

1 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

guide

http://download-west.oracle.com/docs/cd/A87860_01/doc/win.817/a73008/toc.htm

...

checked log files July 19, 2002 - 6pm Central time zone Bookmark | Bottom | Top
Reviewer: Ravi Kumar from Chicago, IL USA

Hi Tom,

On the target machine, as part of the installation, I created the database. Backedup the files. I
am able to start the database using those files.

I checked c:\oracle\ora817\database\oradim.log and it showed


ORA-01991: invalid password file 'C:\Oracle\Ora817\DATABASE\PWDeqed.ORA'

I copied the same file from source machine to the target machine. After restarting I checked the
same file and now it is showing
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: 'D:\ORACLE\ORADATA\<sid>\SYSTEM01.DBF'

It shows that it is still looking at d:\oracle\oradata\ folder where as I don't have D: drive but
only C:
Does it store the hardcoded paths somewhere?

Thanks,
Ravi.

Followup July 20, 2002 - 10am Central time zone:

erase the password file, create a new one using orapwd.

password file March 20, 2003 - 9am Central time zone Bookmark | Bottom | Top
Reviewer: abid dawood from pakistan

please tell me how i create passwrod file .


i have very difficulty in it . thanks. when i going to create database it give the error of
password file

Followup March 20, 2003 - 10am Central time zone:

orapwd

read about it in your OS admin guide.

database creation (oracle 9i) March 20, 2003 - 9am Central time zone Bookmark | Bottom | Top
Reviewer: abid dawood from pakistan

I am faceing problem in the creation of New database.


here i write the proper way of New database creation .and i request you to check my staps and make
correction in it .
First create forder on ":\kar_dba"
(1) copy parameter file in c:\kar_dba
(2) open copy of parameter file and write database name=pak and give names and path of control
files.
(3)startup oracle in nomount through pfile=c:\kar_dba\init.ora
(4) create database pak
datafile
'c:\kar_dba\ka_db1.dbf ' size 20m
logfile
group 1 'c:\kar_dba\ka_lo1.log' size 10m,
group 2 'c:\kar_dba\ka_lo2.log' size 10m;

(error) when i execute my database creation query .It create control files,log files and in the end
give me error that password file is not found. how i add password file .

Followup March 20, 2003 - 10am Central time zone:

2 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

step 1

read your OS admin guide

step 2

refer to question right above.

feedback requested March 30, 2003 - 6am Central time zone Bookmark | Bottom | Top
Reviewer: Saminathan Seerangan from CA,USA

Hi Tom,

I always find asktom to be the most useful source...

I went thru your document for cloning DB at

http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:318216852435

I'm getting the following error in (step # 12. Run the "ccf.sql" script )

My old DB name is SAMI


New DB name is CLONEDB

ORA-01503: CREATE CONTROLFILE failed


ORA-01161: database name SAMI in file header does not match given name of CLONEDB
ORA-01110: Data file 1: '/oracle/oradata/clonedb/system01.dbf'

Could you please help me to resolve this issue.

Followup March 30, 2003 - 8am Central time zone:

sounds like you skipped #7 or #10.

Sorry, overlooked step # 7 March 31, 2003 - 4am Central time zone Bookmark | Bottom | Top
Reviewer: Saminathan Seerangan from CA,USA

I have changed
a) "olddbname" to "newdbname"
b) "NORESETLOGS" to "RESETLOGS"

but did not change


c) REUSE DATABASE to SET DATABASE

It is working now, Thanks Tom

New Server Replication October 22, 2003 - 1pm Central time zone Bookmark | Bottom | Top
Reviewer: Denise from Virginia, USA

Tom

We are buying a new server that will be a mirror image


of the current Production Server.

question:
if we create the exact same directory structure and install
the exact same OS (Windows 2000 Server)...can we simply
restore, from the Production backup tapes, all the Oracle files to the new server. We would also
import a copied
version of the registry from the Production Server to the
new server.

appreciate any feedback and thanks for the links on


how to change a SID....very ambitious and challenging.

3 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Followup October 22, 2003 - 6pm Central time zone:

i would not suggest that - no.

the registry is a big old black box.

suggest you setup server, install oracle, use oradim to setup the registry (register the instance)
and restore from backup

October 22, 2003 - 6pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader

Tom,

If the same situation applies to Solaris 8.0, can i restore the file systems and relink oracle
without doing any installation??

Thanks

Followup October 22, 2003 - 7pm Central time zone:

pretty much.

hey -- that would mean maybe unix is easier then windows sometimes? say it ain't so

I've always thought the registry was MS's attempt at copy protection. remember in the early days
when you could just copy a directly and a .ini file and all would be well?

I HATED getting a new laptop when I ran windows. took me a week to get going again (now there is
an entire cottage industry built on migration of windows from one machine to another). Linux -- I
just sort of nfs mount,

tar cvf - . | ( cd /mount/point; tar xf - )

and i be done. sure, it looks obscure, but if you read man pages........

New Server Registry Installation October 23, 2003 - 8am Central time zone Bookmark | Bottom | Top
Reviewer: Denise from Virginia, USA

Thanks Tom....

for the feedback regarding the Registry import on a new


server installation.

I oftentimes wish we were using Unix or Linux.

I will look into the oradim command.

Clone a database March 24, 2004 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: Arun Gupta from Harrisburg, PA USA

Tom,
Is it possible to clone a database A running in archivelog mode as another database B which runs in
noarchivelog mode? We want to clone production database as pre-production test database on a weekly
basis. This will give us the same data volume as production for query tuning. The constraints are:
a) Production database cannot be shutdown.
b) The production database runs in archivelog mode whereas pre-production test database runs in
noarchivelog mode.
c) The cloning process has to be unattended, if possible.

We have Oracle 9ir2 and RMAN for backup.


Thanks.

Followup March 24, 2004 - 1pm Central time zone:

database b will initially be "archivelog" but then you'll shutdown -- change it and bring it
backup.

4 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

so, "yes" you can clone it cause you can very very easily change it.

April 28, 2004 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: Arun Gupta from Harrisburg, PA USA

Tom,
I am cloning database A as database B, both exactly identical, running in NOARCHIVELOG mode.
Database A will be shutdown before copying files. I am using the CREATE CONTROLFILE statement to
clone.
a) Do I need to copy redo log files from A to B if I need to open B with RESETLOGS option? My
understanding is that if I use RESETLOGS option in CREATE CONTROLFILE, the redo log files will be
created by Oracle as per the specifications given in the create controlfile statement.
b) Do I need to copy control files from A to B since I will be creating controlfile for B?
Thanks

Followup April 28, 2004 - 3pm Central time zone:

a) you do not need to, but it would not hurt and you could avoid having to open resetlogs if that
makes you feel better.

b) not if you are doing the create controlfile trick. You could just copy EVERYTHING, startup
mount, and issue a series of

alter database rename file 'old name' to 'new names';

and then alter database open (assuming logs are in the same place, else you'll drop and create
them).

relink oracle July 9, 2004 - 8am Central time zone Bookmark | Bottom | Top
Reviewer: Thiru

"restore the file systems and


relink oracle without doing any installation??"

a.I have a new sol server. What is the best way I can have the same oracle setup that is there on a
prodn db.?
b. How do I go about relinking oracle? Does this mean that there is no need to go through the steps
for oracle installation from a CD and just copy all the directories from the prodn. server?

Hope I am clear of what I am looking for.

Followup July 9, 2004 - 8am Central time zone:

a) install the same software? backup and restore would work as well.

b) see the admin guide for your OS for details on things like this. the installer will relink for
you as well.

clone db by rman August 6, 2004 - 5pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

I tried to create duplicate db by reading chapter 12 of Recovery manager user s guide (920).

Here is the name convention:


Target db: trg (host1) (In archive mode)
Catalog db: cat
Auxiliary db: aux (host2)

(1) create the same directory in host2 as in host1

(2) create rman backup file in trg.


rman target sys/he1@trg catalog rman/rman@cat
rman>register database;
rman>backup database;

5 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

(3) copy rman backup file (03fsola1_1_1) from $ORACLE_HOME/dbs (host1) to $ORACLE_HOME/dbs
(host1).

(4) Copy initTRG.ora to host2 and change the name to initAUX.ora.


Set db_name= aux , instance_name= aux in initAUX.ora
create spfile from pfile

(5) startup aux database


>startup nomount

(6) Issue the following command in host2.


$rman TARGET sys/he1@trg CATALOG rman/rman@cat AUXILIARY SYS/he1@aux

Recovery Manager: Release 9.2.0.4.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: TRG (DBID=3951124335)


connected to recovery catalog database
connected to auxiliary database: AUX (not mounted)

(7) create duplicate db


RMAN>DUPLICATE TARGET DATABASE TO aux NOFILENAMECHECK;

The error I got: "no backup or copy of datafile". But I put duplicate copy of rman backup file in
the same location of host2 as in host1. And I issued "List backup" and all datafiles are there in
rman backup file.

Thanks so much for you help.

-------------------------------------------------------------------------------------
-- Here is the error message
Starting Duplicate Db at 06-AUG-04
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=13 devtype=DISK

printing stored script: Memory Script


{
set until scn 355657;
set newname for datafile 1 to
"/export/home/oracle/9.2.0/oradata/cbtest2/system01.dbf";
set newname for datafile 2 to
"/export/home/oracle/9.2.0/oradata/cbtest2/undotbs01.dbf";
set newname for datafile 3 to
"/export/home/oracle/9.2.0/oradata/cbtest2/cwmlite01.dbf";
set newname for datafile 4 to
"/export/home/oracle/9.2.0/oradata/cbtest2/drsys01.dbf";
set newname for datafile 5 to
"/export/home/oracle/9.2.0/oradata/cbtest2/example01.dbf";
set newname for datafile 6 to
"/export/home/oracle/9.2.0/oradata/cbtest2/indx01.dbf";
set newname for datafile 7 to
"/export/home/oracle/9.2.0/oradata/cbtest2/odm01.dbf";
set newname for datafile 8 to
"/export/home/oracle/9.2.0/oradata/cbtest2/tools01.dbf";
set newname for datafile 9 to
"/export/home/oracle/9.2.0/oradata/cbtest2/users01.dbf";
set newname for datafile 10 to
"/export/home/oracle/9.2.0/oradata/cbtest2/xdb01.dbf";
restore
check readonly
clone database
;
}
executing script: Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

6 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

executing command: SET NEWNAME

Starting restore at 06-AUG-04

using channel ORA_AUX_DISK_1


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 08/06/2004 15:45:56
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 10 found to restore
RMAN-06023: no backup or copy of datafile 9 found to restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
------------------------------------------------------------------------

Followup August 7, 2004 - 9am Central time zone:

check out support note: <Note:108883.1>

<quote>
You must issue a log switch and backup the archivelogs as well. This error is
indicating that all pieces required to perform the duplication are not present.
When you issue a backup script which backs up all of the archivelogs (after a
log switch), the duplicate database script completes successfully.
</quote>

creaet duplicate db by rman August 9, 2004 - 7pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

Thanks so much for your help.

By looking at metalink as you mentioned, I find two scripts to backup and restore db, it WORKS, but
still gave me some error messages when creating duplicating db (see the bottom of the screen shot)

I am using the same procedure as in my previous question.

In step (2)

run {allocate channel bak1 type disk;


allocate channel bak2 type disk;
backup
format '$ORACLE_HOME/dbs/lvl0_%s%p.%d'
(database
tag = 'weekly_lvl0_bak'
include current controlfile);
sql "ALTER SYSTEM ARCHIVE LOG CURRENT";
backup
format '/$ORACLE_HOME/dbs/log_%s%p.%d'
(archivelog all delete input);
}

In step (7)
-- Time is after backup time and before the current time.

run{
set until time "to_date('2004/08/09 18:50:00','YYYY/MM/DD HH24:MI:SS')";
allocate auxiliary channel ch1 type disk;
allocate auxiliary channel ch2 type disk;
DUPLICATE TARGET DATABASE TO cbtest3 NOFILENAMECHECK;
sql "alter database open resetlogs";
}

-- I have to manaully run sql "alter database open resetlogs";

--------------------------------

7 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

-- Here is the output (Error is at the bottom).


RMAN> run{
set until time "to_date('2004/08/09 18:52:00','YYYY/MM/DD HH24:MI:SS')";
allocate auxiliary channel ch1 type disk;
allocate auxiliary channel ch2 type disk;
DUPLICATE TARGET DATABASE TO cbtest3 NOFILENAMECHECK;
sql "alter database open resetlogs";}

executing command: SET until clause

allocated channel: ch1


channel ch1: sid=13 devtype=DISK

allocated channel: ch2


channel ch2: sid=14 devtype=DISK

Starting Duplicate Db at 09-AUG-04

printing stored script: Memory Script


{
set until scn 1296044;
set newname for datafile 1 to
"/export/home/oracle/9.2.0/oradata/cbtest2/system01.dbf";
set newname for datafile 2 to
"/export/home/oracle/9.2.0/oradata/cbtest2/undotbs01.dbf";
set newname for datafile 3 to
"/export/home/oracle/9.2.0/oradata/cbtest2/cwmlite01.dbf";
set newname for datafile 4 to
"/export/home/oracle/9.2.0/oradata/cbtest2/drsys01.dbf";
set newname for datafile 5 to
"/export/home/oracle/9.2.0/oradata/cbtest2/example01.dbf";
set newname for datafile 6 to
"/export/home/oracle/9.2.0/oradata/cbtest2/indx01.dbf";
set newname for datafile 7 to
"/export/home/oracle/9.2.0/oradata/cbtest2/odm01.dbf";
set newname for datafile 8 to
"/export/home/oracle/9.2.0/oradata/cbtest2/tools01.dbf";
set newname for datafile 9 to
"/export/home/oracle/9.2.0/oradata/cbtest2/users01.dbf";
set newname for datafile 10 to
"/export/home/oracle/9.2.0/oradata/cbtest2/xdb01.dbf";
restore
check readonly
clone database
;
}
executing script: Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 09-AUG-04

channel ch1: starting datafile backupset restore


channel ch1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /export/home/oracle/9.2.0/oradata/cbtest2/system01.
bf
restoring datafile 00002 to /export/home/oracle/9.2.0/oradata/cbtest2/undotbs01
dbf
restoring datafile 00003 to /export/home/oracle/9.2.0/oradata/cbtest2/cwmlite01
dbf
restoring datafile 00004 to /export/home/oracle/9.2.0/oradata/cbtest2/drsys01.d
f
restoring datafile 00005 to /export/home/oracle/9.2.0/oradata/cbtest2/example01
dbf
restoring datafile 00006 to /export/home/oracle/9.2.0/oradata/cbtest2/indx01.db

8 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

restoring datafile 00007 to /export/home/oracle/9.2.0/oradata/cbtest2/odm01.dbf


restoring datafile 00008 to /export/home/oracle/9.2.0/oradata/cbtest2/tools01.d
f
restoring datafile 00009 to /export/home/oracle/9.2.0/oradata/cbtest2/users01.d
f
restoring datafile 00010 to /export/home/oracle/9.2.0/oradata/cbtest2/xdb01.dbf
channel ch1: restored backup piece 1
piece handle=/export/home/oracle/9.2.0/dbs/lvl0_261.CBTEST2 tag=WEEKLY_LVL0_BAK
params=NULL
channel ch1: restore complete
Finished restore at 09-AUG-04
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "cbtest3" RESETLOGS ARCHIV
LOG
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 ( '/export/home/oracle/9.2.0/oradata/cbtest2/redo01.log' ) SIZE 104
57600 REUSE,
GROUP 2 ( '/export/home/oracle/9.2.0/oradata/cbtest2/redo02.log' ) SIZE 104
57600 REUSE,
GROUP 3 ( '/export/home/oracle/9.2.0/oradata/cbtest2/redo03.log' ) SIZE 104
57600 REUSE
DATAFILE
'/export/home/oracle/9.2.0/oradata/cbtest2/system01.dbf'
CHARACTER SET WE8ISO8859P1

printing stored script: Memory Script


{
switch clone datafile all;
}
executing script: Memory Script

datafile 2 switched to datafile copy


input datafilecopy recid=1 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/undotbs01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/cwmlite01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/drsys01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/example01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=5 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/indx01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=6 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/odm01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=7 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/tools01.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=8 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/users01.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=9 stamp=533760648 filename=/export/home/oracle/9.2.0/o
adata/cbtest2/xdb01.dbf

printing stored script: Memory Script


{
set until time "to_date('2004/08/09 18:50:00','YYYY/MM/DD HH24:MI:SS')";
recover
clone database
delete archivelog
;
}
executing script: Memory Script

executing command: SET until clause

Starting recover at 09-AUG-04

starting media recovery

channel ch1: starting archive log restore to default destination


channel ch1: restoring archive log
archive log thread=1 sequence=21
channel ch1: restoring archive log
archive log thread=1 sequence=22

9 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

channel ch1: restored backup piece 1


piece handle=/export/home/oracle/9.2.0/dbs/log_271.CBTEST2 tag=TAG20040809T1842
6 params=NULL
channel ch1: restore complete
archive log filename=/export/home/oracle/9.2.0/oradata/cbtest2/archive/1_21.dbf
thread=1 sequence=21
channel clone_default: deleting archive log(s)
archive log filename=/export/home/oracle/9.2.0/oradata/cbtest2/archive/1_21.dbf
recid=1 stamp=533760652
archive log filename=/export/home/oracle/9.2.0/oradata/cbtest2/archive/1_22.dbf
thread=1 sequence=22
channel clone_default: deleting archive log(s)
archive log filename=/export/home/oracle/9.2.0/oradata/cbtest2/archive/1_22.dbf
recid=2 stamp=533760652
unable to find archive log
archive log thread=1 sequence=23
released channel: ch1
released channel: ch2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 08/09/2004 18:50:54
RMAN-03015: error occurred in stored script Memory Script
RMAN-06054: media recovery requesting unknown log: thread 1 scn 1296048
-----------------------------------------------------------------------------

Followup August 9, 2004 - 9pm Central time zone:

well, wall clock times are withing +/- so many minutes -- so, I would suggest using SCN based
recovery for this operation.

August 10, 2004 - 2am Central time zone Bookmark | Bottom | Top
Reviewer: steve

sometimes just cloning a database is not enough.

if moving it to another machine you also have to :

1. ensure the environment on the new machine is setup, to match the cloned system.
this would include memory & disc allocation space.
2. ensure the "new" machine time is the same or greater than the machine you were cloning from

duplicate db using rman August 10, 2004 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

(1) I delete the time portion, it works without error.

run{
allocate auxiliary channel ch1 type disk;
allocate auxiliary channel ch2 type disk;
DUPLICATE TARGET DATABASE TO cbtest3 NOFILENAMECHECK;
sql "alter database open resetlogs";}

(2) But Metalink did show one script with time. How can I make it work without error. I set
anytime after backup, it always give error message. Since the note in Metalink didn't mention how
to backup in details, I guess I still have some problem with my backup script.

I got this script from Note:228257.1:

RMAN> RUN { # the DUPLICATE command uses an automatic disk channel


set until time "to_date('Jan 29 2003 10:50:00','Mon DD YYYY HH24:MI:SS')";
SET NEWNAME FOR DATAFILE 1 TO '/export/home/oracle/AUX/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/export/home/oracle/AUX/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/export/home/oracle/AUX/example01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/export/home/oracle/AUX/tools01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/export/home/oracle/AUX/users01.dbf';
SET NEWNAME FOR DATAFILE 7 TO '/export/home/oracle/AUX/logmnrts.dbf';
SET NEWNAME FOR DATAFILE 8 TO '/export/home/oracle/AUX/marius01.dbf';
DUPLICATE TARGET DATABASE TO AUX
SKIP TABLESPACE indx
LOGFILE
GROUP 1 ('/export/home/oracle/AUX/redo01a.log',

10 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

'/export/home/oracle/AUX/redo01b.log') SIZE 200K REUSE,


GROUP 2 ('/export/home/oracle/AUX/redo02a.log',
'/export/home/oracle/AUX/redo02b.log') SIZE 200K REUSE; }

(3)I used change number, it works. I used the change number in the error message minus 1.
Actually I would like to know how to get the change number after backup, so it won't generate error
during duplication.

run{
set until change 1296047;
allocate auxiliary channel ch1 type disk;
allocate auxiliary channel ch2 type disk;
DUPLICATE TARGET DATABASE TO cbtest3 NOFILENAMECHECK;
sql "alter database open resetlogs";}

Thanks so much for your help.

space February 3, 2005 - 1pm Central time zone Bookmark | Bottom | Top
Reviewer: abc

How much space doest it take to clone a database


I have 2 dev enviroment d1 and d2 and P1 is prodxn
P1 used space is 12 gb and d1 and d2 allocated space is 20gb for both.

Do i need extra space for d1 and d2 to refresh from p1

Followup February 3, 2005 - 2pm Central time zone:

the clone needs the same space.

Regarding resetlogs September 15, 2005 - 2am Central time zone Bookmark | Bottom | Top
Reviewer: Amit Bansal from Bangalore,India

The document was very useful..


I have a query regarding Resetlogs option
While cloning a database we use Resetlogs twice
First in controlfile script
create controlfile set database "SID" resetlogs archivelog

Secondly alter database open resetlogs.

Why do we need to specify resetlogs option twice? At the time of opening the database we can simply
reset the logs.

Followup September 15, 2005 - 7am Central time zone:

reset on the controlfile statement does this:

...
RESETLOGS

Specify RESETLOGS if you want Oracle to ignore the contents of the files listed in the LOGFILE
clause. These files do not have to exist. Each redo_log_file_spec in the LOGFILE clause must
specify the SIZE parameter. Oracle assigns all online redo log file groups to thread 1 and enables
this thread for public use by any instance. After using this clause, you must open the database
using the RESETLOGS clause of the ALTER DATABASE statement.

.......

and on the open clause does this:

.....
RESETLOGS

Specify RESETLOGS to reset the current log sequence number to 1 and discards any redo information

11 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

that was not applied during recovery, ensuring that it will never be applied. This effectively
discards all changes that are in the redo log, but not in the database.

You must specify RESETLOGS to open the database after performing media recovery with an incomplete
recovery using the RECOVER clause or with a backup control file. After opening the database with
this clause, you should perform a complete database backup.
...........

They do "different" things, one lets you create a controlfile without having the online redo logs
already there, the other effectively "resets" them to sequence 1

Thanks... September 15, 2005 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: Amit Bansal from Bangalore,India

Thanks Tom !!it cleared my doubts.. though it might sound very elementary to many.. but i couldn't
find it's answer anywhere..

What about statistics October 19, 2005 - 3pm Central time zone Bookmark | Bottom | Top
Reviewer: Chris from VA USA

When a db is cloned to a machine with a different hardware or configuration profile (ie less
physical memory or different init.ora settings) is there a need or benefit to regenerate
statistics?

Followup October 19, 2005 - 4pm Central time zone:

system stats perhaps (cpu speed, single block IO rate, multi-block IO rate...)

November 13, 2005 - 2pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader

what is the (best) way to determine *when* a database has been cloned?

Followup November 13, 2005 - 5pm Central time zone:

well, you cannot - all you need is any backup and you can clone it over and over.

the database being cloned typically isn't a participant in the clone process - it's backups might
be - but "it" isn't.

Minimizing amount of archive log applied in creating duplicate db November 14, 2005 - 5pm Central time zone
Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

We are creating duplicate database for testing using rman.


Here is what we did:
(1) using rman to backup production to disk.
(2) using rman to create duplicate database.
Here is the command:
rman catalog rman/rman@cbtest target sys/cb56cbdw auxiliary sys/cb56cbdw2@cbdw2
run{
allocate auxiliary channel ch1 type disk;
DUPLICATE TARGET DATABASE TO itprod until time 'sysdate - 1' NOFILENAMECHECK;}

We issue duplicate target


database command right after full backup. It will take about 20 hrs to restore all datafiles, then
rman start to apply archive log files to duplicate database, sometimes it takes long time to apply
all archive logfiles. Since we only need to duplicate database for testing, we would like to
restore database without applying archive log file. But if we don t include until clause, the
restoration would fail because rman could not find necessary archive logfile.

My question is whether there is command which would let us create duplicate database without
applying archive log file (or at least minimizing the amount of archive log applied).

By the way, we would like to use script to avoid manual process.

Thanks so much for your help.

12 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Followup November 15, 2005 - 7am Central time zone:

if you did a hot backup, you must apply redo to make the files consistent.

did you do hot or cold?

(20 hours to restore?? that seems really long)

create duplicate database. November 15, 2005 - 11am Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

It is hot backup. (db version 9206).

It is 500 GB database, rman spent most of time to copy rman backup from shared disk to local disk.

Since we only want to create duplicate db with latest full backup, we would like to apply archive
log files as less as we can. With "until with time" command, it is hard to calculate the right
time, we simply wasted a lot time to apply a lot of archive log files.

I just need a command to tell rman "Please create duplicate database and apply as less archive
logfile as possible", so we can decrease the total time to create duplicate db.

Thanks so much for your help.

Sean

Followup November 15, 2005 - 11am Central time zone:

then you have to apply logs, no way around that.

you'd have to apply them to the point of time of the completion of the last backup, so look at the
time the last backup finished - that is the point in time at which you can restore to.

create duplicate db using rman. November 15, 2005 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

We want to have a job to run every week to create duplicate db, which means the operation without
human involvement. We don't know when full backup finish before hand, then sysdate in "until time"
command only considers when it starts to do recovery, which means after restoring of all data
files. (Time to restore all data files vary).

In short, I just don't have a good command to tell rman to create duplicate db each week, without
human involvement, with applying minimum archive log files.

Thanks so much for your help.

Sean

Followup November 15, 2005 - 2pm Central time zone:

can you use the RC_BACKUP_SET view in the recovery catalog - it has start and end times.

create duplicate db using rman November 15, 2005 - 3pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Sure. But the result is a little confusing. Besides, how could I pass the time to rmna script?

Here is my query:

select to_char(completion_time, 'HH:MI MM:DD:YYYY'), incremental_level from rc_backup_set where


db_key=120775 and incremental_level is null order by completion_time

13 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

TO_CHAR(COMPLETI INCREMENTAL_LEVEL
---------------- -----------------
01:25 11:15:2005
01:25 11:15:2005
01:25 11:15:2005
09:54 11:15:2005
10:03 11:15:2005
10:03 11:15:2005
10:03 11:15:2005
10:03 11:15:2005
12:46 11:15:2005
12:47 11:15:2005
12:47 11:15:2005

TO_CHAR(COMPLETI INCREMENTAL_LEVEL
---------------- -----------------
12:47 11:15:2005

Only 1:25 is the entry for full backup, but it didn't show incremental_level=0.

Thanks so much for your help.

Sean

Followup November 15, 2005 - 4pm Central time zone:

you can write a script that writes a script.

I guess you want the "max" completition time there don't you?

create duplicate db using rman November 15, 2005 - 4pm Central time zone Bookmark | Bottom | Top
Reviewer: Sean from NJ, USA

Hi Tom,

YOu are right. I should be able to generate a script by script.

Thanks so much for your help.

Sean

Recovering a datafile December 3, 2005 - 3am Central time zone Bookmark | Bottom | Top
Reviewer: Rupa Dutta from INDIA

Hi Tom,

How do I recover a datafile that has not physically been backed up since its creation and has been
deleted. Please provide syntax example.

Followup December 3, 2005 - 10am Central time zone:

do you have EVERY SINGLE ARCHIVE REDO LOG created since this file was added?

Recovering Datafile December 3, 2005 - 11pm Central time zone Bookmark | Bottom | Top
Reviewer: Rupa Dutta from INDIA

Yes I have the archive log.

Followup December 4, 2005 - 6am Central time zone:

and do you use rman or do you "do it yourself"

"do it yourself"

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96572/osrestore.htm#19041

14 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

"rman"

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96572/osrestore.htm#19041

relink "oracle home" December 22, 2005 - 5pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader from UK

Tom,

Two machines (A and B) are of same architecture with same operating system and with HP-UX but with
different directory structure. Oracle version is 8.1.7.4 is running on machine A.

[1] My fellow DBA copied "oracle home" of machine A to machine B in different folder then ran
"relink all" on machine B then rectified errors related to path and other errors. Now oracle is
working on machine B

But somehow I think this is not the right approach to copy "oracle home" and rectify errors and
while relinking.

[1] Is above a right approach?


[2] Is "relink all" method made for such cases?
[3] Will above method work with Oracle 8i, 9i and 10g.

Followup December 22, 2005 - 5pm Central time zone:

it would not be the "supported" approach. It is so rare to have the "same os" too - I'd bet they
are a tiny bit different. It usually "works", but could have quirks.

10g grid control can clone installs


the installer can be automated to do silent installs.

relink "oracle home" December 22, 2005 - 6pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader from UK

Tom,

If you can please clarify what do you mean by "tiny bit different"

As you said "It is so rare to have the "same os"


too - I'd bet they are a tiny bit different"

But if we are doing "relink all" (re-compiling) does "os" difference makes any impact

Followup December 22, 2005 - 6pm Central time zone:

patches, options, packages installed = 'tiny bit different'. uname -a doesn't being to describe
what the OS really has.

relink oracle home December 22, 2005 - 7pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader

Tom,

Apologies, Not getting

If uname -a returns same results for both machines.

How does it makes difference in "relink all"

Followup December 22, 2005 - 8pm Central time zone:

If you are running "amazing_os version x.y.z" on two machines (that is what uname -a might report
out), it is unlikely they are "exactly the same" unless one machine is a physical restore of the

15 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

other machine.

Meaning - patches, packages, options - I'll bet you there is something different.

relink "oracle home" December 23, 2005 - 7am Central time zone Bookmark | Bottom | Top
Reviewer: A reader from UK

Tom,

I agree with you that os can be different. But my question is still unanswered.

"But if we are doing "relink all" (re-compiling) does "os" difference makes any impact."

Base of above is "Doc ID: Note:1014014.6". which tells that executables store location of stared
libraries in it and use them while executing. I don't understand that if "relink all" refresh all
executables then where "os difference" comes in between.

Followup December 23, 2005 - 12pm Central time zone:

different packages, different things. The os's will be slightly different - they will not be
exactly the same.

like I said, it'll "probably work"

or as I like to say "there is no reason it wouldn't work - which probably means you'll find some
reason while doing it someday that won't let it work"

"there is no reason it wouldn't work" - famous last words...

process hang January 16, 2006 - 7pm Central time zone Bookmark | Bottom | Top
Reviewer: neeraj

1. Login to target database ( TSTP ) and run backup through rman

c:\rman
rman> backup database; ( if tstp is in noarchive log mode then make sure it should not be open
mode)

2.

NoMount auxiliary database

SQL> startup nomount


ORACLE instance started.

Total System Global Area 97589952 bytes


Fixed Size 453312 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
SQL> exit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production


With the OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

3. Run Rman clone process


C:\>rman

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

RMAN> connect target system/manager@tstp

connected to target database: TSTP (DBID=422537837)

RMAN> CONNECT AUXILIARY SYS/tstrmn

connected to auxiliary database: tstrmn (not mounted)

16 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

RMAN> connect target system/manager@tstp

connected to target database: TSTP (DBID=422537837)

RMAN> CONNECT AUXILIARY SYS/tstrmn

connected to auxiliary database: tstrmn (not mounted)

RMAN> CONFIGURE CHANNEL DEVICE TYPE disk CLEAR;

using target database controlfile instead of recovery catalog


old RMAN configuration parameters are successfully deleted

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO disk;

old RMAN configuration parameters:


CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored

RMAN> run
2> {
3> SET NEWNAME FOR DATAFILE 1 TO 'c:\tstrmn\system01.dbf';
4> DUPLICATE TARGET DATABASE TO tstrmn
5> LOGFILE
6> GROUP 1 ('c:\tstrmn\redo01a.log',
7> 'c:\tstrmn\redo01b.log') SIZE 200K REUSE,
8> GROUP 2 ('c:\tstrmn\redo02a.log',
9> 'c:\tstrmn\redo02b.log') SIZE 200K REUSE;
10> }

executing command: SET NEWNAME

Starting Duplicate Db at 16-JAN-06


allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=10 devtype=DISK

printing stored script: Memory Script


{
set newname for datafile 1 to
"C:\TSTRMN\SYSTEM01.DBF";
restore
check readonly
clone database
;
}
executing script: Memory Script

executing command: SET NEWNAME

Starting restore at 16-JAN-06

using channel ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to C:\TSTRMN\SYSTEM01.DBF
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=C:\ORACLE\ORA92\DATABASE\02H90PPG_1_1 tag=TAG20060116T161544 params
=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 16-JAN-06
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "tstrmn" RESETLOGS NOARCHIV
ELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 1048
MAXINSTANCES 1
MAXLOGHISTORY 907
LOGFILE
GROUP 1 ( 'c:\tstrmn\redo01a.log', 'c:\tstrmn\redo01b.log' ) SIZE 204800
REUSE,
GROUP 2 ( 'c:\tstrmn\redo02a.log', 'c:\tstrmn\redo02b.log' ) SIZE 204800
REUSE
DATAFILE
'C:\TSTRMN\SYSTEM01.DBF'
CHARACTER SET US7ASCII

printing stored script: Memory Script


{
switch clone datafile all;
}
executing script: Memory Script

17 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

printing stored script: Memory Script


{
recover
clone database
noredo
,
delete archivelog
;
}
executing script: Memory Script

Starting recover at 16-JAN-06


using channel ORA_AUX_DISK_1
Finished recover at 16-JAN-06

printing stored script: Memory Script


{
shutdown clone;
startup clone nomount ;
}
executing script: Memory Script

Now here process is hang :(

alert log last entry


Mon Jan 16 16:21:26 2006
Successful mount of redo thread 1, with mount id 2901142661.
Mon Jan 16 16:21:26 2006
Completed: CREATE CONTROLFILE REUSE SET DATABASE "tstrmn" RES
Shutting down instance: further logons disabled
Shutting down instance (normal)
License high water mark = 4
Mon Jan 16 16:26:33 2006
Active process 5152 user 'SYSTEM' program 'ORACLE.EXE'
SHUTDOWN: waiting for logins to complete.

why it hung?

Process hung January 16, 2006 - 7pm Central time zone Bookmark | Bottom | Top
Reviewer: Neeraj

:) My bad

I exit from other session

My 2cents:

1. Login to target database ( TSTP ) and run backup through rman

c:\rman
rman> backup database; ( if tstp is in noarchive log mode then make sure it should not be open
mode)

2.

NoMount auxiliary database

SQL> startup nomount


ORACLE instance started.

Total System Global Area 97589952 bytes


Fixed Size 453312 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
SQL> exit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production


With the OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

3. Run Rman clone process


C:\>rman

18 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

RMAN> connect target system/manager@tstp

connected to target database: TSTP (DBID=422537837)

RMAN> CONNECT AUXILIARY SYS/tstrmn

connected to auxiliary database: tstrmn (not mounted)

RMAN> connect target system/manager@tstp

connected to target database: TSTP (DBID=422537837)

RMAN> CONNECT AUXILIARY SYS/tstrmn

connected to auxiliary database: tstrmn (not mounted)

RMAN> CONFIGURE CHANNEL DEVICE TYPE disk CLEAR;

using target database controlfile instead of recovery catalog


old RMAN configuration parameters are successfully deleted

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO disk;

old RMAN configuration parameters:


CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored

RMAN> run
2> {
3> SET NEWNAME FOR DATAFILE 1 TO 'c:\tstrmn\system01.dbf';
4> DUPLICATE TARGET DATABASE TO tstrmn
5> LOGFILE
6> GROUP 1 ('c:\tstrmn\redo01a.log',
7> 'c:\tstrmn\redo01b.log') SIZE 200K REUSE,
8> GROUP 2 ('c:\tstrmn\redo02a.log',
9> 'c:\tstrmn\redo02b.log') SIZE 200K REUSE;
10> }

executing command: SET NEWNAME

Starting Duplicate Db at 16-JAN-06


allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=10 devtype=DISK

printing stored script: Memory Script


{
set newname for datafile 1 to
"C:\TSTRMN\SYSTEM01.DBF";
restore
check readonly
clone database
;
}
executing script: Memory Script

executing command: SET NEWNAME

Starting restore at 16-JAN-06

using channel ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to C:\TSTRMN\SYSTEM01.DBF
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=C:\ORACLE\ORA92\DATABASE\02H90PPG_1_1 tag=TAG20060116T161544 params
=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 16-JAN-06
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "tstrmn" RESETLOGS NOARCHIV
ELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 1048
MAXINSTANCES 1
MAXLOGHISTORY 907
LOGFILE
GROUP 1 ( 'c:\tstrmn\redo01a.log', 'c:\tstrmn\redo01b.log' ) SIZE 204800
REUSE,
GROUP 2 ( 'c:\tstrmn\redo02a.log', 'c:\tstrmn\redo02b.log' ) SIZE 204800

19 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

REUSE
DATAFILE
'C:\TSTRMN\SYSTEM01.DBF'
CHARACTER SET US7ASCII

printing stored script: Memory Script


{
switch clone datafile all;
}
executing script: Memory Script

printing stored script: Memory Script


{
recover
clone database
noredo
,
delete archivelog
;
}
executing script: Memory Script

Starting recover at 16-JAN-06


using channel ORA_AUX_DISK_1
Finished recover at 16-JAN-06

printing stored script: Memory Script


{
shutdown clone;
startup clone nomount ;
}
executing script: Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)


Oracle instance started

Total System Global Area 97589952 bytes

Fixed Size 453312 bytes


Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "tstrmn" RESETLOGS NOARCHIV
ELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 1048
MAXINSTANCES 1
MAXLOGHISTORY 907
LOGFILE
GROUP 1 ( 'c:\tstrmn\redo01a.log', 'c:\tstrmn\redo01b.log' ) SIZE 204800
REUSE,
GROUP 2 ( 'c:\tstrmn\redo02a.log', 'c:\tstrmn\redo02b.log' ) SIZE 204800
REUSE
DATAFILE
'C:\TSTRMN\SYSTEM01.DBF'
CHARACTER SET US7ASCII

printing stored script: Memory Script


{
Alter clone database open resetlogs;
}
executing script: Memory Script

database opened
Finished Duplicate Db at 16-JAN-06

Resetlogs January 18, 2006 - 11am Central time zone Bookmark | Bottom | Top
Reviewer: abc

Tom,

20 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

I have serious problem here and My manager is one of the nuts in this world.

She is asking me to clone the database with following procedure;


1. Restore all datafiles ,log files ( DB name is TP )
2. Startup mount
3. create controlfile set "TB" noresetlogs noarchivelog
4. alter database open;

Please comment on above procedure

Followup January 19, 2006 - 7am Central time zone:

It is viable.

clone January 19, 2006 - 8pm Central time zone Bookmark | Bottom | Top
Reviewer: abc

it is a cold copy, there is no need for applying archive logs. Copy all the data files and redo
logs, then do

Recreate the control file SET TP to TB,

1. startup mount

2. recover database until cancel

3. when it comes back with a prompt type cancel and hit return

4. Then type, alter database open resetlogs;

Above #2 and #3 can be skipped to #4, alter database open resetlogs. You always can try to open
database, if it prompt for recover, then you do recover database. For cold copy, it is no need to
apply archives.

Now, Appreciate if you please help me to understand How to explain that above procedure is wrong to
my manager?

Thanks!

Followup January 20, 2006 - 9am Central time zone:

no one said to apply logs did they?

why do you believe the procedure to be wrong.

clone January 20, 2006 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: abc

Database copied with hotbackup which included all datafiles,logfile and controlfiles then somebody
validated the hot backup and did shutdown abort

I copied all datafiles and rename it to TDEV but while opening the database it was asking for
archive logs so I had to startup backup database and then shutdown immediate during shutdown 8
archivelogs got generated which I applied to TDEV to bring it up

My manage asking why did you apply archive logs ?

Followup January 20, 2006 - 12pm Central time zone:

so now we are hotbackup? you are supplying insufficient data.

Look, you give me this information:

...
1. Restore all datafiles ,log files ( DB name is TP )

21 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

2. Startup mount
3. create controlfile set "TB" noresetlogs noarchivelog
4. alter database open;
......

and say "it is crazy". I look at it and say "if you are restoring LOG FILES, I presume you mean
ONLINE LOG FILES, and the only time they might even be part of a backup would be from a
noarchivelog mode cold backup"

hence, the steps - they are valid.

So you need to either be much more precise as to the steps and conditions or accept that the steps
are not "crazy"

And if they are crazy, just sit back and ask her to "show you how to do it" and when it fails, say
"see, told you" I guess.

Now, if you are taking a hot backup from an archivelog mode database, then yes - you will always
need to apply some amount of archived redo log and do a cancel or time based recovery. But, that
is not information that was provided previously.

Truth be told - to clone an instace - rman duplicate command....

rman clone January 22, 2006 - 7pm Central time zone Bookmark | Bottom | Top
Reviewer: abc

How to restore file in remorte sever with rman set newfilename

clone January 24, 2006 - 5pm Central time zone Bookmark | Bottom | Top
Reviewer: abc

Agree, after database is up, all fuzzy transactions are in synch. There is no need to apply
archives. If this database is in non-archive mode, you shutdown abort, does that mean you can't
open database? There are no archive logs to apply.

TP was in non-archive mode for a while, just for your information


Tom,
Can you please comment on above statement

Followup January 24, 2006 - 9pm Central time zone:

abc, I'd appreciate it if you would email me directly. I need to talk to you about something.
please identify yourself in the subjec as "abc" so I know it is from you.

thanks.

Database installation via recovery January 27, 2006 - 1pm Central time zone Bookmark | Bottom | Top
Reviewer: Tom

Tom,

At the moment when I install a new database, I install the software and then run dbca to create the
database. Installing the software is quick [20 mins or so] but installing the database takes about
1hr.

I was wondering if instead I could do one install and back it up, then instead of using dbca, just
register the instance and recover the backup as this would be must faster and less error prone.

My questions are what needs to be the same between the backed up machine and the restored machine

1. Oracle software [is this base version or patch level]?


2. Operating system version [again is patch level important]?
3. Location of oracle software?

If there is a doc covering this, please just point me to it!

Thanks

Followup January 28, 2006 - 12pm Central time zone:

22 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

if you used the "seed" database, it would be rather quick - it is only when you create a custom
database that it'll take a while.

Or you can use 10g EM to "clone" an existing instance (software and database if you like)...

But just restoring a database would be OK as well - you would want them to be exactly the "same"
version/patch wise (9.2.0.7 against 9.2.0.7 datafiles, 10.1.0.2 against 10.1.0.2 datafiles - not
9.2.0.7 against 9.2.0.4, not ....)

location of software - easiest if it is "the same" (paths in the controlfiles and such - assuming
you are using OFA type directory structures)

This is just like restoring a database to a new host after a total loss of your production system.
The documentation for it is in the backup and recovery guides.

Tell you what - since you have practiced restoring to a new host at least 100 times, just use the
same process you do there!! You already know what to do (I hope - since recovery is the only thing
a DBA is not allowed to get wrong...)

Seed databases January 30, 2006 - 5am Central time zone Bookmark | Bottom | Top
Reviewer: Tom

Tom,

I wasn't using one of the custom seed databases as I wanted to remove all the functionality our
application doesn't use such as xdb,data mining,etc. I had however forgotten that you could create
your own seed databases from an existing database.

I couldn't find anything in the documents which states the restrictions on the portability of these
seed databases. Are the restrictions on this the same as for cloning a database [same db version
and patchset, same os version]?

Followup January 30, 2006 - 8am Central time zone:

You'd need everything to be "the same". It is like restoring from a backup (well, it is in fact
restoring from a backup)

Hmm....how do the default templates work then January 31, 2006 - 4am Central time zone
Bookmark | Bottom | Top
Reviewer: Tom

Tom,

Thanks for your feedback on this. I spent yesterday playing with the seed databases to see whether
they would fit what I want them to do and have a couple of questions.

1. If I download the install CD for Oracle 10g it comes with a seed database [Transaction
Processing for example]. Now I use the same installer on windows 2000 that I use for windows 2003
and the seed database still works. Does the OUI install a different set of seed databases
depending on the version of the OS, and if not, how do these seed databases work independently of
the OS?

2. The seed database files [.djf] files are absolutely tiny compared with a full database
backup....what format are they stored in?

Followup January 31, 2006 - 3pm Central time zone:

for windows they would all be pretty much the same.

things are stored compressed.

I wasn't saying you can replace our seed, but rather that if you USED the seed... (it - dbca -
would be apparently "much faster")

it seems like you just want to

a) install software
b) restore a backup of a template database you backed up

23 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

b) would be your "seed"

DBCA provides a nice simple way of doing this February 1, 2006 - 3am Central time zone
Bookmark | Bottom | Top
Reviewer: Tom

Tom,

I agree completely that conceptually, I want to create template database, backup and then restore
onto the new machine [this is just to make life easy for developers to be honest and to make sure
everyone has a consistent database on their machine].

The nice thing about dbca is it makes this process transparent to the person installing....all they
know is that they choose a template, fill in some values and get a consistent database with all
setup done for them.

It sounds like I doing this would just require me to keep a template database up to date. I'll
check with support as to whether seed databases created with dbca are portable across windows
versions.

Thanks for your suggestions.....I think with a bit of investigation this could do exactly what I
need. If not, we'll go the manual restore route.

rman duplicate database on same server March 7, 2006 - 7am Central time zone Bookmark | Bottom | Top
Reviewer: Parag J Patankar from India

Hi Tom,

I am trying to do duplicate database with rman ( Oracle 9.2 ) on same server. Database is in
noarchive log mode.

I would like to know does RMAN requires target database backup for duplication ? if not I am
getting following error

RMAN-03015: error occurred in stored script Memory Script


RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 24 found to restore
RMAN-06023: no backup or copy of datafile 23 found to restore
....
....
...
Kindly tell me what is the cause of an error and how to rectify it. ( my process of duplicate
database thru rman was successful few times, but I am not sure why )

thanks & regards


pjp

RMAN April 11, 2006 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: A reader

Oracle9i Recovery Manager Reference


Release 2 (9.2)
Part Number A96565-01 says:

If you can make an operating system copy of a database file on one platform and then restore it to
another platform, then it is also possible to duplicate a database from one platform to another.
Otherwise, duplication is not possible.

What does this mean? Does it mean RMAN can be used for cross platform datamigration?

If I have a db in solaris, can I use RMAN backups and create the same db on Linux?

Followup April 11, 2006 - 4pm Central time zone:

I believe that to be awkwardly "worded"

cross platform transports are supported in 10g.

restore incremental backup on cloned database June 26, 2006 - 9am Central time zone

24 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Bookmark | Bottom | Top


Reviewer: Alay from India

Hi Tom,

I am cloning Production Database A as B on other server, both exactly identical, running in


ARCHIVELOG mode. For cloning first I shutdown the Database A and copy all the datafiles, redologs,
init.ora, controlfile to the other server. Directory stucture on both servers is identical. On
other server I just give startup command and it starts the database. This cloned database we are
using to generate reports only(DSS).

To make the cloned database B updated every night we are doing the same thing. Now I want to ask
that is there any way by which we can take incremental backup using RMAN of production database A
and restore it to B.

I have already tried to take incremental level 1 backup and try to restore it to B. But in database
B dosen't have the metadata for RMAN so it doesen't recognize the backup.

So if is there any other way that we can take an incremental backup of Database A and retore it to
cloned Database B which resides on other server? please give me solution.

Followup June 26, 2006 - 10am Central time zone:

not if you open the database READ WRITE.

Perhaps you want to look at data guard - if you use a physical standby, you can open it read only
to report, close it and have it get caught up from the redo. If you use logical standby, it can be
opened read write and have the logs continously applied.

How to clone a Stand alone database as 2 node rac database July 6, 2006 - 1am Central time zone
Bookmark | Bottom | Top
Reviewer: Ajeet

Hi Tom,

I have a cold backup of a standalone database.


I want to clone it as a 2 node rac database.My RAC setup is complete , it is on IBM AIX and cluster
services etc everything is working.
As the cold backup is huge so I wanted to convert this into as 2 node rac.

I cloned it on one node of the RAC without any problems but when I try to clone it another node ,
it gives an error saying that can not identfiy the control files.

could you please suggest the correct way to do it.


consider me a newbie with RAC and I am just going through the various documents on RAC.

Regards,
Ajeet

Followup July 8, 2006 - 9am Central time zone:

... As the cold backup is huge so I wanted to convert this into as 2 node rac. ..

that does not compute? what does the size of the backup have to do with it?

With RAC there is ONLY ONE DATABASE. I don't know what you mean by "when I try to clone it on
another node", all nodes have 100% access to the same database - there is only ONE database here -
if you are restoring it twice, you have missed the fundemental point of RAC

There is one database (set of files).


Many instances (processes + memory).

Question July 26, 2006 - 9pm Central time zone Bookmark | Bottom | Top
Reviewer: Aru from NZ

Hi Tom,
We are using 9iR2 database as our production database ( eg.- prod).
We are using RMAN/Tivoli to backup our database straight to tape.
We want to create a duplicate database( with different name, eg.- test) on different server and are
using the following command to do the cloning:

First connect to target, catalog and auxiliary database(test)

25 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

>duplicate target database to test;

Is there any chance at all that the rman can overwrite the production database ?

Regards,
Aru.

August 28, 2006 - 2pm Central time zone Bookmark | Bottom | Top
Reviewer: Su Baba

On a Linux system, if I copy the contents of the entire disks to another server, would this, in
effect, create a database clone?

Followup August 28, 2006 - 4pm Central time zone:

well, if you copied everything - and I mean everything (OS, everything) - sure, you would have
cloned the entire machine

as long as the machine was "dead", not "on" when you did it - it is called a "level zero file
system dump" sort of thing.

The keys are in the ignition, but the car doesn't start til 4 hours later September 26, 2006 - 12am Central time zone
Bookmark | Bottom | Top
Reviewer: Erika from Auckland, New Zealand

I'm cloning a production RAC database to a test server running in non cluster mode using the
following script:

connect target sys/mypassword@edwprd1;


connect auxiliary /;
run {
allocate auxiliary channel aux1 device type disk;
allocate auxiliary channel aux2 device type disk;
duplicate target database to edwtst until time "to_date('25-SEP-06 21:05', 'DD-MON-YY HH24:MI')";
}
exit;

The database on production is 30Gb. I run the script in nohup and I can watch the rman log file. I
wait over 4 hours for there to be anything written to the log file. Is this normal? How can I see
what Rman is doing? I only can see inactive sessions connected to production and test. I thought
the clone was hung during these 4 hours until voila', rman finally writes to the log file.

"cross platform transports are supported in 10g." January 4, 2007 - 4pm Central time zone
Bookmark | Bottom | Top
Reviewer: Sokrates
you wrote
"cross platform transports are supported in 10g."

what does this mean ?


anywhere a matrix which cross platforms are supported ?

for example, trying to duplicate a 10.2.0.2 DB from


Linux x86_64 to Linux ends up in
ORA-06553: PLS-801: internal error [56319]
on the cloned DB

Couldn't find a matrix of supported "cross platform transports" on metalink either

Followup January 5, 2007 - 9am Central time zone:

you can transport a file from operating system X to operating system Y

eg: from windows 2000 to sun solaris, from HP/UX to linux on intel

a clone is NOT a transport.

there is no matrix, because they are all supported for cross platform tablespace transports.

26 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

query V$TRANSPORTABLE_PLATFORM to see the list of supported platforms.


... January 4, 2007 - 4pm Central time zone Bookmark | Bottom | Top
Reviewer: Sokrates
"... trying to duplicate a 10.2.0.2 DB from
Linux x86_64 to Linux x86 (32 Bit) ... "

I wanted to say

dbca clone in 9i and catpatch January 5, 2007 - 1pm Central time zone Bookmark | Bottom | Top
Reviewer: Dodie from Allyn, WA USA
Created a clone database via dbca in a 9.2.0.8 environment, and successfully ran dbca with that clone template in a 9.2.0.6 environment. I
was surprised when the database appeared to function just fine ... but suspect some issues may occur further on down the line (assume
clone/seed dbj copies dictionary info, thus reason for same version requirement and the reason creation is so fast).

Until we can get everyone on 9208 in our production/development environment, assume I need to:
1. Re-create the clone in a 9206 environment?
2. Run $OH/rdbms/admin/catpatch.sql against a 9206-dbca-template-created database built in a 9208 environment to migrate the newly
created database and dictionary objects up to the proper level?

If option 2 would work, would running 9206 catpatch.sql against a 9208-dbca-template-created database built in a 9206 environment also
work to migrate database down to 9206?

thanks,
Dodie

Followup January 6, 2007 - 8am Central time zone:

I'm not 100% following your set of steps you undertook.

the first sentence confused me for example.


dbca clone templates in 9i January 7, 2007 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: Dodie from Allyn, WA
Tom,

Thanks for looking at this, I know you are flooded with questions, and very much appreciate your time and expertise.

Let me try to clarify.


1. Created a database containing schemas and initial data in a 9.2.0.8 development environment.
2. Created a clone template with data from the 9.2.0.8 database above using the dbca tool (dbca generates new template dbname.dbc
and data dbname.dfj).
3. Used the newly created clone template above to create this same database with initial schemas and data in a 9.2.0.6 development
environment.

Result: The database created above seemed to function fine, so this seemed like a quick way to re-deploy initial database (this particular
database is used by a COTS product to display information from other sources, so we do not need to backup/restore or even preserve
data; we just need to rebuild it quickly in production with initial configuration data).

While looking for some other issue, I found this thread, and gave additional thought to how the clone template is likely created. Since it
builds so quickly, am I correct in guessing that it contains the 9206 level dictionary objects and data?

Based on the contents of this thread, I will rebuild the clone template from a 9206 level database to match current production level.

However, I wondered if running the appropriate level catpatch.sql would migrate a 9206 clone database clone up to 9208 level in some of
our development environments, or if I need to create two clones, one for each 9206 and 9208 level.

thanks again,
Dodie

Followup January 7, 2007 - 8pm Central time zone:

if you just created a template, it is just a bunch of scripts with "creates" and running of scripts.

not really sure what you have going there - i would suggest using a consistent set of software however since there are differences
between 9206 and 9208 - it would not make sense to develop in one and deploy to another.
Cloning a RAC database January 14, 2007 - 1am Central time zone Bookmark | Bottom | Top
Reviewer: A reader
Hi tom,

I need to clone a two node RAC environment and I am trying to use rman. In the new servers I brought the two new instances in nomount
and then I ran the script that does the rman duplication, after the restore was finished the duplication failed while trying to create the
control file saying:

27 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

RMAN-03002: failure of Duplicate Db command at 01/13/2007 16:22:51


RMAN-06136: ORACLE error from auxiliary database: ORA-01503: CREATE CONTROLFILE failed
ORA-01618: thread 2 is not enabled - cannot mount

Base on this error I am wondering if I need to run the duplication having only one instance in nomount with the cluster_database=false,
and then after the duplication is finished I have to manually set up the cluster environment again. Am I right on this? or is there any way to
run a duplication using rman that will work having two instances in nomount? If that is the case what do I need to do in order to resolve the
error and have the second thread enabled so the rman process will not failed while trying to recreate the control file?

thanks, for any help you can give on this.

Cloning across versions June 6, 2007 - 9am Central time zone Bookmark | Bottom | Top
Reviewer: Mike
If we want to clone an 8.1.7 database to a 10.2.0 database server, is there any way to do it? Obviously the normal cloning procedures will
not work, i.e. copying a backup etc, as the versions of Oracle are different. Also, the database in question is too big to do an Oracle export.
Are there any other options?
I can get away with copying the relevant schema bit-by-bit using the sqlplus Copy command across a link or something similar but this
would be very time consuming.

Followup June 6, 2007 - 9pm Central time zone:

you have to UPGRADE it, you can restore the 817 database and then upgrade it to 10.2 using normal upgrade processes.
The keys are in the ignition, but the car doesn't start til 4 hours later July 2, 2007 - 5pm Central time zone
Bookmark | Bottom | Top
Reviewer: Erika from New Zealand
Just wanted to follow up on my original question.
My rman clone process was taking 40 hours for a 50Gb database. Now it takes just 12 hours if you add:
sql "alter session set optimizer_mode=RULE";

Restore database to new Server October 16, 2007 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: A Reader

Tom

I ran an RMAN warm backup as follows on the Prod server.

run {
delete noprompt backup;
set controlfile autobackup format for device type disk to 'D:\TestDB10G\Sunday_Controlfile%F';
backup incremental level 0 database format='D:\TestDB10G\SUNDAY_%u%p%c' tag=sunday_backup;
}

The directory structure on the Production server is something like this :

D:\TestDB10G\DATAFILES
D:\TestDB10G\SYSTEMFILES
D:\TestDB10G\CONTROLFILES
D:\TestDB10G\REDOLOGS
D:\TestDB10G\ARCHIVEDLOGS

(pls don't ask me why, but that is how the structure is)

On a new Server, after using ORADIM, etc,


I attempted to restore the above to the file system (the directory structure for the datafiles do
not exist yet), expecting RMAN to automatically create the directories for me.

It doesn't. Why ?

Thanks for your response.

Rman duplication May 15, 2008 - 2am Central time zone Bookmark | Bottom | Top
Reviewer: ck

Hi Tom,
I try to find the answer long time but can't get the answer anywhere.
Rman duplication require connect target to the source database, why does it need to connect to the
source and how is the overhead inccured in the source db during the duplication?

28 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Followup May 19, 2008 - 11am Central time zone:

it wants to know what the source database "is", connecting to it gives it the dbid and all - also, it provides access to all of the archives - the
duplicated database will be "as of the last available archive redo log" (as onlines are not available to be processed - they are "online", not
archived yet).

You can "duplicate" without connecting to source. Note 444437.1 has the details. But basically, you would do some of the things the
duplicate command does automatically for you - you would have to create the auxillary instance, and pretend you are "restoring to a new
host" and then change the dbnames/dbid's if you wanted to.
question about "Cloning an Oracle Home" October 31, 2008 - 11am Central time zone Bookmark | Bottom | Top
Reviewer: LEE from Grand Rapids, MI USA

Tom,

I like your web site, and read your comments all the time, it helpled me a lot.
Now I have a question:
I want to clone an Oracle Home to a different directory, e.g. from
/u01/app/oracle/product/10.2.0/db_1 to /u02/app/oracle/product/10.2.0/db_2
Can I do it like:
1. copy all the files from /u01/app/oracle/product/10.2.0/db_1 to
/u02/app/oracle/product/10.2.0/db_2
2. $ORACLE_HOME/oui/bin/runInstaller -silent -clone
ORACLE_HOME="/u02/app/oracle/product/10.2.0/db_2" ORACLE_HOME_NAME="db_2"

Thanks!

RMAN: duplicate database September 26, 2009 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: Mark from CT USA

Hi Tom, I searchd for Note 444437.1 and found nothing. I would like to clone databases without
connecting to the source db. Looking through the log of DUPLICATE DATABASE command, i see it
executing several memory scripts running some commands that are not in rman doc:
restore clone database
switch clone database
recover clone database
alter clone database
They all are using CLONE DATABASE clause, explanation of which I could not find. Is there any doc
explaining the internals of the DUPLICATE DATABASE and the purpose of CLONE DATABASE clause? I
understand the process, but would like to know more at the level of each operation I see in the
log.

Followup September 29, 2009 - 12pm Central time zone:

it is fairly self documenting in this case - clone is just a name for "duplicate"

change clone to duplicate and we:

restore the database as a duplicate


switch over to using that database after the store
recover the duplicate
and then make it be a real database, separate and distinct from where we duplicated it from.

note number 732624.1 - I don't know if I cut and pasted bad or if it changed- but that it the number now
September 29, 2009 - 9pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader

October 1, 2009 - 3pm Central time zone Bookmark | Bottom | Top


Reviewer: Mark from CT USA

Tom,
Thanks for your response, but I was looking for the description of the CLONE DATABASE clause and
wanted to know if I can use it or if it is only an rman internal operation.
How do I get a copy of Note 444437.1, since I couldnt find ot on Metalink.
I would like to be able to clone the database without any access to the source db. Since I have a
backup, including controlfile and archivelogs, I should be able to do this.

29 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

October 1, 2009 - 3pm Central time zone Bookmark | Bottom | Top


Reviewer: Mark from CT USA

Sorry, I missed the new Note # you provided. I got it now and will review.
Thanks.

RMAN cloning June 10, 2010 - 7am Central time zone Bookmark | Bottom | Top
Reviewer: Niharika from London

Hello Tom,

I am using Oracle 10.2.0.4.0 on Solaris 5.10. I am trying to clone the database 'DB1' to 'DB2'
using RMAN. I have only full backup of DB1 including archive logs, taken on weekends. The DB1 was
recovered recently, so there is a new incarnation in DB1.

I am trying to clone DB2 from the 'before-resetlogs' backup of DB1. The cloning is failing as it
says the backup is from before-resetlogs.

I was told to reset the incarnation in DB1 database and then try cloning onto DB2. But DB1 is a
production database, and I cannot reset the incarnation to previous one.

Is there any other solutions for this problem? Can I reset the incarnation of DB1 to previous one
(so that it clones without error) and after cloning, again move the incarnation to the current
(incarnation which is 'current' now) - what will be the effect of this?

Hope I am clear.

Thanks in advance

Duplicating RAC-ASM Database July 23, 2010 - 3am Central time zone Bookmark | Bottom | Top
Reviewer: Santosh Vijayan from India

Tom,

Thanks..these are Very useful info.


I need some help on a task that I am planning.
I am duplicating a database from rac -asm enviroment to a new rac asm environment. This is for
Oracle 11.1.0.7 database on Linux.

Here is the detail.


Can you please comment, if I have all the required steps.

=====================================================================

PRODUCTION DATABASE - MMHP1 on server mtshlp311/312


New Copy of database - MMHPC1 on server ghthlc311/312

To duplicate RAC database , first duplicate RAC Database to a single instance using RMAN and
convert the single instance into a RAC cluster
==========================================================================================

1) Login to mtshp311 as oracle user.

Set database environment.

. oraenv
ORACLE_SID = [MMHP11] ? MMHP11

2) Ensure there is RMAN database backup available for MMHP1.


Use backup generated via daily backup jobs.

In case backup is not available then take full database & archivelog backup for MMHP1 as shown.

-------------------------------------------------------------------------------------------------

Create directory to take backup of MMHP1 on local NAS.

cd /u950/backup
mkdir CR660075

cd /u950/backup/CR660075
mkdir rmanbkup

Ensure same directory structure is created on ghthlc321.

cd /u950/backup/CR660075

30 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Run the following commands on database MMHP1 only.

-------------------------------------------------------------------------------------------------

Create rman backup script as below.

vi /u950/backup/CR660075/backup_mmhp1.rman

run
{
configure default device type to disk;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u950/backup/CR660075/rmanbkup/%U' parallelism 4 backup
type to compressed backupset;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to
'/u950/backup/CR660075/rmanbkup/%F';
configure maxsetsize to 5G;
configure snapshot controlfile name to '/u950/backup/CR660075/rmanbkup/snapf_mmhp1.ora';
sql 'alter system switch logfile';
sql 'alter system archive log current';
backup full database plus archivelog;
}

:wq

-------------------------------------------------------------------------------------------------

Create rman backup shell script as below.

vi /u950/backup/CR660075/run_backup.ksh

#!/bin/ksh
export $ORACLE_SID=MMHP11
rman target=/ @/u950/backup/CR660075/backup_mmhp1.rman

:wq

chmod 755 run_backup.ksh

-------------------------------------------------------------------------------------------------

sqlplus '/as sysdba'


Alter system switch logfile;
Alter system archive log current
exit

-------------------------------------------------------------------------------------------------

Run the Backup

nohup ./run_backup.bsh > rman_mmhp1.log &

Check the backup log.

tail -f rman_mmhp1.log

3) Copy backup from mtshlp311 to ghthlc321 to same directory structure.

scp oracle@mtshlp311:/u950/backup/CR660075/rmanbkup/*
oracle@ghthlc321:/u950/backup/CR660075/rmanbkup/

4) Prepare the Auxiliary Host for the Duplicate Database (MMHPC1).

Login to ghthlc321 as oracle user.

Update /etc/oratab file.

echo "mmhpc11:/u01/app/oracle/product/11.1.0/db_1:N" >> /etc/oratab

5) Create a password file for the Database (MMHPC1).

cd $ORACLE_HOME/dbs

orapwd file=orapwmmhpc11 password=xxxxx

6) Create any Required Directories for the Database (MMHPC1).

mkdir -p /u01/app/oracle/diag/rdbms/mmhpc1/MMHPC11/trace
mkdir -p /u01/app/oracle/diag/rdbms/mmhpc1/MMHPC11/cdump
mkdir -p /u01/app/oracle/admin/MMHP1/adump

Create Necessary ASM Directories on the Host of the New Database (MMHPC1) for storing controlfile
and redologs.

31 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

export ORACLE_SID=+ASM1
asmcmd

ASMCMD> cd MTS_DATA
ASMCMD> mkdir mmhpc1
ASMCMD> cd mmhpc1
ASMCMD> mkdir onlinelog
ASMCMD> mkdir controlfile
ASMCMD: exit

asmcmd

ASMCMD> cd MTS_ARCHIVE
ASMCMD> mkdir mmhpc1
ASMCMD> cd mmhpc1
ASMCMD> mkdir onlinelog
ASMCMD> mkdir controlfile

7) Update the Oracle Networking Files as appropriate (MMHPC1)

cd $TNS_ADMIN

vi tnsnames.ora

MMHPC1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ghthlc321-vip) (PORT = 1521))


(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MMHPC1) (INSTANCE_NAME = MMHPC1)))
MMHPC11 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ghthlc321-vip) (PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MMHPC1) (INSTANCE_NAME = MMHPC11)))
MMHPC12 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ghthlc322-vip) (PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MMHPC1) (INSTANCE_NAME = MMHPC12)))
MMHP12 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = mtshlp312-vip.sabre.com) (PORT =
1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MMHP1) (INSTANCE_NAME = MMHP12)))
MMHP11 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = mtshlp311-vip.sabre.com) (PORT =
1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MMHP1) (INSTANCE_NAME = MMHP11)))

Test connectivity to all services involved in the DUPLICATE operation

tnsping MMHP11

8) Create/Update the Listener with a Static Entry (MMHPC1)

vi /u01/app/asm/product/11.1.0/asm_1/network/admin/listener.ora

LISTENER = (DESCRIPTION_LIST
LISTENER_GHTHLC321 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ghthlc321-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.210.108.17)(PORT = 1521)(IP = FIRST))
)
)

SID_LIST_LISTENER_GHTHLC321 =
(SID_LIST =
(SID_DESC =
(SID_NAME = +ASM1)
(ORACLE_HOME = /u01/app/asm/product/11.1.0/asm_1)
)
(SID_DESC =
(SID_NAME = MMHPC1)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
)
)

9) Copy the Parameter File from the TARGET to the AUXILIARY (MMHP1 to MMHPC1).

Login as oracle user on mtshlp311.

export ORACLE_SID=MMHP11

sqlplus "/ as sysdba"

create pfile='/u950/backup/CR660075/initMMHP11.ora' from spfile;

scp /u950/backup/CR660075/initMMHP11.ora oracle@ghthlc321:/u01/app/oracle/product/11.1.0/db_1/dbs/

10) Edit the Parameter File, Changing Necessary Values on Auxiliary Host (MMHPC1)

Login to ghthlc321 as oracle user.

. oraenv
ORACLE_SID = [oracle] ? MMHPC1

cd /u01/app/oracle/product/11.1.0/db_1/dbs/

32 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

mv initMMHP11.ora initMMHPC1.ora

In this example, the Diskgroup is switched from DATA to +MTS_DATA and FLASH to MTS_ARCHIVE.

The online redo logs shall be created as part of the DUPLICATE clause.

Comment all RAC related parameters for ex:- cluster_database, cluster_instances, thread ...Etc

vi /u01/app/oracle/product/11.1.0/db_1/dbs/initMMHPC1.ora

background_dump_dest='/u01/app/oracle/diag/rdbms/mmhpc1/MMHPC11/trace'

core_dump_dest='/u01/app/oracle/diag/rdbms/mmhpc1/MMHPC11/cdump'

user_dump_dest='/u01/app/oracle/diag/rdbms/mmhpc1/MMHPC11/trace'

control_files='+MTS_DATA/mmhpc1/controlfile/control01.ctl','+MTS_ARCHIVE/mmhpc1/controlfile/control0
2.ctl'

db_file_name_convert=('+DATA','+MTS_DATA')

log_file_name_convert=('+DATA','+MTS_DATA')

audit_file_dest='/u01/app/oracle/admin/MMHPC1/adump'

audit_sys_operations=TRUE

audit_trail='db'

compatible='11.1.0.7.0'

db_block_size=8192

db_domain=''

db_name='MMHPC1'

db_recovery_file_dest='+MTS_ARCHIVE'

db_recovery_file_dest_size=2147483648

db_create_file_dest='+MTS_DATA'

db_create_online_log_dest_1='+MTS_DATA'

db_create_online_log_dest_1='+MTS_ARCHIVE'

diagnostic_dest='/u01/app/oracle'

log_archive_dest_1='location=+MTS_ARCHIVE/'

db_unique_name=MMHPC1'

log_archive_format='%t_%s_%r.dbf'

log_archive_trace=511

max_dump_file_size='4000'

sga_target=3G

sga_max_size=3G

open_cursors=300

processes=500

remote_login_passwordfile='EXCLUSIVE'

undo_retention=86400

undo_tablespace='UNDOTBS1'

11) Create an SPFILE and startup nomount the Auxiliary Instance

export ORACLE_SID=MMHPC1

sqlplus / as sysdba

create spfile from pfile;

startup nomount;

exit

33 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

12) Run rman duplicate command

export ORACLE_SID=MMHPC1

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export PATH=$ORACLE_HOME/bin:$PATH

rman

CONNECT TARGET SYS/xxxxx@MMHP11


CONNECT AUXILIARY;

RUN

{
ALLOCATE AUXILIARY CHANNEL D1 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';
ALLOCATE AUXILIARY CHANNEL D2 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';
ALLOCATE AUXILIARY CHANNEL D3 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';
ALLOCATE AUXILIARY CHANNEL D4 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';
ALLOCATE AUXILIARY CHANNEL D5 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';
ALLOCATE AUXILIARY CHANNEL D6 DEVICE TYPE disk format '/u950/backup/CR660075/rmanbkup/%U';

duplicate target database to MMHPC1 logfile group 1


('+MTS_DATA/mmhpc1/onlinelog/redo_0101.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0102.log') SIZE
500M REUSE,
group 2 ('+MTS_DATA/mmhpc1/onlinelog/redo_0201.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0202.log')
SIZE 500M REUSE,
group 3 ('+MTS_DATA/mmhpc1/onlinelog/redo_0301.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0302.log')
SIZE 500M REUSE,
group 4 ('+MTS_DATA/mmhpc1/onlinelog/redo_0401.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0402.log')
SIZE 500M REUSE;
}

13) If duplication of database is successful, then turn the auxiliary database into a RAC database
by adding back all the necessary parameters,
such as cluster_database, cluster_instances, thread , undo_tablespace etc.

14) Add second thread of online redo logs and enable that thread:

alter database add logfile thread 2 group 5


('+MTS_DATA/mmhpc1/onlinelog/redo_0501.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0502.log') SIZE
500M REUSE;

alter database add logfile thread 2 group 6 (


'+MTS_DATA/mmhpc1/onlinelog/redo_0601.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0602.log') SIZE 500M
REUSE;

alter database add logfile thread 2 group 7 (


'+MTS_DATA/mmhpc1/onlinelog/redo_0701.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0702.log') SIZE 500M
REUSE;

alter database add logfile thread 2 group 8 (


'+MTS_DATA/mmhpc1/onlinelog/redo_0801.log','+MTS_ARCHIVE/mmhpc1/onlinelog/redo_0802.log') SIZE 500M
REUSE;

alter database enable public thread 2;

15) Uncomment or add all RAC related parameters such as cluster_database, cluster_instances, thread
, undo_tablespace etc.
Shutdown the single database instance and startup both Instances.

16) Create spfile on the shared storage, because all instances must use the same server parameter
file.

create spfile from pfile;

17) Register RAC instances with CRS

srvctl add database -d MMHPC1 -o /u01/app/oracle/product/11.1.0/db_1

srvctl add instance -d MMHPC1 -i MMHPC11 -n ghthlc321

srvctl add instance -d MMHPC1 -i MMHPC12 -n ghthlc322

18) Shutdown and startup instances using srvctl

srvctl start database ?d MMHPC1

19) Validation of restored database.

Logon to the the Database (MMHPC1) and Verify.

34 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

select name from v$datafile;


select name from v$controlfile;
select member from v$logfile;
select name from v$tempfile;

20) Check database alert logs and crs_stat -t output.

September 27, 2010 - 3am Central time zone Bookmark | Bottom | Top
Reviewer: neeraj from nepal

helo tom
i am new in orcle dba field

I am trying to clone one of my database and getting the following situation..

C:\Documents and Settings\neerajs>set ORACLE_SID=singh

C:\Documents and Settings\neerajs>rman target sys/sys@orcl auxiliary sys/sys@neeraj

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 27 12:31:41 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1258436464)


connected to auxiliary database: NEERAJ (not mounted)

RMAN> duplicate target database to neeraj;

Starting Duplicate Db at 27-SEP-10


using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script:


{
set until scn 589173;
set newname for datafile 1 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSTEM01.DBF";
set newname for datafile 2 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\UNDOTBS01.DBF";
set newname for datafile 3 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSAUX01.DBF";
set newname for datafile 4 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\USERS01.DBF";
set newname for datafile 5 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\EXAMPLE01.DBF";
set newname for datafile 6 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\ORCL.DBF";
set newname for datafile 7 to
"C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SINGH.DBF";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 27-SEP-10


using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore


channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

35 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

restoring datafile 00001 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSTEM01.DBF


restoring datafile 00002 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\UNDOTBS01.DBF
restoring datafile 00003 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSAUX01.DBF
restoring datafile 00004 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\USERS01.DBF
restoring datafile 00005 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\EXAMPLE01.DBF
restoring datafile 00006 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\ORCL.DBF
restoring datafile 00007 to C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SINGH.DBF
channel ORA_AUX_DISK_1: reading from backup piece D:\ORCL_BACKUP\0BLOULGF_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=D:\ORCL_BACKUP\0BLOULGF_1_1 tag=TAG20100927T115246
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:55
Finished restore at 27-SEP-10
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "NEERAJ" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 2 ( 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 3 ( 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSTEM01.DBF'
CHARACTER SET WE8MSWIN1252

contents of Memory Script:


{
switch clone datafile all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1


datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=730816451
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=730816451
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=730816452
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=730816452
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\EXAMPLE01.DBF
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=730816452
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\ORCL.DBF
datafile 7 switched to datafile copy
input datafile copy recid=6 stamp=730816453
filename=C:\ORACLE\PRODUCT\10.2.0\ORADATA\NEERAJ\SINGH.DBF

contents of Memory Script:


{
set until scn 589173;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 27-SEP-10


allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

starting media recovery

archive log thread 1 sequence 7 is already on disk as file


C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2010_09_27\O1_MF_1_7_6B0G5C2K_.ARC
archive log
filename=C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2010_09_27\O1_MF_1_7_6B0G5C2K_
.ARC thread=1 sequence=7
media recovery complete, elapsed time: 00:00:02
Finished recover at 27-SEP-10

contents of Memory Script:


{
shutdown clone;
startup clone nomount ;
}
executing Memory Script

36 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

after this is it restore all the file except redologs file in clone database
and after this it is not terminating.......
my clone db is in nomount stage....

guide me

help me pliz September 28, 2010 - 12am Central time zone Bookmark | Bottom | Top
Reviewer: neeraj from nepal

hello ...
pliz rply the above question ..
i m waiting 4 rply..

Followup September 28, 2010 - 8am Central time zone:

you'll be waiting for a long long time - writing in that fashion.

I cannot understand why a professional would communicate using the writing skills of a 12 year old (I am referring to your use of "texting"
as a language).

anyway...

I don't work on windows, not sure what this "it is not terminating" is about. It is at the point where it should be creating a new controlfile.

http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmdupdb.htm#sthref1818

The online redo logs would not be restored, you would do an alter database open resetlogs after a point in time recovery like that (and that
creates the logs). You should be able to just open the database with resetlogs now.

Please utilize support for this one.


October 26, 2010 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: Alexander
Tom,

I have a question about this:

</

http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/rcmdupdb.htm#i1006946/

>

What happens to the existing database files during this process? Let's say I ran it once successfully, then I wanted to run this regularly
from then on. The files will all be there next time, does RMAN overwrite them? Do they get deleted? I'm hoping I don't have to drop the
database every time.

Followup October 26, 2010 - 8pm Central time zone:

what existing datafiles?

You are taking an existing database - going to the backups of it and duplicating it to a new location.

the only existing datafiles are the ones of the existing database, and it is not touched.

October 27, 2010 - 8am Central time zone Bookmark | Bottom | Top
Reviewer: Alexander

You can run duplicate database against an existing database, if you initially created it by using
duplicate database.

http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/rcmdupdb.htm#i1006946

November 5, 2010 - 10am Central time zone Bookmark | Bottom | Top

37 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Reviewer: Alexander

Tom, did you see above? Where you aware of that? On a related note, I'm seeing inconsistent clone
times, it's much quicker when you run one a 2nd time, as if RMAN is smart enough to know nothing
has changed since the first clone.

Followup November 6, 2010 - 7pm Central time zone:

oh, with that it just overwrites. It pulls updated datafiles over:

<quote>
... The example uses the DUPLICATE DATABASE command to transfer complete copies of all updated datafiles from the source database
to the duplicate site. ...
</quote>
November 7, 2010 - 1am Central time zone Bookmark | Bottom | Top
Reviewer: Alexander

That's cool. Can you define "updated datafiles" though, does mean changes since the last
duplicate? That seems too good to be true, how would it know that.

Followup November 8, 2010 - 7am Central time zone:

it'll be pretty much everything with the exception of read only tablespaces (which will be pretty much the only thing not updated in the
database)
November 16, 2010 - 8am Central time zone Bookmark | Bottom | Top
Reviewer: Alexander
Tom,

When you are duplicating a database you have to use static listener registration for the listener correct? Is there anything special you have
to do vs dynamic to allow clients to connect? I can't for the life of me connect from my desktop using sqlplus.

This is the server's listener.ora + tnsnames, and my local entry:

(lx-cpora-t01k:oracle)> cat /oracle/product/11.2/network/admin/listener.ora


# listener.ora Network Configuration File: /oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = lx-cpora-t01k)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/11.2)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = OCP36T.LMIG.COM)
(ORACLE_HOME = /oracle/product/11.2)
)
(SID_DESC =
(SID_NAME = OCP37T.LMIG.COM)
(ORACLE_HOME = /oracle/product/10.2.0.3)
)
)

ADR_BASE_LISTENER = /oracle/product

/database/oracle
(lx-cpora-t01k:oracle)> cat /oracle/product/11.2/network/admin/tnsnames.ora

OCP36T =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = lx-cpora-t01k)(PORT = 1521))
)
(CONNECT_DATA =

38 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

(SERVICE_NAME = OCP36T.LMIG.COM)
)
)

OCP37T =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = lx-cpora-t01k)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = OCP37T.LMIG.COM)
)
)

OCP25X1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = x223kdc-v)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = OCP25X.LMIG.COM)
(INSTANCE_NAME = OCP25X1)
)
)

ocp37t =
(description =
(address_list =
(address =
(protocol = tcp)
(host = lx-cpora-t01k)
(port = 1521)) )
(connect_data =
(service_name = ocp37p.lmig.com) ) )

Followup November 17, 2010 - 5am Central time zone:

yes, static is used:

http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmdupdb.htm#sthref1819

you give no "symptoms" regarding your comment "I can't for the life of me connect from my desktop using sqlplus. " so it is hard to
diagnose

all of your tnsnames.ora entries seem to be using services - for a static connection, you'd use oracle_sid in the connect string, not a
service - since a service can only be registered with a listener after the database is up (and we are connecting in order to get the database
up).
November 17, 2010 - 4pm Central time zone Bookmark | Bottom | Top
Reviewer: Alexander

Are you saying my tnsnames on the server also needs to be using SID not a service?

By the way I'm jealous you are in Nuremburg. If I were you I'd rent a Porsche to take around the
Nuremburg track.

http://goeurope.about.com/od/germany/a/nurburgring.htm

Followup November 18, 2010 - 3am Central time zone:

your client needs to have a tnsnames with a sid in it.


December 1, 2010 - 10am Central time zone Bookmark | Bottom | Top
Reviewer: Alexander

Tom,

Is the an option when duplicating a database to tell it to remove the archivelogs it used from the
target when it's done?

December 28, 2010 - 2pm Central time zone Bookmark | Bottom | Top
Reviewer: Alexander

39 of 40 7/8/2011 1:54 AM
Ask Tom "db cloning -- what is it and why" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION...

Tom, do you have any suggestions about the best way to cleanup archivelogs after a duplicate? I
could add a step to do 'rm *' in my archlog directory, but I was hoping there was something a bit
cleaner than that. I tried cataloging them so I could blow them away via rman, but they have
different dbids.

Followup December 28, 2010 - 3pm Central time zone:

not that I'm aware of...


why must have an odd number of voting disks December 29, 2010 - 1am Central time zone
Bookmark | Bottom | Top
Reviewer: Ian

Hi Tom,
why must have an odd number of voting disks, such as three, five,and so on.
why not 2,4,6, and so on for voting disks.
Thanks

rman cloneing January 11, 2011 - 12pm Central time zone Bookmark | Bottom | Top
Reviewer: A reader
i did rman cloneing with different servers for catalog,target,auxilary.I took thr onlinr backup of taget database.When iam connected to 3
database in auxilary level its shows error like no backup of datafile 5,4...????????

rman duplicate July 1, 2011 - 6am Central time zone Bookmark | Bottom | Top
Reviewer: Michael from Switzerland

Hi Tom,

I've a project running on Oracle 10.2.0.4 enterprise edition.

The DEV1 database is refreshed on a recurring basis from PROD there. So, I got let's say DEV1 (dbid
1), DEV1 (dbid 2), DEV1 (dbid 3) and DEV1 (dbid 4) currently.

Development wants DEV2 to be equal to DEV1 (dbid 1) now. Is there a way to to this directly without
restoring DEV1 (dbid 1) before?

I know with Oracle 11g there is a new feature where it is not required to connect to the target
database anymore as there's a DBID clause with the duplicate command.

Cheers,
Michael

Write a Review

All information and materials provided here are provided "as-is"; Oracle disclaims all express and implied warranties, including, the implied warranties of merchantability or fitness
for a particular use. Oracle shall not be liable for any damages, including, direct, indirect, incidental, special or consequential damages for loss of profits, revenue, data or data
use, incurred by you or any third party in connection with the use of this information or these materials.

About Oracle | Legal Notices and Terms of Use | Privacy Statement

40 of 40 7/8/2011 1:54 AM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy