您的位置:首页 > 数据库

INBOUND_CONNECT_TIMEOUT与SQLNET.INBOUND_CONNECT_TIMEOUT小结

2016-02-28 12:10 399 查看
关于sqlnet.ora的参数SQLNET.INBOUND_CONNECT_TIMEOUT,它表示等待用户认证超时的时间,单位是秒,缺省值是60秒,如果用户认证超时了,服务器日志alert.log显示出错信息"WARNING:inboundconnectiontimedout(ORA-3136)",sqlnet.log里面出现TNS-12535:TNS:operationtimedout错误信息。关于listener.ora的参数inbound_connect_timeout_监听器名,它表示等待用户连接请求超时的时间,单位是秒,缺省值是60秒,如果连接请求超时了,监听器日志listener.log显示出错信息"TNS-12525:TNS:listenerhasnotreceivedclient'srequestintimeallowed"。其中sqlnet.ora里面的参数为SQLNET.INBOUND_CONNECT_TIMEOUT,listener.ora里面的参数设置为INBOUND_CONNECT_TIMEOUT_listener_name,其中根据监听名字来替换listener_name。官方文档关于两者的介绍如下所示:SQLNET.INBOUND_CONNECT_TIMEOUTparameterinsqlnet.oraonthedatabaseserverSpecifythetime,inseconds,foraclienttoconnectwiththedatabaseserverandprovidethenecessaryauthenticationinformation.Iftheclientfailstoestablishaconnectionandcompleteauthenticationinthetimespecified,thenthedatabaseserverterminatestheconnection.Inaddition,thedatabaseserverlogstheIPaddressoftheclientandanORA-12170:TNS:Connecttimeoutoccurrederrormessagetothesqlnet.logfile.TheclientreceiveseitheranORA-12547:TNS:lostcontactoranORA-12637:Packetreceivefailederrormessage.INBOUND_CONNECT_TIMEOUT_listener_nameinlistener.oraSpecifythetime,inseconds,fortheclienttocompleteitsconnectrequesttothelistenerafterthenetworkconnectionhadbeenestablished.Ifthelistenerdoesnotreceivetheclientrequestinthetimespecified,thenitterminatestheconnection.Inaddition,thelistenerlogstheIPaddressoftheclientandanORA-12525:TNS:listenerhasnotreceivedclient’srequestintimeallowederrormessagetothelistener.logfile查看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
Thefollowingoperationsareavailableaftershow
Anasterisk(*)denotesamodifierorextendedcommand:
rawmodedisplaymode
rulestrc_file
trc_directorytrc_level
log_filelog_directory
log_statuscurrent_listener
inbound_connect_timeoutstartup_waittime
snmp_visiblesave_config_on_stop
dynamic_registration
LSNRCTL>showinbound_connect_timeout
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto60
Thecommandcompletedsuccessfully
LSNRCTL>





设置SQLNET.INBOUND_CONNECT_TIMEOUT值

我们首先设置SQLNET.INBOUND_CONNECT_TIMEOUT为30秒,这个参数修改后立即生效,不需要做任何其它操作。

[oracle@DB-Serveradmin]$visqlnet.ora
#sqlnet.oraNetworkConfigurationFile:/u01/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
#GeneratedbyOracleconfigurationtools.
NAMES.DIRECTORY_PATH=(TNSNAMES,EZCONNECT)
SQLNET.INBOUND_CONNECT_TIMEOUT=30
C:\Users>sqlplus/@mytest
SQL*Plus:Release11.2.0.1.0Productionon星期日2月2810:57:092016
Copyright(c)1982,2010,Oracle.Allrightsreserved.
ERROR:
ORA-01017:invalidusername/password;logondenied
请输入用户名:





当30秒后,此时,在sqlnet.log里面就能看到新增了一条关于TNS-12535的错误记录,其中10.20.34.14是我客户端的IP地址。



告警日志里面你会看到WARNING:inboundconnectiontimedout(ORA-3136)错误。有意思的是,监听日志里面你不会看到任何错误信息。(可以用了对比这两个参数的区别)




设置INBOUND_CONNECT_TIMEOUT_listener_name的值

这个参数可以通过lsnrctl命令设置,如下所示,当然最简单的还是设置listener.ora参数文件。这个参数也是立即生效,不需要重启监听。

LSNRCTL>showinbound_connect_timeout
NL-00853:undefinedshowcommand"inbound_connect—meout".Try"helpshow"
LSNRCTL>showinbound_connect_timeout
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto60
Thecommandcompletedsuccessfully
LSNRCTL>setinbound_connect_timeout20
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto20
Thecommandcompletedsuccessfully
LSNRCTL>showinbound_connect_timeout
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto20
Thecommandcompletedsuccessfully
LSNRCTL>




此时我们用telnet来模拟用户连接请求超时的时间,如下所示,当超过20秒,就会自动退出

[root@test~]#timetelnet192.168.9.1241521
Trying192.168.9.124...
Connectedto192.168.9.124(192.168.9.124).
Escapecharacteris'^]'.
Connectionclosedbyforeignhost.
real0m20.019s
user0m0.001s
sys0m0.003s

此时在listener.log里面,你就能看到TNS-12525的错误,如下所示

28-FEB-201611:32:20*<unknownconnectdata>*(ADDRESS=(PROTOCOL=tcp)(HOST=10.20.34.14)(PORT=38051))*establish*<unknownsid>*12525
TNS-12525:TNS:listenerhasnotreceivedclient'srequestintimeallowed
TNS-12535:TNS:operationtimedout
TNS-12606:TNS:Applicationtimeoutoccurred

注意:setinbound_connect_timeout只对当前环境生效,如果重启监听服务,则会失效,如下所示

LSNRCTL>setinbound_connect_timeout18
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto18
Thecommandcompletedsuccessfully
LSNRCTL>reload
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Thecommandcompletedsuccessfully
LSNRCTL>showinbound_connect_timeout
Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENERparameter"inbound_connect_timeout"setto60
Thecommandcompletedsuccessfully




此时需要使用命令setsave_config_on_stopon保存配置信息,使其永远生效。但是我测试发现,动态监听也无法使用setsave_config_on_stopon保存配置信息,需要修改配置文件(注意,修改listener.ora,需要重启监听使之生效)。如下所示



关于两者之间的关系,一般INBOUND_CONNECT_TIMEOUT_listener_name的值应该低于SQLNET.INBOUND_CONNECT_TIMEOUT的值,官方文档介绍如下,
Whenspecifyingvaluesfortheseparameters,considerthefollowing
recommendations:
Setbothparameterstoaninitiallowvalue.
SetthevalueoftheINBOUND_CONNECT_TIMEOUT_listener_nameparametertoalowervaluethantheSQLNET.INBOUND_CONNECT_TIMEOUTparameter.
Forexample,youcansetINBOUND_CONNECT_TIMEOUT_listener_nameto2secondsandINBOUND_CONNECT_TIMEOUTparameterto3seconds.Ifclientsareunabletocompleteconnectionswithinthespecifiedtimeduetosystemornetworkdelaysthatarenormalfortheparticularenvironment,thenincrementthetimeasneeded.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: