Oracle 11g Data Guard 使用duplicate from active database 创建 standby database(二)

2015-01-21 12:17:34 · 作者: · 浏览: 15
racle/oradata/dave/control03.ctl'


*.db_unique_name='sanfus'


*.log_archive_config='dg_config=(sanfup,sanfus)'


*.log_archive_dest_1='location=/u01/archivelog valid_for=(standby_logfile, standby_role) db_unique_name=sanfus'


*.log_archive_dest_2='service=sanfup reopen=120 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=sanfup'


*.log_archive_dest_state_1=enable


*.log_archive_dest_state_2=enable


*.standby_file_management='auto'


*.fal_server='sanfup'


*.fal_client='sanfus'


*.log_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/dave'


*.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/dave'


?


4. 用pfile 将standby 启动到nomount状态:


SQL> startup nomount pfile=?/dbs/initorcl.ora


ORACLE instance started.


?


Total System Global Area? 146472960 bytes


Fixed Size? ? ? ? ? ? ? ? ? 1335080 bytes


Variable Size? ? ? ? ? ? ? 92274904 bytes


Database Buffers? ? ? ? ? 50331648 bytes


Redo Buffers? ? ? ? ? ? ? ? 2531328 bytes


?


5. 开始duplicate


?


[oracle@qs-dmm-rh2 dbs]$ rman target sys/oracle@sanfup auxiliary sys/oracle@sanfus


?


Recovery Manager: Release 11.2.0.1.0 - Production on Tue Mar 8 16:10:25 2011


?


Copyright (c) 1982, 2009, Oracle and/or its affiliates.? All rights reserved.


?


connected to target database: ORCL (DBID=1272955137)


connected to auxiliary database: ORCL (not mounted)


?


RMAN> duplicate target database for standby from active database;


?


Starting Duplicate Db at 08-MAR-11


using target database control file instead of recovery catalog


allocated channel: ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: SID=20 device type=DISK


?


contents of Memory Script:


{


? backup as copy reuse


? targetfile? '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl' auxiliary format


?'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl'? ;


--用duplicate 创建standby 时会复制口令文件


}


executing Memory Script


?


Starting backup at 08-MAR-11


allocated channel: ORA_DISK_1


channel ORA_DISK_1: SID=45 device type=DISK


Finished backup at 08-MAR-11


?


contents of Memory Script:


{


? backup as copy current controlfile for standby auxiliary format? '/u01/app/oracle/oradata/dave/control01.ctl';


? restore clone controlfile to? '/u01/app/oracle/oradata/dave/control02.ctl' from


?'/u01/app/oracle/oradata/dave/control01.ctl';


? restore clone controlfile to? '/u01/app/oracle/oradata/dave/control03.ctl' from


?'/u01/app/oracle/oradata/dave/control01.ctl';


--创建控制文件


}


executing Memory Script


?


Starting backup at 08-MAR-11


using channel ORA_DISK_1


channel ORA_DISK_1: starting datafile copy


copying standby control file


output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f tag=TAG20110308T161152 RECID=4 STAMP=745258313


channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03


Finished backup at 08-MAR-11


?


Starting restore at 08-MAR-11


using channel ORA_AUX_DISK_1


?


channel ORA_AUX_DISK_1: copied control file copy


Finished restore at 08-MAR-11


?


Starting restore at 08-MAR-11


using channel ORA_AUX_DISK_1


?


channel ORA_AUX_DISK_1: copied control file copy


Finished restore at 08-MAR-11


?


contents of Memory Script:


{


? sql clone 'alter database mount standby database';


--将备库启动到mount standby


}


executing Memory Script


?


sql statement: alter database mount standby database


?


contents of Memory Script:


{


? set newname for tempfile? 1 to


?"/u01/app/oracle/oradata/dave/temp01.dbf";


? switch c