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

« 初始化参数-LOG_PARALLELISM | Blog首页 | 高级复制中如何应对主体站点故障 »

在高级复制中如何切换主体定义站点

这是一个同步复制环境,在同步复制中,任何一个站点Down掉都会导致数据库服务中断。

1.停掉主体定义站点(CONNER.HURRAY.COM.CN)

[oracle@jumper oracle]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Feb 17 16:07:26 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

2.登陆主体站点(TESTORA9.HURRAY.COM.CN)
SQL> select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        60 ORACLE         BEIJING
        70 oracle         beijing

6 rows selected.

此时主体站点上对于扶植对象的任何DML操作都不能进行了。
SQL> insert into dept values(80,'oracle','beijing');
insert into dept values(80,'oracle','beijing')
*
ERROR at line 1:
ORA-02068: following severe error from CONNER
ORA-03113: end-of-file on communication channel
ORA-02068: following severe error from CONNER
ORA-03113: end-of-file on communication channel

3.使用复制管理员登陆主体站点

如果此时尝试删除复制对象,打破复制关系都会收到错误。
ORA-23312说明这不是主体定义站点。
SQL> connect repadmin/repadmin                                                                
Connected.
SQL> exec DBMS_REPCAT.DROP_MASTER_REPOBJECT(sname => 'scott',oname => 'dept',type => 'table');
BEGIN DBMS_REPCAT.DROP_MASTER_REPOBJECT(sname => 'scott',oname => 'dept',type => 'table'); END;

*
ERROR at line 1:
ORA-23312: not the masterdef according to TESTORA9.HURRAY.COM.CN
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_REPCAT_UTL4", line 2928
ORA-06512: at "SYS.DBMS_REPCAT_UTL4", line 2720
ORA-06512: at "SYS.DBMS_REPCAT", line 643
ORA-06512: at line 1

4.使用DBMS_REPCAT.RELOCATE_MASTERDEF切换主体定义站点

SQL> BEGIN
  2  DBMS_REPCAT.RELOCATE_MASTERDEF (
  3        gname => 'rep_tt',
  4        old_masterdef => 'CONNER.HURRAY.COM.CN',
  5        new_masterdef => 'TESTORA9.HURRAY.COM.CN',
  6        notify_masters => TRUE,
  7        include_old_masterdef => FALSE);
  8  END;
  9  /

PL/SQL procedure successfully completed.

5.把原主体定义站点(CONNER.HURRAY.COM.CN)从主体库中删除

SQL> execute dbms_repcat.remove_master_databases(gname=>'rep_tt',master_list=>'CONNER.HURRAY.COM.CN');

PL/SQL procedure successfully completed.

6.复制关系打破以后,DML操作得以继续
SQL> connect scott/tiger
Connected.
SQL> select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        60 ORACLE         BEIJING
        70 oracle         beijing

6 rows selected.

SQL> insert into dept values (80,'oracle','beijing');

1 row created.

SQL> commit;

Commit complete.

SQL> 

7.如果原站点恢复正常后,可以再次添加到复制组中。

历史上的今天...
    >> 2009-02-17文章:
    >> 2008-02-17文章:
    >> 2007-02-17文章:
    >> 2006-02-17文章:
           EMC CX500最后一次扩容
           扩展Oracle10gR2 ASM磁盘空间

无觅

By eygle on 2005-02-17 17:40 | Comments (3) | Advanced | 183 |

3 Comments

测试中系统有两个站点,定义站和主站,在定义站损坏后,在主站站点上切换定义主站为它自身,结果报自身不为定义站点,不能更改.我的环境是定义站是9I,主站是10G,不知你测试时是否真的可行,还是因我数据版本的问题.

操作失误,实际为可用

那就好:)

高级复制很多时候会出一堆头痛的错误,需要信心认真排查。


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