一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

[20191108]內(nèi)核參數(shù)tcp_keepalive與sqlnet.ora expire_time的一些總結(jié).txt

 怡紅公子0526 2021-01-11

[20191108]內(nèi)核參數(shù)tcp_keepalive與sqlnet.ora expire_time的一些總結(jié).txt

--//前幾天在做12c DCD SQLNET.EXPIRE_TIME相關(guān)測試時(shí),在11g數(shù)據(jù)庫遇到1個(gè)古怪的問題,就是設(shè)置sqlnet.expire_time無效.不知道為
--//什么?以前做過類似測試就是在兩個(gè)都設(shè)置的情況下,sqlnet.ora expire_time優(yōu)先.

--//我當(dāng)時(shí)的情況如下,設(shè)置內(nèi)核參數(shù)如下:
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9

--//參數(shù)解析:
/proc/sys/net/ipv4/tcp_keepalive_time    當(dāng)keepalive起用的時(shí)候,TCP發(fā)送keepalive消息的頻度。默認(rèn)是2小時(shí)。
/proc/sys/net/ipv4/tcp_keepalive_intvl   當(dāng)探測沒有確認(rèn)時(shí),keepalive探測包的發(fā)送間隔。缺省是75秒。
/proc/sys/net/ipv4/tcp_keepalive_probes  如果對方不予應(yīng)答,keepalive探測包的發(fā)送次數(shù)。缺省值是9。

--//sqlnet.ora,沒有設(shè)置#SQLNET.EXPIRE_TIME.
$ grep -i expire sqlnet.ora
#SQLNET.EXPIRE_TIME = 1

--//我當(dāng)時(shí)以為取消注解就可以測試,實(shí)際上沒有出現(xiàn)探測包。我自己當(dāng)時(shí)思路有點(diǎn)亂,干脆選擇重啟數(shù)據(jù)庫與監(jiān)聽。
--//正好現(xiàn)在有空分析看看當(dāng)時(shí)產(chǎn)生問題的原因。

1.環(huán)境:
SYS@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

$ cat /etc/issue
Oracle Linux Server release 5.9

--//設(shè)置內(nèi)核參數(shù)如下:
# 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: 60

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

2.測試:
--//測試前重啟數(shù)據(jù)庫與監(jiān)聽,避免一些干擾.
--//從客戶端連接服務(wù)器:
SCOTT@78> @ spid
SID    SERIAL# PROCESS   SERVER    SPID  PID  P_SERIAL# C50
--- ---------- --------- --------- ----- --- ---------- --------------------------------------------
 44         11 4380:8788 DEDICATED 60897  27          6 alter system kill session '44,11' immediate;

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
....
11:24:33.891755 IP 192.168.100.78.1521 > 192.168.98.6.61888: P 7881:8419(538) ack 9769 win 330
11:24:34.090348 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 8419 win 16290
--//執(zhí)行@spid,不再輸入sql語句。
11:25:34.091591 IP 192.168.100.78.1521 > 192.168.98.6.61888: . ack 9769 win 330
11:25:34.096620 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 8419 win 16290
11:26:34.235540 IP 192.168.100.78.1521 > 192.168.98.6.61888: . ack 9769 win 330
11:26:34.235889 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 8419 win 16290
--//可以發(fā)現(xiàn)間隔60秒.受內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 60
--//修改內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 30,繼續(xù)測試:
# 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: 30

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:28:34.555478 IP 192.168.100.78.1521 > 192.168.98.6.61888: . ack 1403678455 win 330
11:28:34.555755 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 1 win 16290
11:29:04.571423 IP 192.168.100.78.1521 > 192.168.98.6.61888: . ack 1 win 330
11:29:04.571802 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 1 win 16290
11:29:34.587578 IP 192.168.100.78.1521 > 192.168.98.6.61888: . ack 1 win 330
11:29:34.587923 IP 192.168.98.6.61888 > 192.168.100.78.1521: . ack 1 win 16290
--//可以當(dāng)前會(huì)話探測包發(fā)出間隔30秒.也就是修改內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 30馬上生效??蛻舳送顺鲈谶M(jìn)入:
11:30:22.145455 IP 192.168.100.78.1521 > 192.168.98.6.62192: P 6670:6687(17) ack 8100 win 330
11:30:22.145744 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307 <nop,nop,sack 1 {6670:6687}>
--//重新登錄不執(zhí)行任何sql語句.
11:30:52.145468 IP 192.168.100.78.1521 > 192.168.98.6.62192: . ack 8100 win 330
11:30:52.145822 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307
11:31:22.171459 IP 192.168.100.78.1521 > 192.168.98.6.62192: . ack 8100 win 330
11:31:22.171807 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307
--//可以發(fā)現(xiàn)當(dāng)前間隔30秒.受內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 30.

