DataGuard如何傳送Redo到Standby
DataGuard通過傳送redo到standby,然後在standby上應用這些redo來保持兩者資料一致.在PRIMARY傳送redo主要是通過
lgwr進程來實現傳送redo。
lgwr傳送模式下,lgwr進程本身並不真正傳送redo到standby上,而是由lgwr派生一個lns(local network server)
進程來傳送redo資訊.這樣做的好處主要在於減輕lgwr進程的壓力,防止網路意外等情況使lgwr進程產生不穩定情況。
在standby上查詢 client_process是lgwr,但是真正的並不是lgwr來傳送記錄
standbyANDBY> select process,client_process,standbyatus from v$managed_standbyandby where process='RFS';
PROCESS CLIENT_P standbyATUS
--------- -------- ------------
RFS LGWR IDLE
RFS UNKNOWN IDLE
RFS UNKNOWN IDLE
RFS UNKNOWN IDLE
在PRIMARY我們可以通過查看網路連接來看檢查lgwr進程,並不會產生到standby的串連,而是由lns進程產生的網路連接
[root@newplat ~]# ps -eaf | egrep -e 'lgwr|lns' | grep -v 'egrep'
Oracle 8399 1 0 09:11 ? 00:01:08 ora_lgwr_cpd
oracle 15207 1 0 11:09 ? 00:00:00 ora_lns1_cpd
[root@newplat ~]#
[root@newplat ~]# netstandbyat -apn | egrep -e '8399|15207'
tcp 0 0 192.168.56.21:38944 192.168.56.22:1521 ESTABLISHED 15207/ora_lns1_cepd
udp 0 0 :::55415 :::* 8399/ora_lgwr_cpd
udp 0 0 ::1:55419 :::* 15207/ora_lns1_cepd
[root@newplat ~]#
主庫上的日誌會報以下的日誌,表示有lns進行傳送.
LNS: standbyandby redo logfile selected for thread 1 sequence 92 for destandbyination LOG_ARCHIVE_DEstandby_2
Sun Mar 20 11:09:35 2016
Archived Log entry 165 added for thread 1 sequence 91 ID 0xac83cb1e destandby 1:
Sun Mar 20 11:09:35 2016
ARC3: standbyandby redo logfile selected for thread 1 sequence 91 for destandbyination LOG_ARCHIVE_DEstandby_2
Sun Mar 20 11:45:15 2016
當log_archive_destandby_X中的同步參數由預設的async改為sync時,alert.log出現
LGWR: standbyandby redo logfile selected for thread 1 sequence 103 for destandbyination LOG_ARCHIVE_DEstandby_2
Thread 1 advanced to log sequence 103 (LGWR switch)
Current log# 1 seq# 103 mem# 0: /u01/app/oracle/oradata/cpd/redo01.log
這種配置下很多人以為是lgwr進程直接傳送redo到備庫上,實際也可以通過網路連接看出,是由lns進程來傳送的
[root@newplat ~]# ps -eaf | egrep -e 'lgwr|lns' | grep -v egrep
oracle 12664 1 0 20:04 ? 00:00:00 ora_lnsb_cpd
oracle 18366 1 0 11:49 ? 00:00:01 ora_lgwr_cpd
[root@newplat ~]# netstandbyat -anp |egrep -e '12664|18366';
tcp 0 0 192.168.56.21:47971 192.168.56.22:1521 ESTABLISHED 12664/ora_lnsb_cepd
udp 0 0 ::1:49731 :::* 12664/ora_lnsb_cepd
udp 0 0 :::51196 :::* 18366/ora_lgwr_cepd
ARCH進程也會傳送redo,不過傳送的是archivelog,當standby和PRIMARY產生gap時,這時候由arch進程來負責把PRIMARY上的日誌傳到備庫上去
Sun Mar 20 20:22:54 2016
ARC3: standbyandby redo logfile selected for thread 1 sequence 105 for destandbyination LOG_ARCHIVE_DEstandby_2
Sun Mar 20 20:24:02 2016
查看網路連接資訊
[root@newplat ~]# ps -eaf | egrep -e 'ora_arc' | grep -v egrep
oracle 18407 1 0 11:49 ? 00:00:00 ora_arc0_cpd
oracle 18409 1 0 11:49 ? 00:00:00 ora_arc1_cpd
oracle 18411 1 0 11:49 ? 00:00:00 ora_arc2_cpd
oracle 18413 1 0 11:49 ? 00:00:00 ora_arc3_cpd
[root@newplat ~]# netstandbyat -apn | grep 18413
tcp 0 0 192.168.56.21:54683 192.168.56.22:1521 ESTABLISHED 18413/ora_arc3_cepd
udp 0 0 ::1:43124 :::* 18413/ora_arc3_cepd
Oracle 11gR2 在VMWare虛擬機器中安裝步驟
Debian 下 安裝 Oracle 11g XE R2
Oracle Data Guard 重要配置參數
基於同一主機配置 Oracle 11g Data Guard
探索Oracle之11g DataGuard
Oracle Data Guard (RAC+DG) 歸檔刪除策略及指令碼
Oracle Data Guard 的角色轉換
Oracle Data Guard的日誌FAL gap問題
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 處理方法