Oracle 11g dg broker自動failover
Oracle 11g dg broker自動failover驗證:
db2主庫:
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PRIMARY READ WRITE
db1為standby
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY
db2主庫模擬異常關閉
SQL> shu abort
ORACLE instance shut down.
再次檢視db1的狀態:
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PRIMARY READ WRITE
四:自動切換的過程:
4.1:測試大概需要10秒observer去探測到主庫發生故障!
DGMGRL> start observer;
Observer started
20:15:59.44 Thursday, July 04, 2019
Initiating Fast-Start Failover to database "db2"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "db2"
20:16:01.77 Thursday, July 04, 2019
4.2 failover的過程和手工failover一樣,不管是自動failver,還是手動執行FAILOVER TO ,都是執行了用命令列failover的命令如下兩條命令:
alter database recover managed standby database finish force;---停止rfs程式
alter database commit to switchover to primary;---由open到mount
alter database open; ----read write 方式開啟
發生failover的時候,透過如下可以看到確實是這麼個過程
1).開始狀態: rfs和mrp程式都正常
SQL> select process,status ,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
--------- ------------ ----------
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CLOSING 14
RFS IDLE 0
RFS IDLE 15
RFS IDLE 0
MRP0 APPLYING_LOG 15
8 rows selected.
2).rsf程式消失
SQL> select process,status ,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
--------- ------------ ----------
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CLOSING 14
MRP0 APPLYING_LOG 15
3).資料庫變成了mounted
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY
MOUNTED
4)資料庫變成open write了
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PRIMARY READ WRITE
4.3:手動執行failover;
DGMGRL> help failover
Changes a standby database to be the primary database
Syntax:
FAILOVER TO <standby database name> [IMMEDIATE];
當發生failover的之後:
檢視 configuration的狀態:發現原來的主庫
needs to be reinstated,需要使用REINSTATE命令修復下,才能變成新的主庫的從庫!
DGMGRL> show configuration
Configuration - dbha_c
Protection Mode: MaxPerformance
Databases:
db2 - Primary database
Warning: ORA-16829: fast-start failover configuration is lagging
db1 - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
首先啟動原來的主庫到mount狀態:
SQL> startup mount
DGMGRL> help reinstate
Changes a database marked for reinstatement into a viable standby
Syntax:
REINSTATE DATABASE <database name>;
DGMGRL> REINSTATE DATABASE db1
Reinstating database "db1", please wait...
Reinstatement of database "db1" succeeded
再次檢視原來的主庫:
SQL> select process,status ,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
--------- ------------ ----------
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CLOSING 5
RFS IDLE 0
RFS IDLE 0
RFS IDLE 0
RFS IDLE 6
MRP0 APPLYING_LOG 6
實際上reinstate就是執行了下面的過程:
如果要轉換原來的主庫為新的備庫
要求原先的主庫必須開啟了flashbackup database的功能,在failover後,
1.檢視從庫failover成為主的時候的scn號。
SQL> select STANDBY_BECAME_PRIMARY_SCN from v$database;
STANDBY_BECAME_PRIMARY_SCN
--------------------------
15468
2.閃回原來的主庫到15468 的scn號;
SQL>FLASHBACK DATABASE TO SCN 15468 ;
Database altered.
3.在原來主庫執行切換:
SQL> alter database convert to physical standby ;
Database altered.
4.關閉原來的主庫
SQL>shu immediate
5.開啟原來的主庫到mount狀態,
SQL>startup mount;
6.在新的主庫上把新產生的日誌歸檔到新的備庫
SQL>alter system archive log current;
7.開啟mrp程式應用日誌,重演變化
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
5.檢視狀態:
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CLOSING
ARCH CONNECTED
ARCH CONNECTED
ARCH CLOSING
MRP0 APPLYING_LOG
RFS IDLE
RFS IDLE
RFS IDLE
至此將原來的主庫成為了新的主的standby了。。。。。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29654823/viewspace-2649606/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 11g dg broker 開啟fast-start failover自動故障切換OracleASTAI
- Oracle物理DG自動切換——Dataguard Broker配置Oracle
- oracle 11g dg broker開啟和配置Oracle
- Oracle DG管理Broker配置Oracle
- ORACLE資料庫Dataguard dg brokerOracle資料庫
- Oracle DG Broker配置的管理週期Oracle
- ORACLE 11.2.0.4 DG(Broker) for linux 部署OracleLinux
- oracle_DG+broker+Keepalived的部署文件Oracle
- Oracle DG 管理Broker配置成員的狀態Oracle
- 使用DG_broker工具管理DG之switchover
- DG 進行failoverAI
- ORACLE DG 11G 搭建Oracle
- Linux下建立Oracle 10g DG和Broker配置LinuxOracle 10g
- Linux 下建立Oracle 10g DG和Broker配置LinuxOracle 10g
- 【DG】DG之Switchover和Failover的區別AI
- 使用Broker實現DG切換
- ORACLE 11G 自動收集Oracle
- DG物理standby,Failover之後原primary重回DGAI
- oracle 11g dg搭建筆記Oracle筆記
- 物理DG角色轉換: failoverAI
- DG物理standby,failover步驟AI
- FAILOVER後DG的重新搭建AI
- dg broker配置的問題及分析
- oracle DG 11g新特性彙總Oracle
- 【Oracle】11g Oracle自動收集統計資訊Oracle
- Data Guard Broker系列之六:Fast-Start FailoverASTAI
- Oracle 11g單主搭建物理DGOracle
- Oracle 11g dg switchover切換操作流程Oracle
- DG學習筆記(8)_Switchover and Failover筆記AI
- 【DATAGUARD】物理dg的failover切換(六)AI
- 配置dg broker的問題分析及修復
- oracle 11g自動記憶體管理Oracle記憶體
- ORACLE 11G 自動維護任務Oracle
- ORACLE 11g 自動收集統計資訊Oracle
- Oracle 11g DG新特性--Automatic block repairOracleBloCAI
- ORACLE 11G DataGuard Failover後如何修復standby庫OracleAI
- ORACLE 11G Datagurad自動啟動服務Oracle
- oracle 11g之instance自動啟動設定Oracle