--//現(xiàn)在修改sqlnet.ora,取消注解:
$ grep -i expire sqlnet.ora
SQLNET.EXPIRE_TIME = 1

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:32:52.219456 IP 192.168.100.78.1521 > 192.168.98.6.62192: . ack 8100 win 330
11:32:52.219822 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307
11:33:22.235450 IP 192.168.100.78.1521 > 192.168.98.6.62192: . ack 8100 win 330
11:33:22.235787 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307
11:33:52.251450 IP 192.168.100.78.1521 > 192.168.98.6.62192: . ack 8100 win 330
11:33:52.251739 IP 192.168.98.6.62192 > 192.168.100.78.1521: . ack 6687 win 16307
--//可以當(dāng)前會(huì)話不受影響,時(shí)間間隔30秒.客戶端退出在進(jìn)入:
11:34:19.084451 IP 192.168.100.78.1521 > 192.168.98.6.62390: P 6670:6687(17) ack 8096 win 330
11:34:19.084758 IP 192.168.98.6.62390 > 192.168.100.78.1521: . ack 6687 win 16307 <nop,nop,sack 1 {6670:6687}>
--//重新登錄不執(zhí)行任何sql語句.
11:36:18.847551 IP 192.168.100.78.1521 > 192.168.98.6.62390: P 6687:6697(10) ack 8096 win 330
11:36:19.047149 IP 192.168.98.6.62390 > 192.168.100.78.1521: . ack 6697 win 16304
11:37:18.858073 IP 192.168.100.78.1521 > 192.168.98.6.62390: P 6697:6707(10) ack 8096 win 330
11:37:19.058238 IP 192.168.98.6.62390 > 192.168.100.78.1521: . ack 6707 win 16302
--//開始第一個(gè)時(shí)間間隔2分鐘,然后1分鐘,可以發(fā)現(xiàn)現(xiàn)在起作用的是sqlnet.ora的SQLNET.EXPIRE_TIME = 1.
--//從這里可以看出在兩者設(shè)置的情況下sqlnet.ora的SQLNET.EXPIRE_TIME設(shè)置優(yōu)先.而且根本不需要重啟監(jiān)聽與數(shù)據(jù)庫.
--//為什么我前面的測試有問題呢,問題到底在那里呢?我仔細(xì)回憶我前面的測試,難道問題出在連接模式上嗎?重新登錄:
>>sqlplus scott/book@192.168.100.78:1521/book
SCOTT@192.168.100.78:1521/book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID                     PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- -------------------- ------- ---------- --------------------------------------------------
       281          1 11172:3296               SHARED    60830                     20          1 alter system kill session '281,1' immediate;
--//注意:當(dāng)前的連接模式SERVER=SHARED模式(共享模式).spid=60830.

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:41:10.865890 IP 192.168.100.78.1521 > 192.168.98.6.62708: P 11528:12076(548) ack 13033 win 330
11:41:11.067793 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//重新登錄不執(zhí)行任何sql語句.
11:42:11.131426 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:42:11.131844 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:42:41.147547 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:42:41.147896 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:43:11.163563 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:43:11.163905 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:43:41.179536 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:43:41.179827 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//時(shí)間間隔是30秒.這個(gè)就是我前面測試遇到的情況,我開始設(shè)置net.ipv4.tcp_keepalive_time = 7200太大了.根本看不到網(wǎng)絡(luò)探測包。
--//也就是在使用共享模式登錄的時(shí)候,受內(nèi)核參數(shù)的控制,因?yàn)楫?dāng)時(shí)啟動(dòng)數(shù)據(jù)庫時(shí)沒有SQLNET.EXPIRE_TIME設(shè)置,而其對應(yīng)進(jìn)程已經(jīng)啟
--//動(dòng)(指ora_s000_book,ora_d000_book),這樣共享模式的連接繼承了相關(guān)進(jìn)程的設(shè)置,依舊使用內(nèi)核參數(shù)。

