[20191108]核心引數tcp_keepalive與sqlnet.ora expire_time的一些總結.txt
[20191108]核心引數tcp_keepalive與sqlnet.ora expire_time的一些總結.txt
--//前幾天在做12c DCD SQLNET.EXPIRE_TIME相關測試時,在11g資料庫遇到1個古怪的問題,就是設定sqlnet.expire_time無效.不知道為
--//什麼?以前做過類似測試就是在兩個都設定的情況下,sqlnet.ora expire_time優先.
--//我當時的情況如下,設定核心引數如下:
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9
--//引數解析:
/proc/sys/net/ipv4/tcp_keepalive_time 當keepalive起用的時候,TCP傳送keepalive訊息的頻度。預設是2小時。
/proc/sys/net/ipv4/tcp_keepalive_intvl 當探測沒有確認時,keepalive探測包的傳送間隔。預設是75秒。
/proc/sys/net/ipv4/tcp_keepalive_probes 如果對方不予應答,keepalive探測包的傳送次數。預設值是9。
--//sqlnet.ora,沒有設定#SQLNET.EXPIRE_TIME.
$ grep -i expire sqlnet.ora
#SQLNET.EXPIRE_TIME = 1
--//我當時以為取消註解就可以測試,實際上沒有出現探測包。我自己當時思路有點亂,乾脆選擇重啟資料庫與監聽。
--//正好現在有空分析看看當時產生問題的原因。
1.環境:
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
--//設定核心引數如下:
# 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.測試:
--//測試前重啟資料庫與監聽,避免一些干擾.
--//從客戶端連線伺服器:
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
--//執行@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
--//可以發現間隔60秒.受核心引數net.ipv4.tcp_keepalive_time = 60
--//修改核心引數net.ipv4.tcp_keepalive_time = 30,繼續測試:
# 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
--//可以當前會話探測包發出間隔30秒.也就是修改核心引數net.ipv4.tcp_keepalive_time = 30馬上生效。客戶端退出在進入:
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}>
--//重新登入不執行任何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
--//可以發現當前間隔30秒.受核心引數net.ipv4.tcp_keepalive_time = 30.
--//現在修改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
--//可以當前會話不受影響,時間間隔30秒.客戶端退出在進入:
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}>
--//重新登入不執行任何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
--//開始第一個時間間隔2分鐘,然後1分鐘,可以發現現在起作用的是sqlnet.ora的SQLNET.EXPIRE_TIME = 1.
--//從這裡可以看出在兩者設定的情況下sqlnet.ora的SQLNET.EXPIRE_TIME設定優先.而且根本不需要重啟監聽與資料庫.
--//為什麼我前面的測試有問題呢,問題到底在那裡呢?我仔細回憶我前面的測試,難道問題出在連線模式上嗎?重新登入:
>>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;
--//注意:當前的連線模式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
--//重新登入不執行任何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
--//時間間隔是30秒.這個就是我前面測試遇到的情況,我開始設定net.ipv4.tcp_keepalive_time = 7200太大了.根本看不到網路探測包。
--//也就是在使用共享模式登入的時候,受核心引數的控制,因為當時啟動資料庫時沒有SQLNET.EXPIRE_TIME設定,而其對應程式已經啟
--//動(指ora_s000_book,ora_d000_book),這樣共享模式的連線繼承了相關程式的設定,依舊使用核心引數。
$ ps -ef | grep 6083[0]
oracle 60830 1 0 11:21 ? 00:00:00 ora_s000_book
--//直接修改核心引數net.ipv4.tcp_keepalive_time = 10,注意修改時沒有退出客戶端連線:
# 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
--//修改引數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
--//修改引數馬上生效,客戶端的連線並沒有退出.再次修改為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
--//修改引數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
--//修改引數馬上生效,間隔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
--//修改引數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
--//修改引數馬上生效,間隔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
$ 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
..
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
--//開始第一個時間間隔2分鐘,然後1分鐘,可以發現現在起作用的是sqlnet.ora的SQLNET.EXPIRE_TIME = 1.而不是前面測試的核心引數。
--//這也再次驗證了在兩個都設定的情況下sqlnet.ora的SQLNET.EXPIRE_TIME優先。
--//星期一上班繼續測試:
# 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
--//登入專用模式,不執行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
--//開始第一個時間間隔2分鐘,然後1分鐘,可以發現現在起作用的是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
--//可以發現修改sqlnet.ora的SQLNET.EXPIRE_TIME = 2,間隔不會變化.
--//現在重新退出登入資料庫.
# 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
--//登入專用模式,不執行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
--//開始第一個時間間隔4分鐘,然後2分鐘,可以發現重新登入後sqlnet.ora的SQLNET.EXPIRE_TIME = 2才生效.
--//可以發現與修改核心引數不同,修改核心引數馬上生效,不需要退出.
3.繼續測試:
--//還可以做一個測試驗證我前面的對於共享模式的判斷
--//核心引數設定如下:
# 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
--//重啟資料庫與監聽.
--//客戶端連線伺服器。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,不執行任何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
--//可以發現20秒時間間隔.現在修改sqlnet.ora檔案的SQLNET.EXPIRE_TIME = 1.
$ grep -i expire sqlnet.ora
SQLNET.EXPIRE_TIME = 1
--//繼續觀察...
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
--//在共享模式下執行,會出現短暫的等待:
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,發生了變化,相當於重新登入.
# 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
--//不執行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秒.現在kill s000與d000程式.
$ 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
--//原來的連線已經斷開,重新以共享模式登入:
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
--//不執行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
--//這樣才會使用sqlnet.ora的SQLNET.EXPIRE_TIME = 1.
4.補充說明共享模式與專用模式的問題:
--//個人在連線共享模式與專用模式上栽過許多坑。我的測試環境一直配置如下:
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
--//服務名book支援兩種連線模式
--//建議共享模式與專用模式的服務名不要共用相同的服務名,單獨分開。
--//有一些應用配置連線串時,選擇預設連線,這樣tnsnames.ora配置檔案中沒有(SERVER = SHARED|DEDICATED)
--//如果服務名支援兩種連線模式,優先選擇共享模式。ezconnect沒有明確連線模式時也是一樣。如果明確指明
--//寫法如下:
--//sqlplus scott/book@192.168.100.78:1521/book:DEDICATED
5.總結:
--//寫的有點亂長。我前面的問題在於我連線時使用的是ezconnect,正好服務名支援2種模式,優先使用共享模式。
--//導致我修改sqlnet.ora expire_time=1無效的假象。
--//在兩個都設定的情況下,sqlnet.ora expire_time優先.
--//個人主張採用設定核心引數net.ipv4.tcp_keepalive_time = 590的方法,不要設定在sqlnet.ora中設定expire_time。
--//這裡590來源於我的測試,連結:http://blog.itpub.net/267265/viewspace-2150614/=>[20180129]測量網路斷開時間.txt
--//修改核心引數馬上生效,而修改sqlnet.ora的sqlnet.ora expire_time引數要重新登入才有效.
--//注意共享模式的問題,就是如果你沒有設定sqlnet.ora中expire_time,也許要重啟資料庫才有效.
--//最後實際上上面遇到的問題並不重要.但是如果你不去探究,就很容易失去了解學習的機會.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2663430/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 0503linux核心網路引數測試tcp_keepaliveLinuxTCP
- sqlnet.ora 新增:expire_time=10 意義SQL
- Table 引數總結
- Linux常用的一些核心引數(調優)Linux
- parallel rollback引數總結Parallel
- Table 引數總結 (ZT)
- SpringMVC中的引數繫結總結SpringMVC
- 【原創】sqlnet.ora常用引數研究SQL
- sqlnet.ora常用引數研究(轉帖)SQL
- Flink常用的配置引數總結
- Mybatis引數處理總結MyBatis
- 實用 JVM 引數總結JVM
- 引數調整案例總結
- RunLoop的一些學習與總結OOP
- sqlnet.ora SQLNET.AUTHENTICATION_SERVICES 引數SQL
- [20210826]核心引數kernel.sem.txt
- MySQL儲存過程in、out、inout引數示例與總結MySql儲存過程
- CentOS升級核心與容器執行時核心引數的關係CentOS
- Oracle 核心引數Oracle
- ORACLE核心引數Oracle
- 核心引數(轉)
- Python函式引數總結Python函式
- pre_page_sga引數總結
- mongod命令的一些引數以及引數--pidfilepath與mongod.lock區別Go
- sklearn與XGBoost庫xgboost演算法引數總結演算法
- [20171130]關於rman的一些總結.txt
- openai GPT引數(入參)使用總結OpenAIGPT
- linux 核心引數Linux
- Linux核心引數Linux
- linux中與Oracle有關的核心引數詳解LinuxOracle
- 與oracle緊密相關的unix/linux核心引數OracleLinux
- [20180126]核心引數tcp_keepalive.txtTCP
- MySQL中Redo Log相關的重要引數總結MySql
- SPRING實踐總結--引數註解的使用Spring
- 四元數的運用與總結
- consul配置引數大全、詳解、總結
- 歸檔日誌命令及引數總結
- linux中與Oracle有關的核心引數詳解(zhuan)LinuxOracle