更改全局数据库名可能导致前期的复制组删除不掉

在高级复制中,ORACLE使用全局数据库名来唯一区分复制环境中的不同的站点。
如果更改了全局数据库名,将会报ORA-23313错误导致以前创建的复制组删除不掉。

SQL> show parameter  global_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
global_names                         boolean                TRUE
SQL> select * from global_name;

GLOBAL_NAME
------------------------------------------------------------------
YANSP

SQL> exec dbms_repcat.create_master_repgroup(gname=>'MG_YAN');

PL/SQL procedure successfully completed.

SQL> SELECT GNAME,STATUS FROM DBA_REPGROUP;

GNAME      STATUS
---------- ------------------
MG_YAN     QUIESCED

SQL> select gname,dblink,masterdef,snapmaster,master from dba_repsites;

GNAME      DBLINK     MA SN MA
---------- ---------- -- -- --
MG_YAN     YANSP      Y     Y

此处的DBLINK列的值将会和全局数据库名称一致。

SQL> CONN / AS SYSDBA
Connected.
SQL> ALTER DATABASE RENAME GLOBAL_NAME TO TEST;

Database altered.

SQL> SELECT * FROM GLOBAL_NAME;

GLOBAL_NAME
----------------------------------------------------------------------------------------------------
TEST

SQL> CONN REPADMIN/REPADMIN
Connected.
SQL> EXEC DBMS_REPCAT.DROP_MASTER_REPGROUP(GNAME=>'MG_YAN');
BEGIN DBMS_REPCAT.DROP_MASTER_REPGROUP(GNAME=>'MG_YAN'); END;

*
ERROR at line 1:
ORA-23313: object group "PUBLIC"."MG_YAN" is not mastered at TEST
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_REPCAT_UTL4", line 2869
ORA-06512: at "SYS.DBMS_REPCAT_MAS", line 2660
ORA-06512: at "SYS.DBMS_REPCAT", line 635
ORA-06512: at line 1


SQL> CONN / AS SYSDBA
Connected.
SQL> ALTER DATABASE RENAME GLOBAL_NAME TO YANSP;

Database altered.

SQL> SELECT * FROM GLOBAL_NAME;

GLOBAL_NAME
----------------------------------------------------------------------------------------------------
YANSP

SQL> CONN REPADMIN/REPADMIN
Connected.
SQL>  EXEC DBMS_REPCAT.DROP_MASTER_REPGROUP(GNAME=>'MG_YAN');

PL/SQL procedure successfully completed.

SQL> SELECT GNAME,STATUS FROM DBA_REPGROUP;

no rows selected

SQL>

作者: TOMSYAN   发布时间: 2010-09-03