$ ps -ef | grep 6083[0]
oracle   60830     1  0 11:21 ?        00:00:00 ora_s000_book

--//直接修改內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 10,注意修改時(shí)沒有退出客戶端連接:
# 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: 10

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:48:41.339466 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:48:41.339809 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:49:11.355484 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:49:11.355844 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)net.ipv4.tcp_keepalive_time = 10
11:49:21.371482 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:49:21.371840 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:49:31.387482 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:49:31.387762 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:49:41.403499 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:49:41.403822 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)馬上生效,客戶端的連接并沒有退出.再次修改為net.ipv4.tcp_keepalive_time = 100
# 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: 100

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:53:51.803467 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:53:51.803768 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)net.ipv4.tcp_keepalive_time = 100
11:55:31.963461 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:55:31.963853 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
11:57:12.059436 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:57:12.059884 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)馬上生效,間隔100秒客戶端的連接并沒有退出.再次修改為net.ipv4.tcp_keepalive_time = 180.
# 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: 180

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
11:57:12.059436 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
11:57:12.059884 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)net.ipv4.tcp_keepalive_time = 180
12:00:12.283427 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
12:00:12.283809 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
12:03:12.507470 IP 192.168.100.78.1521 > 192.168.98.6.62708: . ack 13033 win 330
12:03:12.507982 IP 192.168.98.6.62708 > 192.168.100.78.1521: . ack 12076 win 16166
--//修改參數(shù)馬上生效,間隔180秒.客戶端的連接并沒有退出.

--//現(xiàn)在重啟監(jiān)聽數(shù)據(jù)庫看看.
--//內(nèi)核參數(shù)設(shè)置如下
# 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: 180

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

--//重啟數(shù)據(jù)庫與監(jiān)聽.略....
# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
12:07:09.682897 IP 192.168.100.78.1521 > 192.168.98.6.64074: P 6669:6686(17) ack 7975 win 330
12:07:09.881094 IP 192.168.98.6.64074 > 192.168.100.78.1521: . ack 6686 win 16307
--//客戶端登錄,sqlplus scott/book@192.168.100.78:1521/book,注意:連接模式shared
12:09:09.552062 IP 192.168.100.78.1521 > 192.168.98.6.64074: P 6686:6696(10) ack 7975 win 330
12:09:09.751574 IP 192.168.98.6.64074 > 192.168.100.78.1521: . ack 6696 win 16304
12:10:09.562266 IP 192.168.100.78.1521 > 192.168.98.6.64074: P 6696:6706(10) ack 7975 win 330
12:10:09.762723 IP 192.168.98.6.64074 > 192.168.100.78.1521: . ack 6706 win 16302
--//開始第一個(gè)時(shí)間間隔2分鐘,然后1分鐘,可以發(fā)現(xiàn)現(xiàn)在起作用的是sqlnet.ora的SQLNET.EXPIRE_TIME = 1.而不是前面測試的內(nèi)核參數(shù)。
--//這也再次驗(yàn)證了在兩個(gè)都設(shè)置的情況下sqlnet.ora的SQLNET.EXPIRE_TIME優(yōu)先。

