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 处理方法

相关内容