高级复制中如何应对主体站点故障

高级复制中如何应对主体站点故障

作者: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         Beijing

6 rows selected

SQL> 

此时DML操作不能进行
SQL> insert into scott.dept values (36,'Oracle','Beijing');

insert into scott.dept values (36,'Oracle','Beijing')

ORA-02068: following severe error from TESTORA9
ORA-03113: end-of-file on communication channel
ORA-02068: following severe error from TESTORA9
ORA-03113: end-of-file on communication channel

SQL> 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 inserted

SQL> COMMIT;

Commit complete

SQL> 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 completed

SQL> 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 completed

SQL> execute dbms_repcat.resume_master_activity('rep_tt',true);

PL/SQL procedure successfully completed

SQL> 

此时复制恢复正常。
接下来你需要解决的是数据冲突,可以参考: 使用 dbms_rectifier_diff解决高级复制中的数据冲突问题

你可能感兴趣的:(oracle,sql,Blog)