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 11g dg broker開啟和配置Oracle
- Oracle DG管理Broker配置Oracle
- ORACLE 11.2.0.4 DG(Broker) for linux 部署OracleLinux
- Oracle DG Broker配置的管理週期Oracle
- Oracle DG 管理Broker配置成員的狀態Oracle
- Oracle 11g DG新特性--Automatic block repairOracleBloCAI
- Oracle 11g單主搭建物理DGOracle
- Oracle 11g dg switchover切換操作流程Oracle
- oracle 11g自動記憶體管理Oracle記憶體
- 使用Broker實現DG切換
- Oracle 11g RAC自動打GI PSU補丁Oracle
- 【ASK_ORACLE】手動配置DataGuard的自動化Client Failover(故障轉移)的serviceOracleclientAI
- 11G RAC+DG搭建
- Oracle RAC DG手動切換Oracle
- Oracle dataguard failover 實戰OracleAI
- oracle dataguard broker 配置Oracle
- 【DG】DataGuard健康檢查 for 11g
- Oracle 19C Data Guard基礎運維-07 failover後閃回恢復dg架構Oracle運維AI架構
- Oracle 11g RAC DG備庫gv$dataguard_stats apply lag值較大OracleAPP
- Oracle:Failover 到物理備庫OracleAI
- ORACLE 11G 維護視窗和自動維護任務Oracle
- Oracle Data Guard Broker元件Oracle元件
- Oracle:DG 的 switchoverOracle
- oracle dg報錯Oracle
- Oracle Dataguard故障轉移(failover)操作OracleAI
- Oracle 11g RAC手動新增serviceOracle
- 使用ansible-playbook自動化安裝Oracle DG資料庫19cOracle資料庫
- 11g dg 備庫搭建多種方式
- 1 Oracle Data Guard Broker 概念Oracle
- Oracle Data Guard和Broker概述Oracle
- Oracle 19c Broker配置Oracle
- Oracle RAC+DG搭建Oracle
- Oracle DG 日常點檢Oracle
- [統計資訊系列7] Oracle 11g的自動統計資訊收集Oracle
- 8 Oracle Data Guard Broker 屬性Oracle
- 【邏輯DG滾動升級二】ORACLE11204 邏輯DG滾動升級至12C---DG端前期準備Oracle
- 11G oracle資料庫重新啟動crsOracle資料庫