高级|站点
高级复制中如何应对主体站点故障作者:eygle出处:http://blog.eygle.com日期:February 18, 2005
« 在高级复制中如何切换主体定义站点 | Blog首页 | 自己动手,丰衣足食 »
在同步复制中
一旦任意主体站点出现故障,数据库将会出现问题。
SQL> select * from scott.dept;DEPTNO DNAME LOC------ -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON 33 ORACLE beijing 35 Oracle Beijing6 rows selectedSQL>
此时DML操作不能进行
SQL> insert into scott.dept values (36,'Oracle','Beijing');insert into scott.dept values (36,'Oracle','Beijing')ORA-02068: following severe error from TESTORA9ORA-03113: end-of-file on communication channelORA-02068: following severe error from TESTORA9ORA-03113: end-of-file on communication channelSQL> select gname,dblink,masterdef from dba_repsites;GNAME DBLINK MASTERDEF ------------------------------ ----------------------------------REP_TT CONNER.HURRAY.COM.CN Y REP_TT TESTORA9.HURRAY.COM.CN N
简单的,我们可以移除出问题的主体站点
SQL> exec dbms_repcat.remove_master_databases(gname => 'rep_tt',master_list => 'TESTORA9.HURRAY.COM.CN');PL/SQL procedure successfully completed
此后DML操作可以继续:
SQL> insert into scott.dept values (36,'Oracle','Beijing');1 row insertedSQL> COMMIT;Commit completeSQL> select gname,dblink,masterdef from dba_repsites;GNAME DBLINK MASTERDEF ------------------------------ ----------------------------------REP_TT CONNER.HURRAY.COM.CN Y
如果故障站点修复之后,需要重新加入复制组,可以先在故障站点删除复制组:
SQL> exec dbms_repcat.drop_master_repgroup(gname => 'rep_tt',drop_contents => false,all_sites => false)PL/SQL procedure successfully completed
然后在主体定义站点重新加入该主体站点:
SQL> exec dbms_repcat.suspend_master_activity(gname => 'rep_tt')PL/SQL procedure successfully completedSQL> execute dbms_repcat.add_master_database(gname=>'rep_tt', master=>'TESTORA9.HURRAY.COM.CN',use_existing_objects=>true, copy_rows=>false, propagation_mode => 'synchronous');PL/SQL procedure successfully completedSQL> execute dbms_repcat.resume_master_activity('rep_tt',true);PL/SQL procedure successfully completedSQL>
此时复制恢复正常。
接下来你需要解决的是数据冲突,可以参考:使用 dbms_rectifier_diff解决高级复制中的数据冲突问题