ORACLE会话超时
自从数据库迁移后连接数据库总是提示会话不可用,和客户沟通才知到他们连接数据库的程序是从早上连上数据库后就一直保持连接状态,一天中需要执行几次操作,由于数据库中的会话连接有超时限制,造成客户端长时间没有操作,就会断开连接。
经过这次事件总结了Oracle关于超时退出的一些设置:
1 profile的idle_time限制
2 profile的connect_time限制
3 sqlnet的expire_time限制
4 sqlnet的INBOUND_CONNECT_TIMEOUT_listener_name限制
5 listener的CONNECT_TIMEOUT_listener_name限制
1,profile的idle_time限制
oracle用户的配置文件的密码策略是实时生效的,所见即所得。但是用户配置文件的资源限制是由resource_limit参数决定的。
单位是分钟,默认没记错的话应该是10分钟
要是修改的资源生效,需要设置resource_limit设置为true
alter system set resource_limit=true ;
如果在idle的时间内用户没有执行任何操作,会提示ORA-02396:exceeded maximum idle time, please connect again
2,profile的connect_time限制
默认是UNLIMITED,单位是分钟
用户在到达设置的时候后,不可以在继续操作,会提示ORA-02399: exceeded maximum connect time, you are being logged off
如果是设置1分钟,他会在将近2分钟的时候提醒你重新登录。
3,sqlnet的expire_time限制:
expire_time主要是在指定的时间去探测客户端是否可以连通,如果可以的话重新计时,否则就会断开
在执行rman的时候遇见:ORA-03135: connection lost contact,可以尝试将此值设置大些。(ID 729811.1)
4,sqlnet的inbound_connect_timieout_listener_name限制
单位是秒,默认值是60
Use the INBOUND_CONNECT_TIMEOUT_listener_name parameter to 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.
To protect both the listener and the database server, Oracle Corporation recommends setting this parameter in combination with theSQLNET.INBOUND_CONNECT_TIMEOUT parameter in the sqlnet.ora file. 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.
如果客户端在指定的时间内没有连接上数据库,会在listener.log日志中出现 ORA-12525,同时在alert日志中会报错ora-03136
5,listener的connect_timeout_listener-name限制,很少使用
CONNECT_TIMEOUT_listener_name=number
This parameter sets the number of seconds that the listener waits to get a valid SQL*Net version 2 connection request after a connection has been started. The listener drops the connection if the timeout is reached. Default is 10; if set to 0, it will wait forever.
参数值单位是秒,默认值是10s,如果建立监听后在设置的时间内没有反应将会断开连接。设置为0表示没有等待时间限制。
文章标题:?ORACLE会话超时
地址分享:
http://cdkjz.cn/article/jedsde.html