[20200219]strace跟蹤設定ENABLE=BROKEN的情況(網路的情況).txt

lfree發表於2020-02-19

[20200219]strace跟蹤設定ENABLE=BROKEN的情況(網路的情況).txt

--//前面的測試都是在本地服務端進行,使用lo介面。測試真實網路的情況:

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs   -n 1  strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 10
/proc/sys/net/ipv4/tcp_keepalive_probes: 4
/proc/sys/net/ipv4/tcp_keepalive_time: 33

$ grep SQLNET.EXPIRE_TIME $ORACLE_HOME/network/admin/sqlnet.ora
# SQLNET.EXPIRE_TIME = 1

--//客戶端:
# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs   -n 1  strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 15
/proc/sys/net/ipv4/tcp_keepalive_probes: 4
/proc/sys/net/ipv4/tcp_keepalive_time: 56

$ grep -i expire sqlnet.ora
#SQLNET.EXPIRE_TIME = 1

2.測試:
--//在客戶端執行:
$ strace -f -r -T -e trace=socket,setsockopt sqlplus  scott/book@"(DESCRIPTION=(ENABLE=BROKEN)(CONNECT_DATA=(SERVICE_NAME=book)(SERVER = DEDICATED))(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1521)))"
     0.000000 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 6 <0.000236>
     0.001417 socket(PF_FILE, SOCK_STREAM, 0) = 6 <0.000143>
     0.000447 socket(PF_FILE, SOCK_STREAM, 0) = 6 <0.000149>
SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 19 11:00:19 2020
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

     0.021572 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 9 <0.000179>
     0.000346 setsockopt(9, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 <0.000137>
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     0.000863 setsockopt(9, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000142>
     0.054498 setsockopt(9, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 <0.000149>
     0.010003 socket(PF_NETLINK, SOCK_RAW, 0) = 10 <0.000211>
     0.000690 socket(PF_FILE, SOCK_STREAM, 0) = 10 <0.000148>
     0.000437 socket(PF_FILE, SOCK_STREAM, 0) = 10 <0.000149>
     0.001555 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 10 <0.000032>

SCOTT@book> @ spid

       SID    SERIAL# PROCESS                  SERVER    SPID       PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
         3       1435 14573                    DEDICATED 10567       24        217 alter system kill session '3,1435' immediate;

--//在服務端執行:
# ps -ef | grep tnslsn[r]
oracle   47619     1  0 Jan15 ?        00:01:04 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/tnslsnr LISTENER -inherit

$ strace -f -r -T   -e trace=socket,setsockopt -p 47619
Process 47619 attached with 3 threads - interrupt to quit
[pid 47620]      0.000000 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000037>
[pid 47619]      3.741731 setsockopt(13, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000020>
Process 10566 attached
Process 47619 suspended
Process 10567 attached
Process 47619 resumed
Process 10566 detached
[pid 47619]      0.002848 --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 10567]      0.035160 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 6 <0.000027>
[pid 10567]      0.007805 socket(PF_FILE, SOCK_STREAM, 0) = 4 <0.000025>
[pid 10567]      0.000210 socket(PF_FILE, SOCK_STREAM, 0) = 4 <0.000019>
[pid 10567]      0.006365 setsockopt(13, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000025>
[pid 10567]      0.001532 setsockopt(13, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 <0.000023>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[pid 47620]      1.207357 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000027>
[pid 47620]      5.000959 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000029>
[pid 47620]      5.001582 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000026>
[pid 47620]      5.001408 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000031>
[pid 47620]      5.002872 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000026>
[pid 47620]      5.000991 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000027>
[pid 47620]      5.001649 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000027>
[pid 47620]      5.001450 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 13 <0.000038>
^CProcess 47619 detached
Process 47620 detached
Process 47621 detached
Process 10567 detached

--//可以看出服務端與客戶端都執行了setsockopt(13, SOL_SOCKET, SO_KEEPALIVE, [1], 4).

3.看看連線情況以及各自keepalive設定是多少?

--//在客戶端執行:
$ seq 100 | xargs -iQ bash -c "netstat -npo  2>/dev/null | grep 14573|ts.awk;sleep 0.99"
--//rh 4.3版本,xargs -i引數是小寫。
[2020-02-19 11:04:06] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (0.46/0/0)
[2020-02-19 11:04:07] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (14.41/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2020-02-19 11:04:08] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (13.37/0/0)
[2020-02-19 11:04:09] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (12.32/0/0)
[2020-02-19 11:04:10] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (11.28/0/0)
[2020-02-19 11:04:12] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (10.23/0/0)
[2020-02-19 11:04:13] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (9.19/0/0)
[2020-02-19 11:04:14] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (8.14/0/0)
[2020-02-19 11:04:15] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (7.10/0/0)
[2020-02-19 11:04:16] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (6.05/0/0)
[2020-02-19 11:04:17] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (5.01/0/0)
[2020-02-19 11:04:18] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (3.96/0/0)
[2020-02-19 11:04:19] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (2.92/0/0)
[2020-02-19 11:04:20] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (1.87/0/0)
[2020-02-19 11:04:21] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (0.83/0/0)
[2020-02-19 11:04:22] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (40.78/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2020-02-19 11:04:23] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (39.73/0/0)
[2020-02-19 11:04:24] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (38.69/0/0)
[2020-02-19 11:04:25] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (37.64/0/0)
[2020-02-19 11:04:26] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (36.60/0/0)
[2020-02-19 11:04:27] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (35.55/0/0)
[2020-02-19 11:04:28] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (34.51/0/0)
[2020-02-19 11:04:29] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (33.46/0/0)
[2020-02-19 11:04:30] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (32.42/0/0)
[2020-02-19 11:04:31] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (31.37/0/0)
[2020-02-19 11:04:32] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (30.33/0/0)
[2020-02-19 11:04:33] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (29.28/0/0)
[2020-02-19 11:04:35] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (28.24/0/0)
[2020-02-19 11:04:36] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (27.19/0/0)
[2020-02-19 11:04:37] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (26.15/0/0)
[2020-02-19 11:04:38] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (25.10/0/0)
[2020-02-19 11:04:39] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (24.06/0/0)
[2020-02-19 11:04:40] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (23.01/0/0)
[2020-02-19 11:04:41] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (21.97/0/0)
[2020-02-19 11:04:42] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (20.92/0/0)
[2020-02-19 11:04:43] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (19.88/0/0)
[2020-02-19 11:04:44] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (18.84/0/0)
[2020-02-19 11:04:45] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (17.79/0/0)
[2020-02-19 11:04:46] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (16.75/0/0)
[2020-02-19 11:04:47] tcp        0      0 192.168.100.40:37596        192.168.100.78:1521         ESTABLISHED 14573/sqlplus       keepalive (15.70/0/0)
--//也是分2部分 ,41+15  = 56秒.

--//在服務端執行:
$ seq 100 | xargs -IQ bash -c "netstat -npo 2>/dev/null | grep 10567|ts.awk;sleep 1"
[2020-02-19 11:06:36] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (0.41/0/0)
[2020-02-19 11:06:37] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (22.39/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2020-02-19 11:06:38] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (21.37/0/0)
[2020-02-19 11:06:39] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (20.35/0/0)
[2020-02-19 11:06:40] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (19.32/0/0)
[2020-02-19 11:06:41] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (18.30/0/0)
[2020-02-19 11:06:42] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (17.28/0/0)
[2020-02-19 11:06:43] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (16.26/0/0)
[2020-02-19 11:06:44] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (15.23/0/0)
[2020-02-19 11:06:45] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (14.21/0/0)
[2020-02-19 11:06:46] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (13.19/0/0)
[2020-02-19 11:06:47] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (12.17/0/0)
[2020-02-19 11:06:48] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (11.15/0/0)
[2020-02-19 11:06:49] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (10.12/0/0)
[2020-02-19 11:06:50] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (9.10/0/0)
[2020-02-19 11:06:51] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (8.08/0/0)
[2020-02-19 11:06:52] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (7.06/0/0)
[2020-02-19 11:06:53] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (6.04/0/0)
[2020-02-19 11:06:54] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (5.01/0/0)
[2020-02-19 11:06:55] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (3.99/0/0)
[2020-02-19 11:06:56] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (2.97/0/0)
[2020-02-19 11:06:57] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (1.95/0/0)
[2020-02-19 11:06:58] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (0.92/0/0)
[2020-02-19 11:06:59] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (9.92/0/0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2020-02-19 11:07:00] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (8.89/0/0)
[2020-02-19 11:07:01] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (7.87/0/0)
[2020-02-19 11:07:02] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (6.85/0/0)
[2020-02-19 11:07:03] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (5.83/0/0)
[2020-02-19 11:07:04] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (4.81/0/0)
[2020-02-19 11:07:05] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (3.78/0/0)
[2020-02-19 11:07:06] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (2.76/0/0)
[2020-02-19 11:07:07] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (1.74/0/0)
[2020-02-19 11:07:08] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (0.72/0/0)
[2020-02-19 11:07:09] tcp        0      0 192.168.100.78:1521         192.168.100.40:37596        ESTABLISHED 10567/oraclebook    keepalive (22.70/0/0)
--//10+23 = 33.
--//噢,終於明白為什麼分成2部分,1部分的設定來源於核心引數/proc/sys/net/ipv4/tcp_keepalive_intvl。
--//服務端/proc/sys/net/ipv4/tcp_keepalive_intvl=10,而客戶端/proc/sys/net/ipv4/tcp_keepalive_intvl=15.
--//可以看出setsockopt(N, SOL_SOCKET, SO_KEEPALIVE, [1], 4) ,SO_KEEPALIVE引數來自各自主機的核心引數tcp_keepalive_time。

--//如果設定SQLNET.EXPIRE_TIME 引數,一部分就是6,不知道為什麼?

3.另外我還測試:
--//客戶端修改SQLNET.EXPIRE_TIME = 1的情況:
$ grep -i expire sqlnet.ora
SQLNET.EXPIRE_TIME = 1

--//結果一樣,不會使用這個引數,而是使用核心引數。

4.補充使用tcpdump驗證看看:
--//從客戶端登入:
$ sqlplus scott/book@"(DESCRIPTION=(ENABLE=BROKEN)(CONNECT_DATA=(SERVICE_NAME=book)(SERVER = DEDICATED))(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1521)))"
SCOTT@book> @ spid

       SID    SERIAL# PROCESS                  SERVER    SPID       PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
         3       1589 19194                    DEDICATED 13338       24         11 alter system kill session '3,1589' immediate;
--//注:不執行任何命令.

--//客戶端執行:
$ netstat -npo  2>/dev/null | grep 19194
tcp        0      0 192.168.100.40:40891        192.168.100.78:1521         ESTABLISHED 19194/sqlplus       keepalive (20.73/0/0)

--//服務端執行:
# netstat -npo  2>/dev/null | grep 13338
tcp        0      0 192.168.100.78:1521         192.168.100.40:40891        ESTABLISHED 13338/oraclebook    keepalive (13.46/0/0)

# tcpdump -vvnni eth0 dst port 40891
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
...
15:37:50.126104 IP (tos 0x0, ttl  64, id 18244, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xc606), 1:1(0) ack 1 win 331 <nop,nop,timestamp 713638269 2533232674>
15:37:57.424253 IP (tos 0x0, ttl  64, id 18245, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xa984), 0:0(0) ack 1 win 331 <nop,nop,timestamp 713645568 2533232674>
~~~~~
15:38:30.448234 IP (tos 0x0, ttl  64, id 18246, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xa782), 0:0(0) ack 1 win 331 <nop,nop,timestamp 713678592 2533265699>
~~~~
15:38:46.124136 IP (tos 0x0, ttl  64, id 18247, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xe943), 1:1(0) ack 1 win 331 <nop,nop,timestamp 713694267 2533298725>
15:39:03.472187 IP (tos 0x0, ttl  64, id 18248, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xa57f), 0:0(0) ack 1 win 331 <nop,nop,timestamp 713711616 2533298725>
~~~
15:39:36.496545 IP (tos 0x0, ttl  64, id 18249, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0xa37d), 0:0(0) ack 1 win 331 <nop,nop,timestamp 713744640 2533331750>
~~~~~
15:39:42.122073 IP (tos 0x0, ttl  64, id 18250, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.78.1521 > 192.168.100.40.40891: ., cksum 0x49ee (incorrect (-> 0x0c82), 1:1(0) ack 1 win 331 <nop,nop,timestamp 713750265 2533364775>
15:40:09.520757 IP (tos 0x0, ttl  64, id 20500, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x8c3d (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533397797 713750265>
~~~~~
15:40:38.138192 IP (tos 0x0, ttl  64, id 20502, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x1c82 (correct), 4294967295:4294967295(0) ack 1 win 145 <nop,nop,timestamp 2533426401 713750265>
15:40:42.545344 IP (tos 0x0, ttl  64, id 20504, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x307a (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533430806 713806282>
~~~~~~
15:41:15.568301 IP (tos 0x0, ttl  64, id 20506, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xaf80 (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533463823 713806282>
~~~~~~~
15:41:34.147020 IP (tos 0x0, ttl  64, id 20508, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x66ee (correct), 4294967295:4294967295(0) ack 1 win 145 <nop,nop,timestamp 2533482402 713806282>
15:41:48.592753 IP (tos 0x0, ttl  64, id 20510, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x53b5 (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533496849 713862290>
~~~~~~~
15:42:21.616468 IP (tos 0x0, ttl  64, id 20512, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xd2b3 (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533529874 713862290>
--//注意看下劃線的行,時間的間隔33秒。其它出現的情況是客戶端發出的探測包。比如時間 :15:38:46.124136。對比下面的輸出就很清洗了。
--// 15:38:46.124136 ,15:39:42.122073 相差56秒。

# tcpdump -vvnni eth0 src port 40891
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
15:38:30.448364 IP (tos 0x0, ttl  64, id 20490, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xc4bc (correct), 2813590524:2813590524(0) ack 2927188646 win 145 <nop,nop,timestamp 2533298725 713638269>
15:38:46.123988 IP (tos 0x0, ttl  64, id 20492, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x8781 (correct), 4294967295:4294967295(0) ack 1 win 145 <nop,nop,timestamp 2533314401 713638269>
~~~~~~~~
15:39:03.472312 IP (tos 0x0, ttl  64, id 20494, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x68fc (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533331750 713694267>
15:39:36.496655 IP (tos 0x0, ttl  64, id 20496, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xe7fa (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533364775 713694267>
15:39:42.122031 IP (tos 0x0, ttl  64, id 20498, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xd201 (correct), 4294967295:4294967295(0) ack 1 win 145 <nop,nop,timestamp 2533370401 713694267>
~~~~~~~~
15:40:09.520757 IP (tos 0x0, ttl  64, id 20500, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x8c3d (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533397797 713750265>
15:40:38.138192 IP (tos 0x0, ttl  64, id 20502, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x1c82 (correct), 4294967295:4294967295(0) ack 1 win 145 <nop,nop,timestamp 2533426401 713750265>
~~~~~~~~~
15:40:42.545344 IP (tos 0x0, ttl  64, id 20504, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0x307a (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533430806 713806282>
15:41:15.568301 IP (tos 0x0, ttl  64, id 20506, offset 0, flags [DF], proto: TCP (6), length: 52) 192.168.100.40.40891 > 192.168.100.78.1521: ., cksum 0xaf80 (correct), 0:0(0) ack 1 win 145 <nop,nop,timestamp 2533463823 713806282>
--//注意看下劃線的行,時間的間隔56秒。

5.總結:
--//11g下建議設定相關核心引數,不建議選擇增加 sqlnet.ora檔案的 SQLNET.EXPIRE_TIME引數。
# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs   -n 1  strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 10
/proc/sys/net/ipv4/tcp_keepalive_probes: 4
/proc/sys/net/ipv4/tcp_keepalive_time: 600

--//12c選擇修改SQLNET.EXPIRE_TIME = 10

--//資料庫連線串建議加入(ENABLE=BROKEN)。注意客戶端相關核心引數也要修改合適,實際上就是使用核心相關引數檢測TCP KEEPALIVE套接
--//字選項來檢查連線是否仍然可用。
--//我建議如下:
# echo /proc/sys/net/ipv4/tcp_keepalive* | xargs   -n 1  strings -1 -f
/proc/sys/net/ipv4/tcp_keepalive_intvl: 10
/proc/sys/net/ipv4/tcp_keepalive_probes: 4
/proc/sys/net/ipv4/tcp_keepalive_time: 600

--//不知道windows的這些引數如何修改登錄檔,有時間看看。

--//另外不必擔心這些包對網路效能的影響,現在的網路完全可以承受,還不如重點放在最佳化業務流程以及sql語句。

6.ts.awk指令碼:
$ cat /usr/local/bin/ts.awk
# /bin/bash
gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'





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

相關文章