This Post is to Duplicate database from Active database.
Visit to
To Duplicate database from Active database for standby
| Target | Auxiliary |
| SERVER | DGP | DGS |
| DATABASE | DGP | DGS |
| LISTENER | LISTENER_TESTDGP ON 1521 | LISTENER_TESTDGS ON 1524 |
| SID_LIST_LISTENER_TESTDGP =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = DGP)
(SID_NAME = DGP)
(ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
)
)
LISTENER_TESTDGP =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.173 )(PORT = 1521))
)
)
| SID_LIST_LISTENER_TESTDGS =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DB_NAME=DGS)
(SID_NAME = DGS)
(ORACLE_HOME = /u00/app/oracle/product/11.2.0/db_1)
)
)
LISTENER_TESTDGS =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.176 )(PORT = 1524))
)
)
|
========================================================================
NOTE: You must set LOCAL_LISTENER parameter in PFILE and enter Listener Defination in tsnames.ora.
if your listener is not running on default port. MAKE STATIC REGISTRATION OF AUXILIARY INSTANCE in LISTENER.
Test connection make sure if you can connect and restart Auxiliary instance from Target server.
If it fails to connect auxiliary instance use (UR=A) in your tnsentry ,as showed below.
========================================================================
--tnsnames.ora on Target side
DGP=(description=(address=(protocol=tcp)(host= 192.168.80.173 )(port=1521))(connect_data=(SERVER=DEDICATED)(SID=DGP)))
DGD=(description=(address=(protocol=tcp)(host=192.168.80.177 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGD)))
DGS=(description=(address=(protocol=tcp)(host=192.168.80.176 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGS)(UR=A)))
--tnsnames.ora on Auxilary side
DGP=(description=(address=(protocol=tcp)(host= 192.168.80.173 )(port=1521))(connect_data=(SERVER=DEDICATED)(SID=DGP)))
DGS=(description=(address=(protocol=tcp)(host=192.168.80.176 )(port=1524))(connect_data=(SERVER=DEDICATED)(service_name=DGS)(UR=A) ))
LISTENER_TESTDGS =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.176 )(PORT = 1524))
)
)
========================================================================
LOCATION
TARGET SIDE.
--DATAFILES
/u01/dgp/data/users01.dbf
/u01/dgp/data/undotbs01.dbf
/u01/dgp/data/sysaux01.dbf
/u01/dgp/data/system01.dbf
/u01/dgp/data/TEST.dbf
--REDOLOG
/u01/dgp/redo/redo03.log
/u01/dgp/redo/redo02.log
/u01/dgp/redo/redo01.log
--OTHER PARAMETERS
audit_file_dest='/u00/app/oracle/admin/DGP/adump'
audit_trail='DB'
compatible='11.2.0.0.0'
control_files='/u01/dgp/control/control01.ctl'
control_files='/u01/dgp/control/control02.ctl'
core_dump_dest='/u00/app/oracle/diag/rdbms/dgp/DGP/cdump'
db_block_size=8192
db_domain=''
db_name='DGP'
db_recovery_file_dest='/u00/app/oracle/admin/dgp/flashback'
db_recovery_file_dest_size=1000M
diagnostic_dest='/u00/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=DGPXDB)'
remote_login_passwordfile='EXCLUSIVE'
result_cache_max_size=672K
log_archive_dest_1 LOCATION=/u00/app/oracle/admin/DGP/arch
========================================================================
Password File
Copy password file of target database to auxiliary database and rename Accordigly.
========================================================================
Lets Duplicate.
Note : if you Invoke RMAN from Auxiliary server. you can connect "rman target sys/system@DGP auxiliary /"
TESTDGS:DGS:/u00/app/oracle/product/11.2.0/db_1/dbs::rman target sys/system@DGP auxiliary=sys/system@DGS
connected to target database: DGP (DBID=1579930627)
connected to auxiliary database: DGS (not mounted)
Below is RMAN run block to duplicate.
RMAN>>
run
{
allocate channel prmy1 type disk;
allocate auxiliary channel stby1 type disk;
duplicate target database to DGS from active database
spfile
parameter_value_convert '/dgp','/dgs','/DGP','/DGS'
set db_file_name_convert='dgp','dgs'
set log_file_name_convert='dgp','dgs'
set local_listener='LISTENER_TESTDGS'
set log_archive_dest_1='';
}
RMAN
using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=33 device type=DISK
allocated channel: stby1
channel stby1: SID=18 device type=DISK
Starting Duplicate Db at 18-JAN-12
contents of Memory Script:
{
backup as copy reuse
targetfile '/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGP.ora' auxiliary format
'/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora' ;
sql clone "alter system set spfile= ''/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora''";
}
executing Memory Script
Starting backup at 18-JAN-12
Finished backup at 18-JAN-12
sql statement: alter system set spfile= ''/u00/app/oracle/product/11.2.0/db_1/dbs/spfileDGS.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''DGS'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set audit_file_dest =
''/u00/app/oracle/admin/DGS/adump'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''/u01/dgs/control/control01.ctl'', ''/u01/dgs/control/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set db_recovery_file_dest =
''/u00/app/oracle/admin/dgs/flashback'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''dgp'', ''dgs'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''dgp'', ''dgs'' comment=
'''' scope=spfile";
sql clone "alter system set local_listener =
''LISTENER_TESTDGS'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
'''' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''DGS'' comment= ''duplicate'' scope=spfile
sql statement: alter system set audit_file_dest = ''/u00/app/oracle/admin/DGS/adump'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''/u01/dgs/control/control01.ctl'', ''/u01/dgs/control/control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set db_recovery_file_dest = ''/u00/app/oracle/admin/dgs/flashback'' comment= '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''dgp'', ''dgs'' comment= '''' scope=spfile
sql statement: alter system set log_file_name_convert = ''dgp'', ''dgs'' comment= '''' scope=spfile
sql statement: alter system set local_listener = ''LISTENER_TESTDGS'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_1 = '''' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 263049216 bytes
Fixed Size 2212448 bytes
Variable Size 205524384 bytes
Database Buffers 50331648 bytes
Redo Buffers 4980736 bytes
allocated channel: stby1
channel stby1: SID=1 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''DGP'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DGS'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/u01/dgs/control/control01.ctl';
restore clone controlfile to '/u01/dgs/control/control02.ctl' from
'/u01/dgs/control/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''DGP'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''DGS'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 263049216 bytes
Fixed Size 2212448 bytes
Variable Size 205524384 bytes
Database Buffers 50331648 bytes
Redo Buffers 4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK
Starting backup at 18-JAN-12
channel prmy1: starting datafile copy
copying current control file
output file name=/u00/app/oracle/product/11.2.0/db_1/dbs/snapcf_DGP.f tag=TAG20120118T192934 RECID=1 STAMP=772918185
channel prmy1: datafile copy complete, elapsed time: 00:00:16
Finished backup at 18-JAN-12
Starting restore at 18-JAN-12
channel stby1: copied control file copy
Finished restore at 18-JAN-12
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/u01/dgs/data/system01.dbf";
set newname for datafile 2 to
"/u01/dgs/data/sysaux01.dbf";
set newname for datafile 3 to
"/u01/dgs/data/undotbs01.dbf";
set newname for datafile 4 to
"/u01/dgs/data/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/dgs/data/system01.dbf" datafile
2 auxiliary format
"/u01/dgs/data/sysaux01.dbf" datafile
3 auxiliary format
"/u01/dgs/data/undotbs01.dbf" datafile
4 auxiliary format
"/u01/dgs/data/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 18-JAN-12
channel prmy1: starting datafile copy
input datafile file number=00001 name=/u01/dgp/data/system01.dbf
output file name=/u01/dgs/data/system01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:56
channel prmy1: starting datafile copy
input datafile file number=00002 name=/u01/dgp/data/sysaux01.dbf
output file name=/u01/dgs/data/sysaux01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:01:05
channel prmy1: starting datafile copy
input datafile file number=00003 name=/u01/dgp/data/undotbs01.dbf
output file name=/u01/dgs/data/undotbs01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:16
channel prmy1: starting datafile copy
input datafile file number=00004 name=/u01/dgp/data/users01.dbf
output file name=/u01/dgs/data/users01.dbf tag=TAG20120118T192955
channel prmy1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 18-JAN-12
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "/u00/app/oracle/admin/DGP/arch/1_27_772639109.dbf" auxiliary format
"/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_%u_.arc" ;
catalog clone recovery area;
switch clone datafile all;
}
executing Memory Script
Starting backup at 18-JAN-12
channel prmy1: starting archived log copy
input archived log thread=1 sequence=27 RECID=12 STAMP=772918348
output file name=/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc RECID=0 STAMP=0
channel prmy1: archived log copy complete, elapsed time: 00:00:15
Finished backup at 18-JAN-12
searching for all files in the recovery area
List of Files Unknown to the Database
===========================
File Name: /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=772918375 file name=/u01/dgs/data/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=772918375 file name=/u01/dgs/data/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=772918375 file name=/u01/dgs/data/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=772918375 file name=/u01/dgs/data/users01.dbf
contents of Memory Script:
{
set until scn 992279;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 18-JAN-12
starting media recovery
archived log for thread 1 with sequence 27 is already on disk as file /u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc
archived log file name=/u00/app/oracle/admin/dgs/flashback/DGS/archivelog/2012_01_18/o1_mf_1_27_06n13j2d_.arc thread=1 sequence=27
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-JAN-12
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''DGS'' 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 263049216 bytes
Fixed Size 2212448 bytes
Variable Size 205524384 bytes
Database Buffers 50331648 bytes
Redo Buffers 4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK
sql statement: alter system set db_name = ''DGS'' comment= ''Reset to original 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 263049216 bytes
Fixed Size 2212448 bytes
Variable Size 205524384 bytes
Database Buffers 50331648 bytes
Redo Buffers 4980736 bytes
allocated channel: stby1
channel stby1: SID=19 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DGS" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/dgs/redo/redo01.log' ) SIZE 5 M REUSE,
GROUP 2 ( '/u01/dgs/redo/redo02.log' ) SIZE 5 M REUSE,
GROUP 3 ( '/u01/dgs/redo/redo03.log' ) SIZE 5 M REUSE
DATAFILE
'/u01/dgs/data/system01.dbf'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/dgs/data/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/dgs/data/sysaux01.dbf",
"/u01/dgs/data/undotbs01.dbf",
"/u01/dgs/data/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/dgs/data/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u01/dgs/data/sysaux01.dbf RECID=1 STAMP=772918523
cataloged datafile copy
datafile copy file name=/u01/dgs/data/undotbs01.dbf RECID=2 STAMP=772918523
cataloged datafile copy
datafile copy file name=/u01/dgs/data/users01.dbf RECID=3 STAMP=772918523
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=772918523 file name=/u01/dgs/data/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=772918523 file name=/u01/dgs/data/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=772918523 file name=/u01/dgs/data/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 18-JAN-12
released channel: prmy1
released channel: stby1
RMAN> exit
========================================================================
ERRORS
========================================================================
error: (most common error while doing duplicate)
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12528: TNS:listener: all appropriate instances are blocking new connections
ORA-17629: Cannot connect to the remote database server
solution : Make static registration of instance in listener.ADD (SERVICE_NAME = AUXLIARY_DB) (UR=A) TO YOUR TARGET SERVER's tnsnames entry combination of both is must.
error:
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
solution: Add tns entries on both side.
error:
RMAN-05501: aborting duplication of target database
RMAN-05517: tempfile /u01/TEST11/temp01.dbf conflicts with file used by target database
solution: USE set newname for tempfile 1 to '/u01/dgs/data/temp11.dbf';
error
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server
solution: connect to target as rman target sys/system@DGP