--//星期一上班繼續(xù)測試:
# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
08:37:16.765108 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 7520:7885(365) ack 9749 win 330
08:37:16.765893 IP 192.168.98.6.51673 > 192.168.100.78.1521: P 9749:9770(21) ack 7885 win 16425
08:37:16.766092 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 7885:8426(541) ack 9770 win 330
08:37:16.968199 IP 192.168.98.6.51673 > 192.168.100.78.1521: . ack 8426 win 16289
--//登錄專用模式,不執(zhí)行sql語句:
08:39:13.257561 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 8426:8436(10) ack 9770 win 330
08:39:13.459806 IP 192.168.98.6.51673 > 192.168.100.78.1521: . ack 8436 win 16287
08:40:13.268072 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 8436:8446(10) ack 9770 win 330
08:40:13.464091 IP 192.168.98.6.51673 > 192.168.100.78.1521: . ack 8446 win 16284
--//開始第一個(gè)時(shí)間間隔2分鐘,然后1分鐘,可以發(fā)現(xiàn)現(xiàn)在起作用的是sqlnet.ora的SQLNET.EXPIRE_TIME = 1
--//修改sqlnet.ora的SQLNET.EXPIRE_TIME = 2,不斷開連接.
08:41:13.278271 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 8446:8456(10) ack 9770 win 330
08:41:13.480887 IP 192.168.98.6.51673 > 192.168.100.78.1521: . ack 8456 win 16282
08:42:13.288492 IP 192.168.100.78.1521 > 192.168.98.6.51673: P 8456:8466(10) ack 9770 win 330
08:42:13.502150 IP 192.168.98.6.51673 > 192.168.100.78.1521: . ack 8466 win 16279
--//可以發(fā)現(xiàn)修改sqlnet.ora的SQLNET.EXPIRE_TIME = 2,間隔不會(huì)變化.
--//現(xiàn)在重新退出登錄數(shù)據(jù)庫.
# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
..
08:43:02.135091 IP 192.168.100.78.1521 > 192.168.98.6.52047: P 6671:6688(17) ack 8097 win 330
08:43:02.332762 IP 192.168.98.6.52047 > 192.168.100.78.1521: . ack 6688 win 16307
--//登錄專用模式,不執(zhí)行sql語句:
08:47:01.947602 IP 192.168.100.78.1521 > 192.168.98.6.52047: P 6688:6698(10) ack 8097 win 330
08:47:02.144894 IP 192.168.98.6.52047 > 192.168.100.78.1521: . ack 6698 win 16304
08:49:01.967818 IP 192.168.100.78.1521 > 192.168.98.6.52047: P 6698:6708(10) ack 8097 win 330
08:49:02.164352 IP 192.168.98.6.52047 > 192.168.100.78.1521: . ack 6708 win 16302
--//開始第一個(gè)時(shí)間間隔4分鐘,然后2分鐘,可以發(fā)現(xiàn)重新登錄后sqlnet.ora的SQLNET.EXPIRE_TIME = 2才生效.
--//可以發(fā)現(xiàn)與修改內(nèi)核參數(shù)不同,修改內(nèi)核參數(shù)馬上生效,不需要退出.

3.繼續(xù)測試:
--//還可以做一個(gè)測試驗(yàn)證我前面的對于共享模式的判斷
--//內(nèi)核參數(shù)設(shè)置如下:
# 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: 20

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

--//重啟數(shù)據(jù)庫與監(jiān)聽.
--//客戶端連接服務(wù)器。sqlplus scott/book@192.168.100.78:1521/book,連接模式shared

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
...
09:01:06.792451 IP 192.168.100.78.1521 > 192.168.98.6.54322: P 7986:8534(548) ack 9650 win 330
09:01:06.792837 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166 <nop,nop,sack 1 {7986:8534}>
--//以共享模式連接sqlplus scott/book@192.168.100.78:1521/book,不執(zhí)行任何sql語句.
09:01:26.795411 IP 192.168.100.78.1521 > 192.168.98.6.54322: . ack 9650 win 330
09:01:26.795686 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166
09:01:46.811467 IP 192.168.100.78.1521 > 192.168.98.6.54322: . ack 9650 win 330
09:01:46.811802 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166
--//可以發(fā)現(xiàn)20秒時(shí)間間隔.現(xiàn)在修改sqlnet.ora文件的SQLNET.EXPIRE_TIME = 1.
$ grep -i expire sqlnet.ora
SQLNET.EXPIRE_TIME = 1
--//繼續(xù)觀察...
09:02:06.843472 IP 192.168.100.78.1521 > 192.168.98.6.54322: . ack 9650 win 330
09:02:06.843830 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166
09:02:26.875433 IP 192.168.100.78.1521 > 192.168.98.6.54322: . ack 9650 win 330
09:02:26.875828 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166
09:02:46.907427 IP 192.168.100.78.1521 > 192.168.98.6.54322: . ack 9650 win 330
09:02:46.907868 IP 192.168.98.6.54322 > 192.168.100.78.1521: . ack 8534 win 16166
--//可以還是間隔20秒.退出在登錄還是共享模式.
..
09:03:34.487441 IP 192.168.100.78.1521 > 192.168.98.6.54513: P 6736:6763(27) ack 7976 win 330
09:03:34.487686 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 6763 win 16228 <nop,nop,sack 1 {6736:6763}>
09:03:54.487425 IP 192.168.100.78.1521 > 192.168.98.6.54513: . ack 7976 win 330
09:03:54.487734 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 6763 win 16228

