INBOUND_CONNECT_TIMEOUT與SQLNET.INBOUND_CONNECT_TIMEOUT小結

lhrbest發表於2019-09-09


INBOUND_CONNECT_TIMEOUT與SQLNET.INBOUND_CONNECT_TIMEOUT小結


關於sqlnet.ora的引數SQLNET.INBOUND_CONNECT_TIMEOUT,它表示等待使用者認證超時的時間,單位是秒,預設值是60秒,如果使用者認證超時了,伺服器日誌alert.log顯示出錯資訊"WARNING: inbound connection timed out (ORA-3136)",sqlnet.log裡面出現TNS-12535: TNS:operation timed out錯誤資訊。

   關於listener.ora的引數inbound_connect_timeout_監聽器名,它表示等待使用者連線請求超時的時間,單位是秒,預設值是60秒,如果連線請求超時了,監聽器日誌listener.log顯示出錯資訊"TNS-12525: TNS:listener has not received client's request in time allowed"。

   其中sqlnet.ora裡面的引數為SQLNET.INBOUND_CONNECT_TIMEOUT, listener.ora裡面的引數設定為INBOUND_CONNECT_TIMEOUT_listener_name ,其中根據監聽名字來替換listener_name。官方文件關於兩者的介紹如下所示:

 

SQLNET.INBOUND_CONNECT_TIMEOUT parameter in sqlnet.ora  on the database server

Specify the time, in seconds, for a client to connect with the database server and provide the necessary authentication information. If the client fails to establish a connection and complete authentication in the time specified, then the database server terminates the connection. In addition, the database server logs the IP address of the client and an ORA-12170: TNS:Connect timeout occurred error message to the sqlnet.log file. The client receives either an ORA-12547: TNS:lost contact or an ORA-12637: Packet receive failed error message.

INBOUND_CONNECT_TIMEOUT_listener_name in listener.ora

Specify the time, in seconds, for the client to complete its connect request to the listener after the network connection had been established.

If the listener does not receive the client request in the time specified, then it terminates the connection. In addition, the listener logs the IP address of the client and an ORA-12525: TNS:listener has not received client’s request in time allowed error message to the listener.log file

 

檢視inbound_connect_timeout值

1:檢視SQLNET.INBOUND_CONNECT_TIMEOUT的設定值,一般進入$ORACLE_HOME/network/admin下,檢視sqlnet.ora引數檔案即可。

2:檢視監聽INBOUND_CONNECT_TIMEOUT引數,可以檢視listener.ora引數檔案。但是有時候,例如預設情況,引數檔案裡面沒有設定這個引數,或是有些動態監聽沒有配置listener.ora,那麼可以使用lsnrctl命令檢視,如下所示:

LSNRCTL> show
The following operations are available after show
An asterisk (*) denotes a modifier or extended command:

rawmode                     displaymode
rules                       trc_file
trc_directory               trc_level
log_file                    log_directory
log_status                  current_listener
inbound_connect_timeout     startup_waittime
snmp_visible                save_config_on_stop
dynamic_registration

LSNRCTL> show inbound_connect_timeout
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 60
The command completed successfully
LSNRCTL>

clip_image001

 

設定SQLNET.INBOUND_CONNECT_TIMEOUT值

我們首先設定SQLNET.INBOUND_CONNECT_TIMEOUT為30秒,這個引數修改後立即生效,不需要做任何其它操作。

[oracle@DB-Server admin]$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.INBOUND_CONNECT_TIMEOUT=30


C:\Users>sqlplus /@mytest

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 2月 28 10:57:09 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


請輸入使用者名稱:

clip_image002

 

當30秒後,此時,在sqlnet.log裡面就能看到新增了一條關於TNS-12535的錯誤記錄,其中10.20.34.14是我客戶端的IP地址。

clip_image003

 

告警日誌裡面你會看到WARNING: inbound connection timed out (ORA-3136)錯誤。 有意思的是,監聽日誌裡面你不會看到任何錯誤資訊。(可以用了對比這兩個引數的區別)

clip_image004

 

設定INBOUND_CONNECT_TIMEOUT_listener_name的值

這個引數可以通過lsnrctl命令設定,如下所示,當然最簡單的還是設定listener.ora引數檔案。這個引數也是立即生效,不需要重啟監聽。

