Oracle ENABLE=broken引數與TCP KeepAlive
環境:
資料庫伺服器端:
作業系統: Oracle linux6.5
資料庫: Oracle database 11.2.0.4
ip: 192.192.192.3
service_name:orcl
引數相關設定:
無sqlnet.ora檔案,listener未設定任何引數。net.ipv4.tcp_keepalive_time = 10,net.ipv4.tcp_keepalive_probes = 20,net.ipv4.tcp_keepalive_intvl = 2
客戶端:
作業系統: Oracle linux6.5
資料庫客戶端工具:sqlplus 11.2.0.4
ip: 192.192.192.4
引數相關設定:
無sqlnet.ora檔案。net.ipv4.tcp_keepalive_time = 6,net.ipv4.tcp_keepalive_probes = 10,net.ipv4.tcp_keepalive_intvl = 1
Linux核心TCP KeepAlive引數介紹:
net.ipv4.tcp_keepalive_time :在TCP連線空閒時間段內,核心會以此引數設定的 時間間隔傳送 tcp偵測包。單位秒。
net.ipv4.tcp_keepalive_probes :如果連續N個 發出去的tcp 偵測包沒有響應,則核心認為此TCP連線已經中斷了,並通知應用程式。 N即此引數設定的值。
net.ipv4.tcp_keepalive_intvl :如果發出去的tcp 偵測包沒有得到響應,那麼會以此引數設定的間隔傳送tcp 偵測包,直至得到響應,或者超過 net.ipv4.tcp_keepalive_probes設定的次數,被認為連線中斷 。單位秒。
例如:
按上面環境中資料庫伺服器的設定來說明,如果tcp連線空閒時間達到10秒,則 資料庫伺服器端會傳送一個tcp偵測包,如果此偵測包得到了響應,那麼 資料庫伺服器端會再等待10秒,如果10秒內tcp連線仍舊一直處於空閒狀態,那麼 庫伺服器端 會再傳送一個tcp偵測包,如此往復。如果 資料庫伺服器端 傳送的tcp偵測包沒有得到響應,那麼 資料庫伺服器端會每隔2秒傳送一個 tcp偵測包,直至得到響應後繼續按10秒的間隔發 tcp偵測包,或者,傳送的 tcp 偵測包達到了20個仍舊沒有得到響應,那麼 資料庫伺服器端會認為這tcp連線已經中斷了,給應用層程式發通知。
實驗1:
客戶端tnsname中不加ENABLE=broken引數。
# 客戶端連線資料庫 [oracle@oel6-11204-norac ~]$ sqlplus sys@orcl as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun Jun 12 22:59:26 2022 Copyright (c) 1982, 2013, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> # tcpdump抓包結果 22:59:40.001193 IP 192.192.192.3.1521 > 192.192.192.4.14330: Flags [.], ack 1995, win 162, options [nop,nop,TS val 13687124 ecr 13652371], length 0 22:59:40.001229 IP 192.192.192.4.14330 > 192.192.192.3.1521: Flags [.], ack 2728, win 199, options [nop,nop,TS val 13662372 ecr 13677083], length 0 22:59:50.002356 IP 192.192.192.3.1521 > 192.192.192.4.14330: Flags [.], ack 1995, win 162, options [nop,nop,TS val 13697125 ecr 13662372], length 0 22:59:50.002392 IP 192.192.192.4.14330 > 192.192.192.3.1521: Flags [.], ack 2728, win 199, options [nop,nop,TS val 13672373 ecr 13677083], length 0 23:00:00.004261 IP 192.192.192.3.1521 > 192.192.192.4.14330: Flags [.], ack 1995, win 162, options [nop,nop,TS val 13707127 ecr 13672373], length 0 23:00:00.004296 IP 192.192.192.4.14330 > 192.192.192.3.1521: Flags [.], ack 2728, win 199, options [nop,nop,TS val 13682375 ecr 13677083], length 0 23:00:10.005410 IP 192.192.192.3.1521 > 192.192.192.4.14330: Flags [.], ack 1995, win 162, options [nop,nop,TS val 13717128 ecr 13682375], length 0 23:00:10.005436 IP 192.192.192.4.14330 > 192.192.192.3.1521: Flags [.], ack 2728, win 199, options [nop,nop,TS val 13692376 ecr 13677083], length 0
實驗2:
客戶端tnsname中加ENABLE=broken引數。
# 客戶端連線資料庫 [oracle@oel6-11204-norac ~]$ sqlplus sys@orcl as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun Jun 12 22:59:26 2022 Copyright (c) 1982, 2013, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> # tcpdump抓包結果 23:04:28.163882 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13975287 ecr 13940532], length 0 23:04:28.163918 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13950534 ecr 13971245], length 0 23:04:30.123721 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13952494 ecr 13971245], length 0 23:04:30.127384 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13977250 ecr 13950534], length 0 23:04:36.127516 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13958498 ecr 13977250], length 0 23:04:36.128661 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13983251 ecr 13950534], length 0 23:04:38.163949 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13985287 ecr 13950534], length 0 23:04:38.163976 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13960534 ecr 13983251], length 0 23:04:42.129380 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13964500 ecr 13983251], length 0 23:04:42.129898 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13989253 ecr 13960534], length 0 23:04:48.129365 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13970500 ecr 13989253], length 0 23:04:48.129919 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13995253 ecr 13960534], length 0 23:04:48.164646 IP 192.192.192.3.1521 > 192.192.192.4.14447: Flags [.], ack 2025, win 162, options [nop,nop,TS val 13995287 ecr 13960534], length 0 23:04:48.164674 IP 192.192.192.4.14447 > 192.192.192.3.1521: Flags [.], ack 2726, win 199, options [nop,nop,TS val 13970535 ecr 13995253], length 0
結論:
通過上面兩個實驗的結果,我們可以知道,當客戶端沒有使用 ENABLE=broken引數時,只有資料庫服務端定時主動往客戶端傳送了tcp keepalive的偵測包,客戶端響應偵測包; 當客戶端使用了 ENABLE=broken引數後, 資料庫 服務端會定時 主動 往客戶端傳送了tcp keepalive的偵測包,客戶端也 會定時 主動往 資料庫服務端傳送了tcp keepalive的偵測包。
即 ENABLE=broken啟用了客戶端的 tcp keepalive功能,能夠讓沒有在應用層實現keepalive功能的客戶端也能感知到資料庫連線的中斷。
應用場景:
ENABLE=broken引數在複雜網路環境中,使用db link進行復雜的跨庫分散式事務操作中,比較有用。
因為在db link中預設情況下,客戶端呼叫服務端耗時的儲存過程或執行耗時的查詢,db link連線可能會被防火牆中斷,而此時客戶端卻無法感知到中斷,會一直持有資源,導致阻塞的發生。而如果db link客戶端上使用 ENABLE=broken引數, 客戶端便可以感知到中斷,並釋放其持有的資源。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69955733/viewspace-2900108/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle ENABLE=BROKENOracle
- 0503linux核心網路引數測試tcp_keepaliveLinuxTCP
- [20180126]核心引數tcp_keepalive.txtTCP
- TCP KeepAlive機制理解與實踐小結TCP
- PostgreSQL DBA(187) - TCP keepaliveSQLTCP
- pg中與執行計劃相關的配置(ENABLE_*)引數
- 聊聊TCP Keepalive、Netty和DockerTCPNettyDocker
- 對付Reset流氓干擾:TCP keepaliveTCP
- [轉載]TCP keepalive的詳解(解惑)TCP
- 實用TCP協議(2):TCP 引數優化TCP協議優化
- [20191108]核心引數tcp_keepalive與sqlnet.ora expire_time的一些總結.txtTCPSQL
- How to enable trace in OracleOracle
- Oracle 靜態引數與動態引數型別介紹Oracle型別
- enable password 7與enable secret的區別
- Oracle引數-隱藏引數Oracle
- [20200218]ENABLE=BROKEN在連線串中.txt
- TCP漫談之keepalive和time_waitTCPAI
- linux下使用TCP存活(keepalive)定時器LinuxTCP定時器
- oracle 引數Oracle
- ENABLE_DDL_LOGGING 引數使用 監控物件的DDL物件
- oracle隱含引數的檢視與修改Oracle
- Oracle引數檔案解析——引數解析Oracle
- [20200218]ENABLE=BROKEN在連線串中4.txt
- [20210201]dblink建立連線串使用ENABLE=BROKEN.txt
- Oracle 核心引數Oracle
- Oracle UNDO引數Oracle
- Oracle引數大全Oracle
- oracle引數配置Oracle
- oracle 效能引數Oracle
- ORACLE核心引數Oracle
- oracle引數整理Oracle
- [20170504]Linux TCP keepalive timers.txtLinuxTCP
- Oracle引數檔案 各引數解釋Oracle
- [20200218]無ENABLE=BROKEN在連線串中3.txt
- [20200219]strace跟蹤設定ENABLE=BROKEN的情況.txt
- Linux核心優化之TCP相關引數Linux優化TCP
- Windows系統下的TCP引數最佳化WindowsTCP
- Enable Oracle NUMA support with Oracle Server Version 11.2.0.1OracleServer