Dataguard LNS进程10g到12c的演变
5,250 total views, 1 views today
公司生产库11gR2 DataGuard报出错误,显示LNS无法将日志传输到备库上。
1 2 3 4 5 6 7 |
Wed Jul 18 14:30:27 2018 LNS: Attempting destination LOG_ARCHIVE_DEST_3 network reconnect (3135) LNS: Destination LOG_ARCHIVE_DEST_3 network reconnect abandoned Error 3135 for archive log file 2 to 'xxxstd2' Errors in file /u01/app/oracle/diag/rdbms/xxxx/promstd1/trace/xxxx_nsa3_77487.trc: ORA-03135: connection lost contact LNS: Failed to archive log 2 thread 1 sequence 2624 (3135) |
查看trace xxxx_nsa3_77487.trc
1 2 3 4 5 6 7 8 |
*** 2018-07-18 14:35:58.062 NSS3 is not running anymore. *** 2018-07-18 14:35:58.062 7977 krsu.c Reusing NSA3 ... *** 2018-07-18 14:35:58.062 8040 krsu.c Netserver NSA3 [pid 77487] for mode ASYNC has been re-initialized Performing a channel reset to ignore previous responses Successfully reused NSA3 [pid 77487] for dest xxxstd2 mode ASYNC ocis=0x7f318f912be0 |
里面提及了NSS、NSA,之前没有注意过这些进程, 那么它们的用途是什么?
Oracle 11gR1及之前版本
Oracle 10gR2文档中,LNSn是network server的缩写,注意LNSn中的“L”并没有对应的单词,一般认为是Log的缩写,但是官方文档中并没有提及。
在主库上,LGWR进程提交redo数据给一个或者多个LNSn进程,LNSn进程并行初始化到多个远程归档路径的网络I/O。(On the primary database, the LGWR process submits the redo data to one or more network server (LNSn) processes, which then initiate the network I/O in parallel to multiple remote destinations. )
使用LGWR SYNC发送redo到备库,事务相关的redo在主库和备库都写完毕后,主库上的事务才能提交成功。网络延迟、网络带宽以及从库的I/O性能都影响了主库的提交时间。
total commit time = network time + standby write time + network acknowledged。
使用LGWR ASYNC发送redo到备库,由于ASYNC传输redo是真正的异步行为,对主库的吞吐量影响很小。网络延迟的增加,对主库的吞吐量影响几乎没有影响。使用ASYNC,主库的日志写进程(LGWR)将redo日志条目写入到在线redo日志中,同时LNSn进程将在线redo日志异步传输到备库。不管LNSn是否已经将redo传输了备库,主库的LGWR都可以继续运行。
注意! 10g中,无论是SYNC还是ASYNC模式,都由LNSn进程复制将主库redo传输到备库。
Oracle 11gR2
Oracle 11g取消了LNSn进程,将10g的LNSn进程拆分为两个进程,分别是NSAn(network server async,异步网络服务器)和NSSn(network server sync同步网服务器),无论异步还是同步最多可以有9个进程。
NSAn | Redo Transport NSA1 Process | Ships redo from current online redo logs to remote standby destinations configured for ASYNC transport | NSAn can run as multiple processes, where n is 1-9 or A-V. | Database instance, Data Guard |
NSSn | Redo Transport NSS1 Process | Acts as a slave for LGWR when SYNC transport is configured for a remote standby destination | NSSn can run as multiple processes, where n is 1-9 or A-V. | Database instance, Data Guard |
不过,11gR2及之后版本,在等待事件中,都保留了LNS这个名词
Table 7-2 Redo Transport Wait Events
Wait Event | Description |
---|---|
LNS wait on ATTACH | Total time spent waiting for redo transport sessions to be established to all ASYNC and SYNC redo transport destinations |
LNS wait on SENDREQ | Total time spent waiting for redo data to be written to all ASYNC and SYNC redo transport destinations |
LNS wait on DETACH | Total time spent waiting for redo transport connections to be terminated to all ASYNC and SYNC redo transport destinations |
生产环境都是11gR2 ASYNC同步方式,查看进程
1 2 3 4 5 |
$ ps -ef|grep nsa |grep -v grep oracle 77477 1 0 2016 ? 04:42:01 ora_nsa2_xxxx oracle 77487 1 0 2016 ? 04:46:17 ora_nsa3_xxxx oracle 77491 1 0 2016 ? 01:33:32 ora_nsa4_xxxx oracle 77493 1 0 2016 ? 04:33:01 ora_nsa5_xxxx |
本文开头贴出的日志,显示同步NSSn进程没有运行,异步NSAn进程正在被重用。
1 2 3 4 |
*** 2018-07-18 14:35:58.062 NSS3 is not running anymore. *** 2018-07-18 14:35:58.062 7977 krsu.c Reusing NSA3 ... |
12C
12c开始,NSSn被保留,依然为SYNC传输redo到备库服务。
NSSn | Network Server SYNC Process | Transfers redo from current online redo logs to remote standby destinations configured for SYNC transport | NSSn can run as multiple processes, where n is 1-9 or A. | Database instances, Data Guard |
而NSAn则更名为TTnn(redo transport slave process)。这么做的目的是,11g中NSAn需要LGWR进程通知后才开始异步传输redo到备库,造成短暂的传输延迟;而12c中TTnn进程传输不再需要LGWR进程通知,TMON(transport monitor process)进程负责传输监视。
TTnn | Redo Transport Slave Process | Ships redo from current online and standby redo logs to remote standby destinations configured for ASYNC transport | TTnn can run as multiple processes, where nn is 00 to ZZ. | Database instances, Data Guard |
(以上两张图片均来自macleanliu)
综述
Oracle DataGuard主库上负责将redo传输到备库的进程,名字在11gR1及之前版本为LNSn,其负责ASYNC和SYNC两种传输方式的日志传输;从11gR2拆分为两个进程NSAn和NSSn,分别负责ASYNC和SYNC传输;到12c,NSAn变更为TTnn,较NSAn做了优化减少了传输延迟。
参考:
10gR2: https://docs.oracle.com/cd/B19306_01/server.102/b25159/configbp.htm
11gR1: https://docs.oracle.com/cd/B28359_01/server.111/b28282/glossary.htm#CHDIDADC
11gR2:https://docs.oracle.com/cd/E11882_01/server.112/e40402/bgprocesses.htm#REFRN104
12cR1:https://docs.oracle.com/database/121/REFRN/GUID-86184690-5531-405F-AA05-BB935F57B76D.htm#REFRN104
macleanliu:http://www.askmaclean.com/archives/12c-ttnn-tmon-new-background-process.html
小荷:https://oracleblog.org/study-note/some-new-event-in-12c/
http://what-when-how.com/Tutorial/topic-863lsu/Expert-Oracle-Database-Architecture-209.html