Oracle 19C Data Guard基礎運維-03 Failovers(物理)
Oracle 19C Data Guard 基礎運維 -0 3 Failovers( 物理 )
原主庫 |
原備庫 |
Failovers |
新主庫 |
獨立庫 |
192.168.31.90 |
192.168.31.100 |
192.168.31.100 |
192.168.31.90 | |
cjcdb |
chendb |
chendb |
cjcdb |
Failover :
Figure 9-4 Failover to a Standby Database
Performing a Failover to a Physical Standby Database
主庫意外當機,並無法啟動
場景一:沒有歸檔間隙,零資料丟失
主庫模擬故障:
重新命名system 資料檔案
[oracle@cjcos01 CJCDB]$ pwd
/u01/app/oracle/oradata/CJCDB
[oracle@cjcos01 CJCDB]$ mv system01.dbf system01.dbf.bak
SQL> alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 5309
Session ID: 45 Serial number: 38130
備庫日誌:
2020-04-18T08:49:26.394680+08:00
rfs (PID:6276): Possible network disconnect with primary database
啟動主庫失敗:
SQL> startup
ORACLE instance started.
Total System Global Area 1375728192 bytes
Fixed Size 9134656 bytes
Variable Size 1107296256 bytes
Database Buffers 251658240 bytes
Redo Buffers 7639040 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/CJCDB/system01.dbf'
SQL> select status from v$instance;
STATUS
------------
MOUNTED
備庫:3.100
1. 檢查 dg 恢復模式
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
2 檢查 archive_gap ( 沒有 gap 說明備庫執行 failovers 不會丟失資料 )
SQL> select thread#, low_sequence#, high_sequence# from v$archive_gap;
no rows selected
檢查沒有歸檔gap後,最好在檢查主從庫歸檔日誌是否完全同步,備庫同步日誌是否沒有錯誤。
3 備庫取消 DG 應用 ( 關閉 MRP)
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.
4 備庫執行 failover
---謹慎操作,確保資料已完全同步後再切換,避免切換後資料丟失。
SQL> ALTER DATABASE FAILOVER TO chendb;
Database altered.
5 開啟備庫
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SQL> alter database open;
Database altered.
6 新主庫執行全備
7 新主庫檢視狀態
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
FAILED DESTINATION
SQL> insert into test1 select * from test1;
1 rows created.
SQL> commit;
Commit complete.
修復原主庫
SQL> shutdown immediate
[oracle@cjcos01 CJCDB]$ mv system01.dbf.bak system01.dbf
SQL> startup
ORACLE instance started.
Total System Global Area 1375728192 bytes
Fixed Size 9134656 bytes
Variable Size 1107296256 bytes
Database Buffers 251658240 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
此時原主庫變成的一個獨立的資料庫,可以讀寫方式開啟
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE PROTECTION_LEVEL PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
嘗試將原主庫切換為 physical standby
SQL> alter database commit to switchover to physical standby with session shutdown;
alter database commit to switchover to physical standby with session shutdown
*
ERROR at line 1:
ORA-16416: No viable Physical Standby switchover targets available
SQL> recover managed standby database using current logfile disconnect from session;
ORA-01665: control file is not a standby control file
此時原故障主庫變成了一個獨立的資料庫,若想恢復成現有主庫的 Physical Standby ,可以通過現有主庫的資料進行重新搭建,或通過原故障主庫failovers 之前的備份,進行恢復,在通過現有主庫進行 rman 增量追加資料。
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2686922/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 19C Data Guard基礎運維-04 Failovers疑問?Oracle運維AI
- Oracle 19C Data Guard基礎運維-05Failovers (GAP)Oracle運維AI
- Oracle 19C Data Guard基礎運維-02 Switchovers(物理)Oracle運維
- Oracle 19C Data Guard基礎運維-01安裝物理standbyOracle運維
- Oracle 19C Data Guard基礎運維-06 PROTECTION MODEOracle運維
- Oracle 19C Data Guard基礎運維-08 DML重定向Oracle運維
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- Oracle 19C Data Guard基礎運維-07 failover後閃回恢復dg架構Oracle運維AI架構
- Oracle 19C OGG基礎運維-03DML操作同步Oracle運維3D
- oracle 11g data guard維護Oracle
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- Oracle 19C OGG基礎運維-05DDL操作同步Oracle運維
- Oracle 19C OGG基礎運維-01環境準備Oracle運維
- Oracle 19C OGG基礎運維-06增加複製表Oracle運維
- Oracle 19C OGG基礎運維-08Error code [942]Oracle運維Error
- Oracle分割槽表基礎運維-03HASH分割槽Oracle運維
- 【ASK_ORACLE】Oracle Data Guard(二)物理備庫的概念和優勢Oracle
- Oracle 19C OGG基礎運維-02資料初始化Oracle運維
- Oracle 19C OGG基礎運維-07減少複製表Oracle運維
- Oracle 19C OGG基礎運維-09OGG-15121錯誤Oracle運維
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- Oracle 19C OGG基礎運維-04DML同步常見問題Oracle運維
- 1 關於 Oracle Data GuardOracle
- 2 Oracle Data Guard 安裝Oracle
- 1 Oracle Data Guard Broker 概念Oracle
- Oracle Data Guard和Broker概述Oracle
- 4.1.6 Oracle Restart 與 Oracle Data Guard 整合OracleREST
- 8 Oracle Data Guard Broker 屬性Oracle
- 9 Oracle Data Guard 故障診斷Oracle
- [20221111]19c配置Data Guard Broker問題.txt
- 【ASK_ORACLE】Oracle Data Guard(一)DG架構Oracle架構
- 【DATAGUARD】Oracle19c Data Guard BrokerOracle
- 2 開始實用 Oracle Data GuardOracle
- 19 Oracle Data Guard 相關檢視Oracle
- ORACLE基礎運維命令操作手冊Oracle運維
- Oracle RAC日常運維-DATA磁碟組故障Oracle運維
- 6 Oracle Data Guard Protection Modes 保護模式Oracle模式