在同步復(fù)制中
一旦任意主體站點(diǎn)出現(xiàn)故障,數(shù)據(jù)庫(kù)將會(huì)出現(xiàn)問(wèn)題。
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>
此時(shí)DML操作不能進(jìn)行
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
簡(jiǎn)單的,我們可以移除出問(wèn)題的主體站點(diǎn)
SQL> exec dbms_repcat.remove_master_databases(gname => @#rep_tt@#,master_list => @#TESTORA9.HURRAY.COM.CN@#);PL/SQL procedure successfully completed
此后DML操作可以繼續(xù):
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
如果故障站點(diǎn)修復(fù)之后,需要重新加入復(fù)制組,可以先在故障站點(diǎn)刪除復(fù)制組:
SQL> exec dbms_repcat.drop_master_repgroup(gname => @#rep_tt@#,drop_contents => false,all_sites => false)PL/SQL procedure successfully completed
然后在主體定義站點(diǎn)重新加入該主體站點(diǎn):
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>
此時(shí)復(fù)制恢復(fù)正常。
接下來(lái)你需要解決的是數(shù)據(jù)沖突,可以參考:使用 dbms_rectifier_diff解決高級(jí)復(fù)制中的數(shù)據(jù)沖突問(wèn)題
一旦任意主體站點(diǎn)出現(xiàn)故障,數(shù)據(jù)庫(kù)將會(huì)出現(xiàn)問(wèn)題。
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>
此時(shí)DML操作不能進(jìn)行
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
簡(jiǎn)單的,我們可以移除出問(wèn)題的主體站點(diǎn)
SQL> exec dbms_repcat.remove_master_databases(gname => @#rep_tt@#,master_list => @#TESTORA9.HURRAY.COM.CN@#);PL/SQL procedure successfully completed
此后DML操作可以繼續(xù):
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
如果故障站點(diǎn)修復(fù)之后,需要重新加入復(fù)制組,可以先在故障站點(diǎn)刪除復(fù)制組:
SQL> exec dbms_repcat.drop_master_repgroup(gname => @#rep_tt@#,drop_contents => false,all_sites => false)PL/SQL procedure successfully completed
然后在主體定義站點(diǎn)重新加入該主體站點(diǎn):
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>
此時(shí)復(fù)制恢復(fù)正常。
接下來(lái)你需要解決的是數(shù)據(jù)沖突,可以參考:使用 dbms_rectifier_diff解決高級(jí)復(fù)制中的數(shù)據(jù)沖突問(wèn)題