SCOTT@192.168.100.78:1521/book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID                     PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- -------------------- ------- ---------- --------------------------------------------------
       281          3 9496:10444               SHARED    23039                     20          1 alter system kill session '281,3' immediate;
--//spid=23039
$ ps -ef | grep 2303[9]
oracle   23039     1  0 09:00 ?        00:00:00 ora_s000_book

$ kill -9 23039

--//在共享模式下執(zhí)行,會(huì)出現(xiàn)短暫的等待:
SCOTT@192.168.100.78:1521/book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID                     PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- -------------------- ------- ---------- --------------------------------------------------
       281          3 9496:10444               SHARED    23106                     20          2 alter system kill session '281,3' immediate;
--//spid=23106,發(fā)生了變化,相當(dāng)于重新登錄.
# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
...
09:05:55.995425 IP 192.168.100.78.1521 > 192.168.98.6.54513: . ack 11341 win 330
09:05:55.995742 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 10305 win 16166
--//不執(zhí)行sql語句
09:06:16.027444 IP 192.168.100.78.1521 > 192.168.98.6.54513: . ack 11341 win 330
09:06:16.027734 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 10305 win 16166
09:06:36.059440 IP 192.168.100.78.1521 > 192.168.98.6.54513: . ack 11341 win 330
09:06:36.059751 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 10305 win 16166
09:06:56.091432 IP 192.168.100.78.1521 > 192.168.98.6.54513: . ack 11341 win 330
09:06:56.091779 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 10305 win 16166
-//還是20秒.現(xiàn)在kill s000與d000進(jìn)程.
$ ps -ef | grep ora_[sd]000
oracle   23037     1  0 09:00 ?        00:00:00 ora_d000_book
oracle   23106     1  0 09:05 ?        00:00:00 ora_s000_book

$ kill -9 23106 23037

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
...
09:08:15.909145 IP 192.168.100.78.1521 > 192.168.98.6.54513: F 10305:10305(0) ack 11341 win 330
09:08:15.909449 IP 192.168.98.6.54513 > 192.168.100.78.1521: . ack 10306 win 16166

--//原來的連接已經(jīng)斷開,重新以共享模式登錄:
SCOTT@192.168.100.78:1521/book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID                     PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- -------------------- ------- ---------- --------------------------------------------------
       267          1 7376:11148               SHARED    23132                     19          2 alter system kill session '267,1' immediate;

$ ps -ef | grep ora_[sd]000
oracle   23132     1  0 09:08 ?        00:00:00 ora_s000_book
oracle   23134     1  0 09:08 ?        00:00:00 ora_d000_book

# tcpdump -i eth0  host 192.168.98.6 and not port 22 and port 1521 -nnn
...
09:08:47.862829 IP 192.168.100.78.1521 > 192.168.98.6.54899: P 7986:8534(548) ack 9649 win 330
09:08:48.059474 IP 192.168.98.6.54899 > 192.168.100.78.1521: . ack 8534 win 16166
--//不執(zhí)行sql語句
09:10:43.827496 IP 192.168.100.78.1521 > 192.168.98.6.54899: P 8534:8544(10) ack 9649 win 330
09:10:44.027790 IP 192.168.98.6.54899 > 192.168.100.78.1521: . ack 8544 win 16164
09:11:43.837701 IP 192.168.100.78.1521 > 192.168.98.6.54899: P 8544:8554(10) ack 9649 win 330
09:11:44.047966 IP 192.168.98.6.54899 > 192.168.100.78.1521: . ack 8554 win 16161
09:12:43.847884 IP 192.168.100.78.1521 > 192.168.98.6.54899: P 8554:8564(10) ack 9649 win 330
09:12:44.040166 IP 192.168.98.6.54899 > 192.168.100.78.1521: . ack 8564 win 16159
--//這樣才會(huì)使用sqlnet.ora的SQLNET.EXPIRE_TIME = 1.

