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運維
- Oracle 19C Data Guard基礎運維-07 failover後閃回恢復dg架構Oracle運維AI架構
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- Oracle 19C OGG基礎運維-03DML操作同步Oracle運維3D
- oracle 10g物理data guard 操作Oracle 10g
- Oracle分割槽表基礎運維-03HASH分割槽Oracle運維
- 物理DG!Oracle 10G Data Guard DemoOracle 10g
- Oracle 19C OGG基礎運維-05DDL操作同步Oracle運維
- Oracle 19C OGG基礎運維-06增加複製表Oracle運維
- Oracle 19C OGG基礎運維-08Error code [942]Oracle運維Error
- Oracle 19C OGG基礎運維-01環境準備Oracle運維
- Oracle 11g RAC Data Guard 物理standby 建立Oracle
- 搭建Oracle Data Guard 11g(物理備用)Oracle
- RedHat搭建物理Data GuardRedhat
- 轉載《Data Guard Broker基礎》
- Oracle 19C OGG基礎運維-02資料初始化Oracle運維
- Oracle 19C OGG基礎運維-07減少複製表Oracle運維
- oracle 11g data guard維護Oracle
- 物理data guard原理的理解(zt)
- [轉]物理data guard原理的理解
- Oracle data guard常用維護操作命令(轉)Oracle
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- oracle data guard!!Oracle
- Oracle 19C OGG基礎運維-04DML同步常見問題Oracle運維
- 總結11g 物理data guard
- DATA GUARD物理STANDBY的 SWITCHOVER切換
- Oracle 19C OGG基礎運維-09OGG-15121錯誤Oracle運維
- 【DataGuard】使用Grid Control快速部署Oracle物理Data GuardOracle
- 【ASK_ORACLE】Oracle Data Guard(二)物理備庫的概念和優勢Oracle
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle
- Oracle Data Guard配置Oracle
- Data guard 配置之搭建物理備庫
- 【DataGuard】物理Data Guard之Failover轉換AI