Oracle数据库SQLNET.INBOUND_CONNECT_TIMEOUT与inbound_connect_timeout_监听器名

概述

简单介绍下SQLNET.INBOUND_CONNECT_TIMEOUT与inbound_connect_timeout_监听器名。

一、SQLNET.INBOUND_CONNECT_TIMEOUT与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
LSNRCTL> show inbound_connect_timeout

在这里插入图片描述

三、设置SQLNET.INBOUND_CONNECT_TIMEOUT值

1、设置30s

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

$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: XX/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.INBOUND_CONNECT_TIMEOUT=30

在这里插入图片描述

2、模拟登录

$ sqlplus xx/xx@rforacle

在这里插入图片描述

在服务器上模拟失败登录是无效的。
在这里插入图片描述

3、观察日志(实际测试不止30s)

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

告警日志里面你会看到WARNING: inbound connection timed out (ORA-3136)错误。 有意思的是,监听日志里面你不会看到任何错误信息。
在这里插入图片描述

四、设置INBOUND_CONNECT_TIMEOUT_listener_name的值

1、设置

这个参数可以通过lsnrctl命令设置,如下所示,当然最简单的还是设置listener.ora参数文件。这个参数也是立即生效,不需要重启监听。
注意:set inbound_connect_timeout只对当前环境生效,如果重启监听服务,则会失效

LSNRCTL> show inbound_connect_timeout
LSNRCTL> set inbound_connect_timeout 20
LSNRCTL> show inbound_connect_timeout

在这里插入图片描述

2、模拟超时

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

# time telnet 172.16.10.119 1521

在这里插入图片描述

3、查看日志

此时在listener.log里面,你就能看到TNS-12525的错误,如下所示
在这里插入图片描述

五、两者关系

关于两者之间的关系,一般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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

淡定波007

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值