Active Cloning Using R Man
Active Cloning Using R Man
Document Display
In this Document Purpose Scope Details Basic Steps to ACTIVE database duplication : References
Applies to:
Oracle Server - Enterprise Edition - Version 11.1.0.6 and later Information in this document applies to any platform.
Purpose
The scope of this bulletin is to discuss the different type of RMAN 'duplicate database' feature in Oracle 11G. This note is only applicable for oracle 11g only. In case you may want or need more about your current topic - please also access the Backup & Recover Community of Customers and Oracle Specialists directly via: https://communities.oracle.com/portal/server.pt/community/database_backup_and_recovery/243
If you want to DUPLICATE FOR STANDBY, than check Note 1075908.1 Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE
Scope
This note is intended for DBAs and Support Personnel.
Details
You can create a duplicate database using the RMAN duplicate command. The duplicate database has a different DBID from the source database and functions entirely independently.Starting from 11g you can do duplicate database in 2 ways. 1. Active database duplication 2. Backup-based duplication Active database duplication copies the live target database over the network to the auxiliary destination and then creates the duplicate database.Only difference is that you don't need to have the pre-existing RMAN backups and copies.The duplication work is performed by an auxiliary channel.This channel corresponds to a server session on the auxiliary instance on the auxiliary host. As part of the duplicating operation, RMAN automates the following steps: 1. 2. 3. 4. Creates a control file for the duplicate database Restarts the auxiliary instance and mounts the duplicate control file Creates the duplicate datafiles and recovers them with incremental backups and archived redo logs. Opens the duplicate database with the RESETLOGS option
For the active database duplication, RMAN does one extra step .i.e. copy the target database datafiles over the network to the auxiliary instance A RAC TARGET database can be duplicated as well. The procedure is the same as below. If the auxiliary instance needs to be a RAC-database as well, than start the duplicate procedure for to a single instance and convert the auxiliary to RAC after the duplicate has succeeded. Scope of this note is restricted to Active database duplication . For the Backup-base duplication refer Note 259694.1 Oracle10G RMAN Database Duplication.
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
the target database.Also you can specify the PASSWORD FILE option on the DUPLICATE command.In this case, RMAN copies the source database password file to the destination host
1/6
10/16/12
Document Display
the target database.Also you can specify the PASSWORD FILE option on the DUPLICATE command.In this case, RMAN copies the source database password file to the destination host and overwrites any existing password file for the auxiliary instance. In this bulletin we are using password file option in the duplicate command . 1.3 Establish Oracle Net Connectivity to the Auxiliary Instance Auxiliary instance must be available through Oracle Net if you are duplicating from an ACTIVE database. 1.4 Start the Auxiliary instance from Sqlplus Use SQL*Plus to connect to the auxiliary instance and start it in NOMOUNT mode. STEP S In Auxiliary server : 1. Create the parameter file . Look at the example :
i n i t T E S T . o r a D B _ N A M E = T E S T d i a g n o s t i c _ d e s t = ' E : \ o r a c l e ' D B _ F I L E _ n a m e _ C O N V E R T = ( ' I : \ a p p \ a p a d h i \ o r a d a t a \ a m a r ' , ' E : \ o r a c l e \ o r a d a t a \ t e s t ' ) L O G _ F I L E _ N A M E _ C O N V E R T = (' I : \ a p p \ a p a d h i \ o r a d a t a \ a m a r ' , ' E : \ o r a c l e \ o r a d a t a \ t e s t ' ) S G A _ T A R G E T = 2 6 2 1 4 4 0 0 0 C O N T R O L _ F I L E S = ' E : \ o r a c l e \ o r a d a t a \ T E S T \ c o n t r o l 0 1 . d b f ' C O M P A T I B L E =1 1 . 1 . 0 . 0 . 0
2. Create the database service ( only for windows ) and password file . Look at the example :
%s e tO R A C L E _ S I D = T E S T %s e tO R A C L E _ H O M E = E : \ o r a c l e \ p r o d u c t \ 1 1 . 1 . 0 \ d b _ 1 %o r a d i mN E WS I DT E S T %o r a p w dF I L E = E : \ o r a c l e \ p r o d u c t \ 1 1 . 1 . 0 \ d b _ 1 \ d a t a b a s e \ P W D T E S T . o r aP A S S W O R D = s y s
For unix/Linux no need to create the service. Rest other steps are same.
4. Create the necessary oracle NET connectivity in the listener.ora and the tnsnames.ora file. Look at the example :
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
2/6
10/16/12
Document Display
# #F o rt h eA u x i l i a r yd a t a b a s eT E S T# # T E S T= ( D E S C R I P T I O N= ( A D D R E S S=( P R O T O C O L=T C P ) ( H O S T=a p a d h i i d c ) ( P O R T=1 5 2 1 ) ) ( C O N N E C T _ D A T A= ( S E R V E R=D E D I C A T E D ) ( S E R V I C E _ N A M E=T E S T ) ) ) # #F o rt h et a r g e td a t a b a s eA M A R# # A M A R= ( D E S C R I P T I O N= ( A D D R E S S=( P R O T O C O L=T C P ) ( H O S T=1 5 2 . 6 9 . 2 1 0 . 7 6 ) ( P O R T=1 5 2 1 ) ) ( C O N N E C T _ D A T A= ( S E R V E R=D E D I C A T E D ) ( S E R V I C E _ N A M E=A M A R ) ) ) # #S i m i l a r ya d de n t r yf o rt h ec a t a l o gd a t a b a s e(O p t i o n a l )
Confirm the connection to both the target and the auxiliary instance using sqlplus. In this example we are creating the duplicate database from the Auxiliary server.
E x e c u t eo nt h eT A R G E Ta n dA U X I L I A R Yh o s t %t n s p i n gA M A R %t n s p i n gT E S T
2. Start RMAN and Connect to the Database Instances Start RMAN and connect to the source database as TARGET, the duplicate database instance as AUXILIARY, and, if applicable, the recovery catalog database.You can start the RMAN client on any host so long as it can connect to all of the database instances. If the auxiliary instance requires a text-based initialization parameter file, then this file must exist on the same host that runs the RMAN client application. In this bulletin we are doing duplicate database from the auxiliary server. Look at the example :
%r m a n R e c o v e r yM a n a g e r :R e l e a s e1 1 . 1 . 0 . 6 . 0-P r o d u c t i o no nW e dA u g12 1 : 0 6 : 4 92 0 0 7 C o p y r i g h t( c )1 9 8 2 ,2 0 0 7 ,O r a c l e .A l lr i g h t sr e s e r v e d . R M A N >c o n n e c tT A R G E Ts y s/s y s@A M A R ; # #T a r g e td a t a b a s e# # c o n n e c t e dt ot a r g e td a t a b a s e :A M A R( D B I D = 1 4 5 0 8 3 8 1 8 7 ) R M A N >c o n n e c tA U X I L I A R Ys y s/s y s@T E S T; # #A u x i l i a r yd a t a b a s e# # c o n n e c t e dt oa u x i l i a r yd a t a b a s e :T E S T( n o tm o u n t e d ) R M A N >c o n n e c tC A T A L O Gr m a n/r m a n@C A T;# #C a t a l o gd a t a b a s e. O p t i o n a l# # c o n n e c t e dt or e c o v e r yc a t a l o gd a t a b a s e
3. Run the DUPLICATE database command : The simplest case is to use active database duplication to duplicate the database to a different host and use the different directory structure.Look at the example : This example assumes This example assumes the following: * * * * * Using a recovery catalog. The target database is on host1 and contains 4 datafiles. Duplicate the target to database TEST on the different host having different file structure. Tablespace USERS in target is read-only tablespace. Running duplicate database from the Auxiliary site.
S t a r t i n gD u p l i c a t eD ba t0 2 A U G 0 7 u s i n gt a r g e td a t a b a s ec o n t r o lf i l ei n s t e a do fr e c o v e r yc a t a l o g a l l o c a t e dc h a n n e l :O R A _ A U X _ D I S K _ 1 c h a n n e lO R A _ A U X _ D I S K _ 1 :S I D = 9 7d e v i c et y p e = D I S K c o n t e n t so fM e m o r yS c r i p t : { s e tn e w n a m ef o rd a t a f i l e s e tn e w n a m ef o rd a t a f i l e s e tn e w n a m ef o rd a t a f i l e s e tn e w n a m ef o rd a t a f i l e
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
3/6
10/16/12
Document Display
b a c k u pa sc o p yr e u s e d a t a f i l e 1a u x i l i a r yf o r m a t " E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S T E M 0 1 . D B F " d a t a f i l e 2a u x i l i a r yf o r m a t " E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S A U X 0 1 . D B F " d a t a f i l e 3a u x i l i a r yf o r m a t " E : \ O R A C L E \ O R A D A T A \ T E S T \ U N D O T B S 0 1 . D B F " d a t a f i l e 4a u x i l i a r yf o r m a t " E : \ O R A C L E \ O R A D A T A \ T E S T \ U S E R S 0 1 . D B F " ; s q l' a l t e rs y s t e ma r c h i v el o gc u r r e n t ' ;
} e x e c u t i n gM e m o r yS c r i p t e x e c u t i n gc o m m a n d :S E TN E W N A M E e x e c u t i n gc o m m a n d :S E TN E W N A M E e x e c u t i n gc o m m a n d :S E TN E W N A M E e x e c u t i n gc o m m a n d :S E TN E W N A M E S t a r t i n gb a c k u pa t0 2 A U G 0 7 a l l o c a t e dc h a n n e l :O R A _ D I S K _ 1 c h a n n e lO R A _ D I S K _ 1 :S I D = 1 2 3d e v i c et y p e = D I S K c h a n n e lO R A _ D I S K _ 1 :s t a r t i n gd a t a f i l ec o p y i n p u td a t a f i l ef i l en u m b e r = 0 0 0 0 1n a m e = I : \ A P P \ A P A D H I \ O R A D A T A \ A M A R \ S Y S T E M 0 1 . D B F o u t p u tf i l en a m e = E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S T E M 0 1 . D B Ft a g = T A G 2 0 0 7 0 8 0 2 T 1 1 4 2 5 4R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :d a t a f i l ec o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 8 : 2 2 c h a n n e lO R A _ D I S K _ 1 :s t a r t i n gd a t a f i l ec o p y i n p u td a t a f i l ef i l en u m b e r = 0 0 0 0 2n a m e = I : \ A P P \ A P A D H I \ O R A D A T A \ A M A R \ S Y S A U X 0 1 . D B F o u t p u tf i l en a m e = E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S A U X 0 1 . D B Ft a g = T A G 2 0 0 7 0 8 0 2 T 1 1 4 2 5 4R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :d a t a f i l ec o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 5 : 5 9 c h a n n e lO R A _ D I S K _ 1 :s t a r t i n gd a t a f i l ec o p y i n p u td a t a f i l ef i l en u m b e r = 0 0 0 0 3n a m e = I : \ A P P \ A P A D H I \ O R A D A T A \ A M A R \ U N D O T B S 0 1 . D B F o u t p u tf i l en a m e = E : \ O R A C L E \ O R A D A T A \ T E S T \ U N D O T B S 0 1 . D B Ft a g = T A G 2 0 0 7 0 8 0 2 T 1 1 4 2 5 4R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :d a t a f i l ec o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 2 : 5 7 c h a n n e lO R A _ D I S K _ 1 :s t a r t i n gd a t a f i l ec o p y i n p u td a t a f i l ef i l en u m b e r = 0 0 0 0 4n a m e = I : \ A P P \ A P A D H I \ O R A D A T A \ A M A R \ U S E R S 0 1 . D B F o u t p u tf i l en a m e = E : \ O R A C L E \ O R A D A T A \ T E S T \ U S E R S 0 1 . D B Ft a g = T A G 2 0 0 7 0 8 0 2 T 1 1 4 2 5 4R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :d a t a f i l ec o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 0 : 1 5 F i n i s h e db a c k u pa t0 2 A U G 0 7 s q ls t a t e m e n t :a l t e rs y s t e ma r c h i v el o gc u r r e n t s q ls t a t e m e n t :C R E A T EC O N T R O L F I L ER E U S ES E TD A T A B A S E" T E S T "R E S E T L O G SA R C H I V E L O G M A X L O G F I L E S 1 6 M A X L O G M E M B E R S 3 M A X D A T A F I L E S 1 0 0 M A X I N S T A N C E S 8 M A X L O G H I S T O R Y 2 9 2 L O G F I L E G R O U P 1(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 1 . L O G ')S I Z E5 0M R E U S E , G R O U P 2(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 2 . L O G ')S I Z E5 0M R E U S E , G R O U P 3(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 3 . L O G ')S I Z E5 0M R E U S E D A T A F I L E ' E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S T E M 0 1 . D B F ' C H A R A C T E RS E TA L 3 2 U T F 8 c o n t e n t so fM e m o r yS c r i p t : { b a c k u pa sc o p yr e u s e a r c h i v e l o gl i k e " I : \ A P P \ A P A D H I \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1 "a u x i l i a r yf o r m a t " E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1 " a r c h i v e l o gl i k e " I : \ A P P \ A P A D H I \ F L A S H _ R E C O V E R Y _ A R E A \ A M A R \ A R C H I V E L O G \ 2 0 0 7 _ 0 8 _ 0 2 \ O 1 _ M F _ 1 _ 4 2 _ 3 C 2 Y J N P 7 _ . A R C "a u x i l i a r yf o r m a t " E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1 " ; c a t a l o gc l o n ea r c h i v e l o g " E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1 " ; c a t a l o gc l o n ea r c h i v e l o g " E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1 " ; s w i t c hc l o n ed a t a f i l ea l l ; } e x e c u t i n gM e m o r yS c r i p t S t a r t i n gb a c k u pa t0 2 A U G 0 7 u s i n gc h a n n e lO R A _ D I S K _ 1 c h a n n e lO R A _ D I S K _ 1 :s t a r t i n ga r c h i v e dl o gc o p y i n p u ta r c h i v e dl o gt h r e a d = 1s e q u e n c e = 4 2R E C I D = 3 5S T A M P = 6 2 9 5 5 3 6 4 6 o u t p u tf i l en a m e = E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :a r c h i v e dl o gc o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 0 : 0 1 c h a n n e lO R A _ D I S K _ 1 :s t a r t i n ga r c h i v e dl o gc o p y i n p u ta r c h i v e dl o gt h r e a d = 1s e q u e n c e = 4 2R E C I D = 3 6S T A M P = 6 2 9 5 5 3 6 4 6 o u t p u tf i l en a m e = E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1R E C I D = 0S T A M P = 0 c h a n n e lO R A _ D I S K _ 1 :a r c h i v e dl o gc o p yc o m p l e t e ,e l a p s e dt i m e :0 0 : 0 0 : 0 1 F i n i s h e db a c k u pa t0 2 A U G 0 7 c a t a l o g e da r c h i v e dl o g a r c h i v e dl o gf i l en a m e = E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1R E C I D = 1S T A M P = 6 2 9 5 5 3 8 0 0 c a t a l o g e da r c h i v e dl o g a r c h i v e dl o gf i l en a m e = E : \ O R A C L E \ P R O D U C T \ 1 1 . 1 . 0 \ D B _ 1 \ R D B M S \ A R C 0 0 0 4 2 _ 0 6 2 9 0 6 1 5 4 7 . 0 0 1R E C I D = 2S T A M P = 6 2 9 5 5 3 8 0 0 d a t a f i l e2s w i t c h e dt od a t a f i l ec o p y i n p u td a t a f i l ec o p yR E C I D = 1S T A M P = 6 2 9 5 5 3 8 0 0f i l en a m e = E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S A U X 0 1 . D B F
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
4/6
10/16/12
Document Display
F i x e dS i z e 1 3 3 2 5 4 4b y t e s V a r i a b l eS i z e 8 3 8 8 8 8 3 2b y t e s D a t a b a s eB u f f e r s 1 7 1 9 6 6 4 6 4b y t e s R e d oB u f f e r s 6 4 5 1 2 0 0b y t e s s q ls t a t e m e n t :C R E A T EC O N T R O L F I L ER E U S ES E TD A T A B A S E" T E S T "R E S E T L O G SA R C H I V E L O G M A X L O G F I L E S 1 6 M A X L O G M E M B E R S 3 M A X D A T A F I L E S 1 0 0 M A X I N S T A N C E S 8 M A X L O G H I S T O R Y 2 9 2 L O G F I L E G R O U P 1(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 1 . L O G ')S I Z E5 0M R E U S E , G R O U P 2(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 2 . L O G ')S I Z E5 0M R E U S E , G R O U P 3(' E : \ O R A C L E \ O R A D A T A \ T E S T \ R E D O 0 3 . L O G ')S I Z E5 0M R E U S E D A T A F I L E ' E : \ O R A C L E \ O R A D A T A \ T E S T \ S Y S T E M 0 1 . D B F ' C H A R A C T E RS E TA L 3 2 U T F 8
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
5/6
10/16/12
Document Display
References
https://support.oracle.com/epmos/faces/ui/km/SearchDocDisplay.jspx?_adf.ctrl-state=laqx642w7_69
6/6