再次使用DGbroker做switchover主備切換

skyin_1603發表於2017-03-21

  由於一心想著使用DGbroker做一次完整的failover切換,所以我得首先配置一個DGbroker工具,這裡網路的配置過程
就省略了,因為在之前的配置中也詳細的有寫到。一下主要是配置broker工具的後續工作,並使用該工作簡單地做了一個
switchover主備庫之間的角色切換。真心感覺到,使用broker來作switchover切換比在sqlplus中作切換簡單多了,簡化了
很多的操作步驟,切換迅速。

--使用
DGbroker管理DG演練:
--登入broker工具並以sys使用者登入

[oracle@host01 ~]$ export ORACLE_SID=SBDB

[oracle@host01 ~]$ dgmgrl

DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

 

Copyright (c) 2000, 2009, Oracle. All rights reserved. 

Welcome to DGMGRL, type "help" for information.

DGMGRL> connect sys/oracle

Connected.

DGMGRL>

--建立configuration配置檔案:

DGMGRL> CREATE CONFIGURATION 'SBDB' as  PRIMARY DATABASE IS 'SBDB' CONNECT IDENTIFIER IS SBDB;

Configuration "SBDB" created with primary database "SBDB"

DGMGRL> SHOW CONFIGURATION


Configuration - SBDB

 

  Protection Mode: MaxPerformance

  Databases:

    SBDB - Primary database

 

Fast-Start Failover: DISABLED

 

Configuration Status:

DISABLED

--新增備庫的角色: 

DGMGRL> ADD DATABASE 'ORA11GR2' AS CONNECT IDENTIFIER IS ORA11GR2;

Database "ORA11GR2" added

DGMGRL>

--啟用CONFIGURATION配置檔案:

DGMGRL> ENABLE CONFIGURATION;

Enabled.

DGMGRL> SHOW CONFIGURATION;

 

Configuration - SBDB

 

  Protection Mode: MaxPerformance

  Databases:

    SBDB     - Primary database

    ORA11GR2 - Physical standby database

 

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

--啟用備庫:

DGMGRL> ENABLE DATABASE 'ORA11GR2';

Enabled.

DGMGRL>

--檢視備庫的狀態:

DGMGRL> SHOW DATABASE 'ORA11GR2';

Database - ORA11GR2

 

  Role:            PHYSICAL STANDBY

  Intended State:  APPLY-ON

  Transport Lag:   0 seconds (computed 1 second ago)

  Apply Lag:       0 seconds (computed 1 second ago)

  Apply Rate:      769.00 KByte/s

  Real Time Query: ON

  Instance(s):

    ORA11GR2

 

Database Status:

SUCCESS

 #當然類似地檢視主庫的狀態,還可以使用 SHOW DATABASE VERBOSE 'ORA11GR2'檢視更詳細的資訊。

----使用DGbroker切換主備庫之間的角色:

DGMGRL> switchover to 'ORA11GR2';   #這裡特別強調:to備庫名,有些版本不需加單引號括起,有些版本需要括起。

Performing switchover NOW, please wait...

Operation requires a connection to instance "ORA11GR2" on database "ORA11GR2"

Connecting to instance "ORA11GR2"...

Connected.

New primary database "ORA11GR2" is opening...

Operation requires startup of instance "SBDB" on database "SBDB"

Starting instance "SBDB"...

Unable to connect to database

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Failed.

Warning: You are no longer connected to ORACLE.

 

Please complete the following steps to finish switchover:

        start up instance "SBDB" of database "SBDB"

#這一次的切換跟我上一次的切換有所不一樣,上一次直切就可以切換過去了。但是沒有關係,沒有影響正常的切換,
跟著報出來的提示,去重新啟動提示到的例項就可以完成切換了。 

#切換成功。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2135703/,如需轉載,請註明出處,否則將追究法律責任。

相關文章