LSNRCTL> show inbound_connect_timeout
NL-00853: undefined show command "inbound_connect—meout".  Try "help show"
LSNRCTL> show inbound_connect_timeout
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 60
The command completed successfully
LSNRCTL> set inbound_connect_timeout 20
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 20
The command completed successfully
LSNRCTL> show inbound_connect_timeout
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 20
The command completed successfully
LSNRCTL>

clip_image005

此時我們用telnet來模擬使用者連線請求超時的時間,如下所示,當超過20秒,就會自動退出

[root@test ~]# time telnet 192.168.9.124 1521
Trying 192.168.9.124...
Connected to 192.168.9.124 (192.168.9.124).
Escape character is '^]'.
Connection closed by foreign host.

real    0m20.019s
user    0m0.001s
sys     0m0.003s

此時在listener.log裡面,你就能看到TNS-12525的錯誤,如下所示

28-FEB-2016 11:32:20 * <unknown connect data> * (ADDRESS=(PROTOCOL=tcp)(HOST=10.20.34.14)(PORT=38051)) * establish * <unknown sid> * 12525

TNS-12525: TNS:listener has not received client's request in time allowed

TNS-12535: TNS:operation timed out

TNS-12606: TNS: Application timeout occurred

注意:set inbound_connect_timeout只對當前環境生效,如果重啟監聽服務,則會失效,如下所示

LSNRCTL> set inbound_connect_timeout 18
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 18
The command completed successfully
LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
LSNRCTL> show inbound_connect_timeout
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER parameter "inbound_connect_timeout" set to 60
The command completed successfully

clip_image006

此時需要使用命令set save_config_on_stop on儲存配置資訊,使其永遠生效。但是我測試發現,動態監聽也無法使用set save_config_on_stop on儲存配置資訊,需要修改配置檔案(注意,修改listener.ora,需要重啟監聽使之生效)。如下所示

clip_image007

 

關於兩者之間的關係,一般INBOUND_CONNECT_TIMEOUT_listener_name的值應該低於SQLNET.INBOUND_CONNECT_TIMEOUT的值,官方文件介紹如下,

When specifying values for these parameters, consider the following

recommendations:

Set both parameters to an initial low value.

Set the value of the INBOUND_CONNECT_TIMEOUT_listener_name parameter  to a lower value than the SQLNET.INBOUND_CONNECT_TIMEOUT parameter.

For example, you can set INBOUND_CONNECT_TIMEOUT_listener_name to 2  seconds and INBOUND_CONNECT_TIMEOUT parameter to 3 seconds. If clients are  unable to complete connections within the specified time due to system or network delays that are normal for the particular environment, then increment the time as  needed.




About Me

........................................................................................................................

● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除

● 本文在itpub、部落格園、CSDN和個人微 信公眾號( xiaomaimiaolhr)上有同步更新

● 本文itpub地址: http://blog.itpub.net/26736162

● 本文部落格園地址: http://www.cnblogs.com/lhrbest

● 本文CSDN地址: https://blog.csdn.net/lihuarongaini

● 本文pdf版、個人簡介及小麥苗雲盤地址: http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答: http://blog.itpub.net/26736162/viewspace-2134706/

● DBA寶典今日頭條號地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

........................................................................................................................

● QQ群號: 230161599 、618766405

● 微 信群:可加我微 信,我拉大家進群,非誠勿擾

● 聯絡我請加QQ好友 646634621 ,註明新增緣由

● 於 2019-09-01 06:00 ~ 2019-09-31 24:00 在西安完成

● 最新修改時間:2019-09-01 06:00 ~ 2019-09-31 24:00

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

........................................................................................................................

小麥苗的微店https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

小麥苗出版的資料庫類叢書http://blog.itpub.net/26736162/viewspace-2142121/

小麥苗OCP、OCM、高可用網路班http://blog.itpub.net/26736162/viewspace-2148098/

小麥苗騰訊課堂主頁https://lhr.ke.qq.com/

........................................................................................................................

使用 微 信客戶端掃描下面的二維碼來關注小麥苗的微 信公眾號( xiaomaimiaolhr)及QQ群(DBA寶典)、新增小麥苗微 信, 學習最實用的資料庫技術。

........................................................................................................................

歡迎與我聯絡

 

 



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

相關文章