本文共 7963 字,大约阅读时间需要 26 分钟。
晚上花了很长时间用duplicate创建了一个DG。其实真个过程都是比较容易的,只是自己有些地方因为经常不小心搞错,导致花了比较久,简单记录下:
要注意db_name必须要一样。其中主库是orcl,备库是orcm。
主库的listener.ora设置
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = orcl) ) )
主库的initorcl.ora增加的内容
*.db_name='orcl'*.db_unique_name='orcl_pd'*.log_archive_config='dg_config=(orcl_pd,orcl_st)'*.log_archive_dest_1='location=/u01/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcl_pd'*.log_archive_dest_2='service=orcl_st reopen=120 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=orcl_st'*.log_archive_dest_state_1=enable*.log_archive_dest_state_2=enable*.standby_file_management='auto'*.fal_server='orcl_st'*.fal_client='orcl_pd'
备库的listener.ora设置
STENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcm) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = orcm) ) )
备库的initorcm.ora的设置
*.db_name=orcl*.control_files='/u01/app/oracle/oradata/orcm/control01.ctl', '/u01/app/oracle/oradata/orcm/control02.ctl','/u01/app/oracle/oradata/orcm/control03.ctl'*.db_unique_name='orcl_st'*.log_archive_config='dg_config=(orcl_pd,orcl_st)'*.log_archive_dest_1='location=/u01/archivelog valid_for=(all_logfiles,all_roles) db_unique_name=orcl_st'*.log_archive_dest_2='service=orcl_pd reopen=120 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=orcl_pd'*.log_archive_dest_state_1=enable*.log_archive_dest_state_2=enable*.standby_file_management='auto'*.fal_server='orcl_pd'*.fal_client='orcl_st'*.log_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcm'*.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcm'
主库和备库的tnsnames.ora设置
ORCL_ST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcm) ) ) ORCL_PD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )
最后贴一下成功的喜悦,希望可以帮助到大家:
Starting Duplicate Db at 18-JUN-13using target database control file instead of recovery catalogallocated channel: ORA_AUX_DISK_1channel ORA_AUX_DISK_1: SID=20 device type=DISKcontents of Memory Script:{ backup as copy reuse targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl' auxiliary format '/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcm' ;}executing Memory ScriptStarting backup at 18-JUN-13allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=41 device type=DISKFinished backup at 18-JUN-13contents of Memory Script:{ backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/orcm/control01.ctl'; restore clone controlfile to '/u01/app/oracle/oradata/orcm/control02.ctl' from '/u01/app/oracle/oradata/orcm/control01.ctl'; restore clone controlfile to '/u01/app/oracle/oradata/orcm/control03.ctl' from '/u01/app/oracle/oradata/orcm/control01.ctl';}executing Memory ScriptStarting backup at 18-JUN-13using channel ORA_DISK_1channel ORA_DISK_1: starting datafile copycopying standby control fileoutput file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f tag=TAG20130618T051238 RECID=2 STAMP=818399559channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03Finished backup at 18-JUN-13Starting restore at 18-JUN-13using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: copied control file copyFinished restore at 18-JUN-13Starting restore at 18-JUN-13using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: copied control file copyFinished restore at 18-JUN-13contents of Memory Script:{ sql clone 'alter database mount standby database';}executing Memory Scriptsql statement: alter database mount standby databasecontents of Memory Script:{ set newname for tempfile 1 to "/u01/app/oracle/oradata/orcm/temp01.dbf"; switch clone tempfile all; set newname for datafile 1 to "/u01/app/oracle/oradata/orcm/system01.dbf"; set newname for datafile 2 to "/u01/app/oracle/oradata/orcm/sysaux01.dbf"; set newname for datafile 3 to "/u01/app/oracle/oradata/orcm/undotbs01.dbf"; set newname for datafile 4 to "/u01/app/oracle/oradata/orcm/users01.dbf"; backup as copy reuse datafile 1 auxiliary format "/u01/app/oracle/oradata/orcm/system01.dbf" datafile 2 auxiliary format "/u01/app/oracle/oradata/orcm/sysaux01.dbf" datafile 3 auxiliary format "/u01/app/oracle/oradata/orcm/undotbs01.dbf" datafile 4 auxiliary format "/u01/app/oracle/oradata/orcm/users01.dbf" ; sql 'alter system archive log current';}executing Memory Scriptexecuting command: SET NEWNAMErenamed tempfile 1 to /u01/app/oracle/oradata/orcm/temp01.dbf in control fileexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting backup at 18-JUN-13using channel ORA_DISK_1channel ORA_DISK_1: starting datafile copyinput datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbfoutput file name=/u01/app/oracle/oradata/orcm/system01.dbf tag=TAG20130618T051251channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:02channel ORA_DISK_1: starting datafile copyinput datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbfoutput file name=/u01/app/oracle/oradata/orcm/sysaux01.dbf tag=TAG20130618T051251channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:37channel ORA_DISK_1: starting datafile copyinput datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbfoutput file name=/u01/app/oracle/oradata/orcm/undotbs01.dbf tag=TAG20130618T051251channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:36channel ORA_DISK_1: starting datafile copyinput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfoutput file name=/u01/app/oracle/oradata/orcm/users01.dbf tag=TAG20130618T051251channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03Finished backup at 18-JUN-13sql statement: alter system archive log currentcontents of Memory Script:{ switch clone datafile all;}executing Memory Scriptdatafile 1 switched to datafile copyinput datafile copy RECID=2 STAMP=818401498 file name=/u01/app/oracle/oradata/orcm/system01.dbfdatafile 2 switched to datafile copyinput datafile copy RECID=3 STAMP=818401498 file name=/u01/app/oracle/oradata/orcm/sysaux01.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=4 STAMP=818401498 file name=/u01/app/oracle/oradata/orcm/undotbs01.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=5 STAMP=818401498 file name=/u01/app/oracle/oradata/orcm/users01.dbfFinished Duplicate Db at 18-JUN-13
转载地址:http://ahnuo.baihongyu.com/