10G DG最大可用模式下備庫發生故障時主庫保護級別的變化

space6212發表於2019-04-29

本為主要討論在10G DG的最大可用保護級別下,如果備庫發生故障,主庫如何應對。


DG處於最大可用保護模式下,只有一個備庫。


1、檢視原來主庫的保護模式
SQL> SELECT PROTECTION_MODE,PROTECTION_LEVEL FROM V$DATABASE;

PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY

2、在備庫中停掉網路卡
[root@standby ~]# ifdown eth0

3、此時在主庫上執行

SQL> CREATE TABLE T(ID INT);
--這個會停頓180秒(預設值)才能完成建表
Table created.

4、檢視此時後臺的alert資訊
Sun Jun 24 22:37:06 2007
ORA-16198: LGWR received timedout error from KSR
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (16198)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Sun Jun 24 22:37:06 2007
Errors in file /u01/oracle/admin/primary/bdump/primary_lgwr_3822.trc:
ORA-16198: Timeout incurred on internal channel during remote archival
LGWR: Network asynch I/O wait error 16198 log 1 service 'standby'
Sun Jun 24 22:37:06 2007
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
LGWR: Failed to archive log 1 thread 1 sequence 19 (16198)
Sun Jun 24 22:37:06 2007
LGWR: Closing remote archive destination LOG_ARCHIVE_DEST_2: 'standby' (error 16198)
(primary)

可以看到,主庫在嘗試連線備庫失敗後,會放棄傳送日誌到備庫。

5、此時檢視DG的保護模式
SQL> SELECT PROTECTION_MODE,PROTECTION_LEVEL FROM V$DATABASE;

PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY RESYNCHRONIZATION

可以看到,DG仍然處於最大可用保護模式下,但PROTECTION_LEVEL已經變為RESYNCHRONIZATION。
當然,主庫隔一段時間就會重試連線備庫,如果網路修復後,DG的PROTECTION_LEVEL會重新成為MAXIMUM AVAILABILITY。

6、此時啟用備庫的網路卡
service network restart

7、檢視主庫的alert日誌
隔一段時間後,可以在alert中看到如下資訊:
Sun Jun 24 22:57:32 2007
Thread 1 advanced to log sequence 22
Current log# 1 seq# 22 mem# 0: /u01/oracle/oradata/primary/redo01.log
LNSb started with pid=18, OS id=3904
Sun Jun 24 23:00:35 2007
LGWR: Standby redo logfile selected to archive thread 1 sequence 23
LGWR: Standby redo logfile selected for thread 1 sequence 23 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 23
Current log# 2 seq# 23 mem# 0: /u01/oracle/oradata/primary/redo02.log
Sun Jun 24 23:00:35 2007
ARC3: LGWR is actively archiving destination LOG_ARCHIVE_DEST_2
ARC3: Standby redo logfile selected for thread 1 sequence 22 for destination LOG_ARCHIVE_DEST_2
Sun Jun 24 23:01:26 2007
Thread 1 cannot allocate new log, sequence 24
Checkpoint not complete
Current log# 2 seq# 23 mem# 0: /u01/oracle/oradata/primary/redo02.log
Sun Jun 24 23:01:30 2007
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected to archive thread 1 sequence 24
LGWR: Standby redo logfile selected for thread 1 sequence 24 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 24
Current log# 3 seq# 24 mem# 0: /u01/oracle/oradata/primary/redo03.log

8、再次查詢主庫的保護模式
SQL> SELECT PROTECTION_MODE,PROTECTION_LEVEL FROM V$DATABASE;

PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY

可以看到,主庫的PROTECTION_LEVEL會重新成為MAXIMUM AVAILABILITY。

至此,可以得到結論:
在最大保護模式下,如果備庫出現故障,主庫會自動降低保護級別,以使得主庫的操作能繼續執行,但是主庫會有一小段時間的停頓。

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

相關文章