eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 在高级复制中如何切换主体定义站点 | 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解决高级复制中的数据冲突问题


历史上的今天...
    >> 2011-02-18文章:
    >> 2008-02-18文章:
    >> 2006-02-18文章:
           涛声帆影 崖门曾战酣

无觅

By eygle on 2005-02-18 11:27 | Comments (0) | Advanced | 184 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com