強制刪除DG BROKER信息

   由於之前的switchover失敗,後手工恢復了錯誤。導致 dg broker的配置文件顯示的是錯誤的,db131現在已經是備庫了,而dg broker配置文件還是顯示是primary database.

 主備庫看到的錯誤是不一樣的,db131配置信息顯示 db132是主庫,db132顯示的db131是主庫。

DB131:

DGMGRL> show configuration;

Configuration - dg_test11

  Protection Mode: MaxPerformance
  Databases:
    db132 - Primary database
    db131 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
ORA-16597: Data Guard broker detects two or more primary databases
ORA-16625: cannot reach database "db132"
DGM-17017: unable to determine configuration status

DB132:

DGMGRL> show configuration;

Configuration - dg_test11

  Protection Mode: MaxPerformance
  Databases:
    db131 - Primary database
    db132 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
ORA-16623: database detected role change
ORA-16625: cannot reach database "db131"
DGM-17017: unable to determine configuration status

數據庫實際的情況是這樣的:

DB131:

SQL> select database_role,db_unique_name,open_mode,protection_mode,protection

DATABASE_ROLE    DB_UNIQUE_NAME                 OPEN_MODE
---------------- ------------------------------ --------------------
PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS
-------------------- -------------------- --------------------
PHYSICAL STANDBY db131                          READ ONLY WITH APPLY
MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  NOT ALLOWED


DB132:

SQL> select database_role,db_unique_name,open_mode,protection_mode,protection_level,switchover_status from v$database;

DATABASE_ROLE    DB_UNIQUE_NAME                 OPEN_MODE
---------------- ------------------------------ --------------------
PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS
-------------------- -------------------- --------------------
PRIMARY          db132                          READ WRITE
MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  TO STANDBY

試着disable database,失敗。

DGMGRL> disable database db131
Error: ORA-16623: database detected role change
Error: ORA-16625: cannot reach database "db131"

Failed.
DGMGRL> disable database db132
Error: ORA-16623: database detected role change
Error: ORA-16625: cannot reach database "db131"

Failed.

只能暴力刪除了,手動刪除主庫的dg broker配置的原文件,文件存放的目標可以通過show parameter dg_broker來查看。主備都需要

[oracle@qht131 dbs]$ mv dr1db131.dat dr1db131.dat_bak
[oracle@qht131 dbs]$ mv dr2db131.dat dr2db131.dat_bak

 將dg_broker_start關閉後重新開啓,主備都需要

SQL>  alter system set dg_broker_start=false scope=both;

System altered.

SQL> alter system set dg_broker_start=true  scope=both;

System altered.

這時再看dg broker的配置信息:

DGMGRL> show  configuration;
ORA-16532: Data Guard broker configuration does not exist

根據目前 主從庫的實際情況重新建立dg broker的配置,主庫是db132,從庫是db131:

DGMGRL> create configuration dg_test11 as primary database is db132 connect identifier is orcl132;
Configuration "dg_test11" created with primary database "db132"

DGMGRL> add database db131 as connect identifier is orcl131 maintained as physical;
Database "db131" added

DGMGRL> show configuration;

Configuration - dg_test11

  Protection Mode: MaxPerformance
  Databases:
    db132 - Primary database
    db131 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

狀態是DISABLED,需要enable一下:

DGMGRL> enable configuration;
Enabled.
DGMGRL>  show configuration;

Configuration - dg_test11

  Protection Mode: MaxPerformance
  Databases:
    db132 - Primary database
    db131 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

試着進行一次switchover:

DGMGRL> switchover to db131
Performing switchover NOW, please wait...
New primary database "db131" is opening...
Operation requires shutdown of instance "orcl" on database "db132"
Shutting down instance "orcl"...
ORA-01031: insufficient privileges

Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
        shut down instance "orcl" of database "db132"
        start up instance "orcl" of database "db132"

重啓一下db132後一切正常了。

不過不太清楚這樣強制刪除dg broker配置對數據庫有沒有什麼影響。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章