You are on page 1of 9

Active database Clonning

++++++++++++++++++++++++
You Dont need to take a backup of Source database rman will do everything
RMAN> run
2> {
3> allocate auxiliary channel c1 device type disk;
4> allocate channel c2 device type disk;
5> duplicate target database to 'CLONE' from ACTIVE DATABASE;
6> }

-bash-3.2$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 00:30:59
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wai
t...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network
/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/rohit/listener/aler
t/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rohit.oracle.com)(PORT=1
521)))
TNS-01192: Missing SID_LIST_ value left of equation for SID description in LISTE
NER.ORA
Listener failed to start. See the error message(s) above...
For Active clonning or standby database u need to configure in ur tnsname.ora pa
rameter (UR=A) and configure ur
listerner files properly
Like This:
++++++++++
Prod Server
+++++++++++
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.130)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =

(SID_NAME =PROD)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(GLOBAL_DBNAME =PROD)
)
)

Tnsname.ORA
++++++++++++
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
)
CLONE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CLONE)
)
)

CLONE or Target Server


+++++++++++++++++++++++
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.129)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME =CLONE)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(GLOBAL_DBNAME =CLONE)
)
)
ADR_BASE_LISTENER = /home/oracle/app/oracle

Tnsname.ORA
++++++++++++
CLONE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = CLONE)(UR=A)
)
)
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.171.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = PROD)
)
)
Now remember on Target Database (SERVICE_NAME = CLONE)(UR=A) u have to add this
Parameter: (UR=A)
now

RMAN> connect auxiliary sys/sys@CLONE


connected to auxiliary database: CLONE (not mounted)
RMAN> connect target sys/sys@PROD
connected to target database: PROD (DBID=233097709)
RMAN> run
2> {
3> allocate auxiliary channel c1 device type disk;
4> allocate channel c2 device type disk;
5> duplicate target database to 'CLONE' from ACTIVE DATABASE;
6> }

using target database control file instead of recovery catalog


allocated channel: c1
channel c1: SID=19 device type=DISK
allocated channel: c2
channel c2: SID=37 device type=DISK
Starting Duplicate Db at 26-JUL-13

contents of Memory Script:


{
sql clone "alter system set db_name =
''PROD'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''CLONE'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/home/oracle/app/oracle
/oradata/CLONE/control01.ctl';
restore clone controlfile to '/home/oracle/app/oracle/flash_recovery_area/CL
ONE/control02.ctl' from
'/home/oracle/app/oracle/oradata/CLONE/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''PROD'' comment= ''Modified by RMAN
duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''CLONE'' comment= ''Modified
by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area

422670336 bytes

Fixed Size
1336960
Variable Size
281020800
Database Buffers
134217728
Redo Buffers
6094848
allocated channel: c1
channel c1: SID=18 device type=DISK

bytes
bytes
bytes
bytes

Starting backup at 26-JUL-13


channel c2: starting datafile copy
copying current control file
output file name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD
.f tag=TAG20130726T010652 RECID=1 STAMP=821754414
channel c2: datafile copy complete, elapsed time: 00:00:03
Finished backup at 26-JUL-13
Starting restore at 26-JUL-13
channel c1: copied control file copy
Finished restore at 26-JUL-13
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/home/oracle/app/oracle/oradata/CLONE/system01.dbf";
set newname for datafile 2 to
"/home/oracle/app/oracle/oradata/CLONE/sysaux01.dbf";

set newname for datafile 3 to


"/home/oracle/app/oracle/oradata/CLONE/undotbs01.dbf";
set newname for datafile 4 to
"/home/oracle/app/oracle/oradata/CLONE/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/home/oracle/app/oracle/oradata/CLONE/system01.dbf" datafile
2 auxiliary format
"/home/oracle/app/oracle/oradata/CLONE/sysaux01.dbf" datafile
3 auxiliary format
"/home/oracle/app/oracle/oradata/CLONE/undotbs01.dbf" datafile
4 auxiliary format
"/home/oracle/app/oracle/oradata/CLONE/users01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 26-JUL-13
channel c2: starting datafile copy
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/PROD/syste
m01.dbf
output file name=/home/oracle/app/oracle/oradata/CLONE/system01.dbf tag=TAG20130
726T010701
channel c2: datafile copy complete, elapsed time: 00:00:45
channel c2: starting datafile copy
input datafile file number=00002 name=/home/oracle/app/oracle/oradata/PROD/sysau
x01.dbf
output file name=/home/oracle/app/oracle/oradata/CLONE/sysaux01.dbf tag=TAG20130
726T010701
channel c2: datafile copy complete, elapsed time: 00:00:35
channel c2: starting datafile copy
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/PROD/undot
bs01.dbf
output file name=/home/oracle/app/oracle/oradata/CLONE/undotbs01.dbf tag=TAG2013
0726T010701
channel c2: datafile copy complete, elapsed time: 00:00:07
channel c2: starting datafile copy
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/PROD/users
01.dbf
output file name=/home/oracle/app/oracle/oradata/CLONE/users01.dbf tag=TAG201307
26T010701
channel c2: datafile copy complete, elapsed time: 00:00:01
Finished backup at 26-JUL-13
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "/home/oracle/app/oracle/flash_recovery_area/PROD/archivelog
/2013_07_26/o1_mf_1_26_8z4cn09c_.arc" auxiliary format
"/home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_26/o1_mf_

1_26_%u_.arc" ;
catalog clone recovery area;
switch clone datafile all;
}
executing Memory Script
Starting backup at 26-JUL-13
channel c2: starting archived log copy
input archived log thread=1 sequence=26 RECID=23 STAMP=821754512
output file name=/home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/20
13_07_26/o1_mf_1_26_0goflukh_.arc RECID=0 STAMP=0
channel c2: archived log copy complete, elapsed time: 00:00:01
Finished backup at 26-JUL-13
searching for all files in the recovery area
List of Files Unknown to the Database
=====================================
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
26/o1_mf_1_26_0goflukh_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_2_8yolmnz5_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_3_8yolmqy4_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_1_8yolmn02_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
25/o1_mf_1_4_8z3yol4k_.arc
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
26/o1_mf_1_26_0goflukh_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_2_8yolmnz5_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_3_8yolmqy4_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
20/o1_mf_1_1_8yolmn02_.arc
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_
25/o1_mf_1_4_8z3yol4k_.arc
List of files in Recovery Area not managed by the database
==========================================================
File Name: /home/oracle/app/oracle/flash_recovery_area/CLONE/control02.ctl
RMAN-07526: Reason: File is not an Oracle Managed File
number of files not managed by recovery area is 1, totaling 9.28MB
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=821754516 file name=/home/oracle/app/oracle/or
adata/CLONE/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=821754516 file name=/home/oracle/app/oracle/or
adata/CLONE/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=821754516 file name=/home/oracle/app/oracle/or
adata/CLONE/undotbs01.dbf