4.補(bǔ)充說明共享模式與專用模式的問題:
--//個(gè)人在連接共享模式與專用模式上栽過許多坑。我的測試環(huán)境一直配置如下:
SCOTT@192.168.100.78:1521/book> show parameter dispatchers
NAME            TYPE     VALUE
--------------- -------- --------------------------------------
dispatchers     string   (PROTOCOL=TCP) (SERVICE=book,bookXDB)
max_dispatchers integer

SYS@book> show parameter service
NAME          TYPE   VALUE
------------- ------ ---------------
service_names string BOOK, BOOKSHARE

--//服務(wù)名book支持兩種連接模式
--//建議共享模式與專用模式的服務(wù)名不要共用相同的服務(wù)名,單獨(dú)分開。
--//有一些應(yīng)用配置連接串時(shí),選擇默認(rèn)連接,這樣tnsnames.ora配置文件中沒有(SERVER = SHARED|DEDICATED)
--//如果服務(wù)名支持兩種連接模式,優(yōu)先選擇共享模式。ezconnect沒有明確連接模式時(shí)也是一樣。如果明確指明
--//寫法如下:
--//sqlplus scott/book@192.168.100.78:1521/book:DEDICATED


5.總結(jié):
--//寫的有點(diǎn)亂長。我前面的問題在于我連接時(shí)使用的是ezconnect,正好服務(wù)名支持2種模式,優(yōu)先使用共享模式。
--//導(dǎo)致我修改sqlnet.ora expire_time=1無效的假象。
--//在兩個(gè)都設(shè)置的情況下,sqlnet.ora expire_time優(yōu)先.
--//個(gè)人主張采用設(shè)置內(nèi)核參數(shù)net.ipv4.tcp_keepalive_time = 590的方法,不要設(shè)置在sqlnet.ora中設(shè)置expire_time。
--//這里590來源于我的測試,鏈接:http://blog./267265/viewspace-2150614/=>[20180129]測量網(wǎng)絡(luò)斷開時(shí)間.txt
--//修改內(nèi)核參數(shù)馬上生效,而修改sqlnet.ora的sqlnet.ora expire_time參數(shù)要重新登錄才有效.
--//注意共享模式的問題,就是如果你沒有設(shè)置sqlnet.ora中expire_time,也許要重啟數(shù)據(jù)庫才有效.

--//最后實(shí)際上上面遇到的問題并不重要.但是如果你不去探究,就很容易失去了解學(xué)習(xí)的機(jī)會(huì).

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    日韩熟妇人妻一区二区三区| 亚洲一区二区福利在线| 激情内射日本一区二区三区| 中国黄色色片色哟哟哟哟哟哟| 亚洲精品成人午夜久久| 久久99夜色精品噜噜亚洲av| 少妇在线一区二区三区| 免费播放一区二区三区四区| 国产一区在线免费国产一区| 大香蕉大香蕉手机在线视频| 国产免费操美女逼视频| 色老汉在线视频免费亚欧| 欧美人禽色视频免费看| 99热九九热这里只有精品| 久久福利视频这里有精品| 亚洲成人久久精品国产| 久热人妻中文字幕一区二区| 国产老熟女乱子人伦视频| 婷婷基地五月激情五月| 东京热加勒比一区二区| 国产一级一片内射视频在线| 日韩欧美国产精品中文字幕| 好东西一起分享老鸭窝| 四季精品人妻av一区二区三区| 少妇成人精品一区二区| 亚洲一区二区三区日韩91| 亚洲精品深夜福利视频| 欧美久久一区二区精品| 日韩欧美精品一区二区三区| 国产精品午夜视频免费观看| 中文字幕日韩精品人一妻| 午夜精品久久久99热连载| 国产精品亚洲综合天堂夜夜| 亚洲国产欧美久久精品| 亚洲熟妇熟女久久精品| 国产日韩欧美在线亚洲| 国产一区二区三区草莓av| 国产精品欧美激情在线播放| 免费观看一级欧美大片| 国产成人亚洲欧美二区综| 免费一级欧美大片免费看|