1. sqlnet.ora参数SQLNET.INBOUND_CONNECT_TIMEOUT
表示等待用户认证超时的时间,单位是秒,缺省值是60秒
如果用户认证超时了,服务器日志alert.log显示出错信息
"WARNING: inbound connection timed out (ORA-3136)"
举例:
连接监听器,不输入用户名/密码
sqlplus /@test
[oracle@MGT ~]$ sqlplus /@test
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jan 20 07:53:42 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
等一分钟后,alert.log报ora-3136错
Tue Jan 20 07:54:42 2009
WARNING: inbound connection timed out (ORA-3136)
编辑$ORACLE_HOME/network/admin/sqlnet.ora,设置参数SQLNET.INBOUND_CONNECT_TIMEOUT等于12秒
grep SQLNET.INBOUND_CONNECT_TIMEOUT $ORACLE_HOME/network/admin/sqlnet.ora
[oracle@MGT ~]$ grep SQLNET.INBOUND_CONNECT_TIMEOUT $ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.INBOUND_CONNECT_TIMEOUT=12
[oracle@MGT ~]$
再连接监听器,不输入用户名/密码
sqlplus /@test
[oracle@MGT ~]$ sqlplus /@test
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jan 20 07:59:39 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
过了12秒,alert.log又报错了
Tue Jan 20 07:59:51 2009
WARNING: inbound connection timed out (ORA-3136)
这个参数只要修改了sqlnet.ora配置文件,便立即生效,不需要重启监听器/数据库
2. listener.ora的参数inbound_connect_timeout_监听器名
表示等待用户连接请求超时的时间,单位是秒,缺省值是60秒
如果连接请求超时了,监听器日志listener.log显示出错信息
"TNS-12525: TNS:listener has not received client's request in time allowed"
服务器日志alert.log里不报错
举例:
用telnet命令在监听器端口建立连接
time telnet localhost 1521
过一分钟后,连接被断开
[oracle@MGT ~]$ time telnet localhost 1521
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
real 1m0.015s
user 0m0.001s
sys 0m0.002s
[oracle@MGT ~]$
同时监听器日志报错
20-JAN-2009 08:01:29 * 12502
TNS-12502: TNS:listener received no CONNECT_DATA from client
20-JAN-2009 08:02:32 ** (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=3871)) * establish ** 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
把参数修改成9秒
lsnrctl set inbound_connect_timeout 9
[oracle@MGT ~]$ lsnrctl set inbound_connect_timeout 9
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 20-JAN-2009 08:03:06
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER parameter "inbound_connect_timeout" set to 9
The command completed successfully
[oracle@MGT ~]$
再试
time telnet localhost 1521
[oracle@MGT ~]$ time telnet localhost 1521
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
real 0m9.004s
user 0m0.000s
sys 0m0.002s
[oracle@MGT ~]$
20-JAN-2009 08:03:28 ** (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=3891)) * establish ** 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
连接超时缩短为9秒
这个参数也是立即生效的,不需要重启监听器或数据库
也可以修改listener.ora配置文件,然后reload监听器,使新的参数生效
grep INBOUND_CONNECT_TIMEOUT $ORACLE_HOME/network/admin/listener.ora
lsnrctl reload
[oracle@MGT ~]$ grep INBOUND_CONNECT_TIMEOUT $ORACLE_HOME/network/admin/listener.ora
INBOUND_CONNECT_TIMEOUT_LISTENER=5
[oracle@MGT ~]$ lsnrctl reload
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 20-JAN-2009 08:05:44
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@MGT ~]$
指定时间后连接超时
[oracle@MGT ~]$ time telnet localhost 1521
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
real 0m5.006s
user 0m0.002s
sys 0m0.002s
[oracle@MGT ~]$
20-JAN-2009 08:06:06 ** (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=3916)) * establish ** 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
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/235507/viewspace-559916/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/235507/viewspace-559916/