datafile 4 switched to datafile copy


input datafile copy RECID=4 STAMP=821754516 file name=/home/oracle/app/oracle/or
adata/CLONE/users01.dbf
contents of Memory Script:
{
set until scn 854485;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-JUL-13
starting media recovery
archived log for thread 1 with sequence 26 is already on disk as file /home/orac
le/app/oracle/flash_recovery_area/CLONE/archivelog/2013_07_26/o1_mf_1_26_0gofluk
h_.arc
archived log file name=/home/oracle/app/oracle/flash_recovery_area/CLONE/archive
log/2013_07_26/o1_mf_1_26_0goflukh_.arc thread=1 sequence=26
media recovery complete, elapsed time: 00:00:01
Finished recover at 26-JUL-13
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''CLONE'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area

422670336 bytes

Fixed Size
1336960
Variable Size
281020800
Database Buffers
134217728
Redo Buffers
6094848
allocated channel: c1
channel c1: SID=18 device type=DISK

bytes
bytes
bytes
bytes

sql statement: alter system set db_name = ''CLONE'' comment= ''Reset to origin
al value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile

Oracle instance shut down


connected to auxiliary database (not started)
Oracle instance started
Total System Global Area

422670336 bytes

Fixed Size
1336960 bytes
Variable Size
281020800 bytes
Database Buffers
134217728 bytes
Redo Buffers
6094848 bytes
allocated channel: c1
channel c1: SID=18 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONE" RESETLOGS
G
MAXLOGFILES
16
MAXLOGMEMBERS
3
MAXDATAFILES
100
MAXINSTANCES
8
MAXLOGHISTORY
292
LOGFILE
GROUP 1 ( '/home/oracle/app/oracle/oradata/CLONE/redo01.log' ) SIZE
SE,
GROUP 2 ( '/home/oracle/app/oracle/oradata/CLONE/redo02.log' ) SIZE
SE,
GROUP 3 ( '/home/oracle/app/oracle/oradata/CLONE/redo03.log' ) SIZE
SE
DATAFILE
'/home/oracle/app/oracle/oradata/CLONE/system01.dbf'
CHARACTER SET WE8MSWIN1252

ARCHIVELO

50 M REU
50 M REU
50 M REU

contents of Memory Script:


{
set newname for tempfile 1 to
"/home/oracle/app/oracle/oradata/CLONE/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/home/oracle/app/oracle/oradata/CLONE/sysaux01.d
bf",
"/home/oracle/app/oracle/oradata/CLONE/undotbs01.dbf",
"/home/oracle/app/oracle/oradata/CLONE/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/app/oracle/oradata/CLONE/temp01.dbf in contro
l file
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/CLONE/sysaux01.dbf RECID
=1 STAMP=821754537
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/CLONE/undotbs01.dbf RECI
D=2 STAMP=821754537
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/CLONE/users01.dbf RECID=
3 STAMP=821754537

datafile 2 switched to datafile copy


input datafile copy RECID=1 STAMP=821754537 file name=/home/oracle/app/oracle/or
adata/CLONE/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=821754537 file name=/home/oracle/app/oracle/or
adata/CLONE/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=821754537 file name=/home/oracle/app/oracle/or
adata/CLONE/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database
Finished
released
released
RMAN>
Enjoy :)

opened
Duplicate Db at 26-JUL-13
channel: c2
channel: c1

You might also like