0% found this document useful (0 votes)
59 views

Duplicate A Database Using RMAN in Oracle Database 11g - R2

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

Duplicate A Database Using RMAN in Oracle Database 11g - R2

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

Duplicate a Database Using RMAN in Oracle Database

11g Release 2
This article is an update of a previous Oracle 9i article.
Introduction
Backup-Based Duplication
Active Database Duplication
Related articles.
Direct NF !DNF" #lonedb in Oracle Database $$% Release & !'atchset $$.&.(.&"
Introduction
R)AN has the abilit* to duplicate+ or clone+ a database fro, a backup or fro, an active
database. It is possible to create a duplicate database on a re,ote server -ith the sa,e file
structure+ a re,ote server -ill a different file structure or the local server -ith a different file
structure.
The article assu,es the duplicate database is bein% created on a separate server+ usin% the
sa,e ID !DB$$." and the sa,e file structure as the source database. /0planations of several
other scenarios are available here.
Backup-Based Duplication
#reate a backup of the source database+ if a suitable one doesn1t alread* e0ist.
$ rman target=/
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> BACKUP DATABASE PLUS ARCI!ELOG
All subse2uent actions occur on the server runnin% the duplicate database.
#reate a pass-ord file for the duplicate instance.
$ "ra#$% &'(e=/)*+/a##/"ra,(e/#r"%),t/++-.-*/%/0+/%/1/"ra#$DB++G
#a11$"r%=#a11$"r% entr'e1=+*
Add the appropriate entries into the 3tnsna,es.ora3 file in the 34ORA#5/67O)/8net-ork8ad,in3
director* to allo- connections to the tar%et database fro, the duplicate server.
2 A%%e% t" t3e tn1name1-"ra
DB++G4SOURCE =
5DESCRIPTION =
5ADDRESS0LIST =
5ADDRESS = 5PROTOCOL = TCP65OST = "(74++.4%)#+65PORT = +7.+66
6
5CONNECT0DATA =
5ORACLE0SID = DB++G6
6
6
#reate a 'FI5/ for the duplicate database. ince -e are duplicatin% the database onto a
separate server -ith the sa,e files*ste, as the ori%inal+ -e don1t need to convert the file na,es.
In this case+ the 'FI5/ is called 3initDB$$..ora3 and is placed in the 34ORA#5/67O)/8dbs3
director*.
2 M'n'm)m Re8)'rement-
DB0NAME=DB++G
2 C"n9ert &'(e name1 t" a(("$ &"r %'&&erent %'re,t"r: 1tr),t)re '&
ne,e11ar:-
2DB0FILE0NAME0CON!ERT=;/)*+/a##/"ra,(e/"ra%ata/DB++G/;<;/)*+/a##/"ra,(e/
"ra%ata/NE=SID/;
2LOG0FILE0NAME0CON!ERT=;/)*+/a##/"ra,(e/"ra%ata/DB++G/;<;/)*./a##/"ra,(e
/"ra%ata/NE=SID/;
9e don1t need all the other para,eters as the clone -ill cop* the 'FI5/ fro, the pri,ar*
database. If *ou are duplicatin% a database on the sa,e ,achine *ou -ill probabl* need to
create a 'FFI5/8'FI5/ ,anuall* fro, the pri,ar* database 'FI5/+ ,anuall* chan%e the
values and avoid the 'FI5/ clause in the duplicate co,,and.
#reate an* directories necessar* for start the duplicate database.
$ m>%'r 4# /)*+/a##/"ra,(e/"ra%ata/DB++G
$ m>%'r 4# /)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G
$ m>%'r 4# /)*+/a##/"ra,(e/a%m'n/DB++G/a%)m#
)ake the backup files fro, the source database available to the destination server. That can be
done b* either cop*in% the, to the ,atchin% location on the destination server+ or placin% the,
on a shared drive. If *ou are cop*in% the files+ *ou ,a* -ant to use the follo-in% t*pe of
co,,ands.
$ 1,# 4r "ra,(e?"(74++.4
%)#+@/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G/ar,3'9e("g
/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G
$ 1,# 4r "ra,(e?"(74++.4
%)#+@/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G//a,>)#1et
/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G
$ 1,# 4r "ra,(e?"(74++.4
%)#+@/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G/a)t"/a,>)#
/)*+/a##/"ra,(e/&a1t0re,"9er:0area/DB++G
#onnect to the duplicate instance.
$ ORACLE0SID=DB++G; eA#"rt ORACLE0SID
$ 18(#()1 / a1 1:1%/a
tart the database in NOMOUNT ,ode.
SBL> STARTUP NOMOUNT;
9ith the duplicate database started -e can no- connect to it fro, R)AN. For the duplication to
-ork -e ,ust connect to the duplicate database !A:;I5IAR<"+ but dependin% on the t*pe of
duplication -e are doin% -e ,a* optionall* connect to the ori%inal database !TAR./T" and8or the
recover* catalo% !#ATA5O.".
$ ORACLE0SID=DB++G; eA#"rt ORACLE0SID
$ rman AUCILIARD /
$ rman TARGET 1:1/#a11$"r%?DB++G4SOURCE AUCILIARD /
$ rman CATALOG rman/#a11$"r%?rman4,ata("g AUCILIARD /
$ rman TARGET 1:1/#a11$"r%?DB++G4SOURCE CATALOG rman/#a11$"r%?rman4
,ata("g AUCILIARD /
9e can then duplicate the database usin% one of the follo-in% co,,ands. Re,e,ber+ re,ove
the 'FI5/ clause if *ou have ,anuall* created a full 'FI5/ or 'FI5/.
2 Ba,>)# &'(e1 are 'n mat,3'ng (",at'"n t" t3at "n t3e 1")r,e 1er9er-
2 D)#(',ate %ata/a1e t" TARGET;1 ,)rrent 1tate-
DUPLICATE TARGET DATABASE TO DB++G
SPFILE
NOFILENAMECECK;
2 D)#(',ate %ata/a1e t" TARGET;1 1tate E %a:1 ag"-
DUPLICATE TARGET DATABASE TO DB++G
UNTIL TIME ;SDSDATE4E;
SPFILE
NOFILENAMECECK;
2 Ba,>)# &'(e1 are 'n a %'&&erent (",at'"n t" t3at "n t3e 1")r,e 1er9er-
2 D)#(',ate %ata/a1e t" t3e m"1t re,ent 1tate #"11'/(e )1'ng t3e
#r"9'%e% /a,>)#1-
2 ="r>1 $'t3 F)1t an AUCILIARD ,"nne,t'"n "n(:-
DUPLICATE DATABASE TO DB++G
SPFILE
BACKUP LOCATION ;/1")r,e/a##/"ra,(e/&a1t0re,"9er:0area/DB++G;
NOFILENAMECECK;
The ti,e it takes to co,plete varies dependin% on the si=e of the database and the specification
of the server. Once the process is finished R)AN produces a co,pletion ,essa%e and *ou have
*our duplicate instance.
Active Database Duplication
Oracle $$% introduced the abilit* to create duplicate databases directl* -ithout the need for a
backup. This is kno-n as active database duplication. The process is si,ilar to the backup-based
duplication+ -ith a fe- e0ceptions.
First+ and ,ost obviousl*+ *ou don1t need a backup of the source s*ste,+ but it does have to be
in ARCI!ELOG ,ode.
The pass-ords in the pass-ord files ,ust ,atch for both servers+ so re,e,ber to set the correct
pass-ord -hen creatin% the pass-ord file on the destination server.
Both the source and destination database servers re2uire a 3tnsna,es.ora3 entr* for the
destination database. In this case I added the follo-in% to each server. The destination server still
re2uires the source entr* sho-n in the previous section.
2 A%%e% t" t3e tn1name1-"ra "n 1")r,e an% %e1t'nat'"n 1er9er-
DB++G4DESTINATION =
5DESCRIPTION =
5ADDRESS0LIST =
5ADDRESS = 5PROTOCOL = TCP65OST = "(74++.4%)#.65PORT = +7.+66
6
5CONNECT0DATA =
5ORACLE0SID = DB++G6
6
6
The destination server re2uires static listener confi%uration in a 3listener.ora3 file. In this case I
used the follo-in% confi%uration. Re,e,ber to restart or reload the listener.
SID0LIST0LISTENER =
5SID0LIST =
5SID0DESC =
5GLOBAL0DBNAME = DB++G-=ORLD6
5ORACLE0OME = /)*+/a##/"ra,(e/#r"%),t/++-.-*/%/0+6
5SID0NAME = DB++G6
6
6
LISTENER =
5DESCRIPTION0LIST =
5DESCRIPTION =
5ADDRESS = 5PROTOCOL = TCP65OST = "(74++.4%)#.-(",a(%"ma'n65PORT
= +7.+66
6
5DESCRIPTION =
5ADDRESS = 5PROTOCOL = IPC65KED = ECTPROC+7.+66
6
6
ADR0BASE0LISTENER = /)*+/a##/"ra,(e
9hen connectin% to R)AN+ *ou ,ust use a connect strin% for both the tar%et and au0iliar*
connections.
$ ORACLE0SID=DB++G; eA#"rt ORACLE0SID
$ rman TARGET 1:1/#a11$"r%?DB++G4SOURCE AUCILIARD 1:1/#a11$"r%?DB++G4
DESTINATION
Include the FROM ACTI!E DATABASE clause in the DUPLICATE co,,and.
DUPLICATE DATABASE TO DB++G
FROM ACTI!E DATABASE
SPFILE
NOFILENAMECECK;

You might also like