`

(转)连接到oracle10g,报ORA-03135错误

 
阅读更多

转自:http://blog.csdn.net/rudyMatrix/article/details/5344801

 

问题描述:

开发人员报告,用myeclipse连接oracle后,过一段时间,连接断开,报ORA-03135错误。

 

问题挖掘:

用pl/sql和sqlplus连接oracle,也存在该问题,确定该问题与连接方式无关

查看服务器,发现没有防火墙,防火墙因素排除。

ping -t 服务器地址,发现没有丢包,都100%收到,网络通畅。

基本可以肯定问题出在oracle参数配置上。但也不排除其他因素。

 

解决过程:

 

根据ora-03135查询到oracle官方的解决方案:

ORA-03135: connection lost contact

Cause: 1) Server unexpectedly terminated or was forced to terminate. 2) Server timed out the connection.

Action: 1) Check if the server session was terminated. 2) Check if the timeout parameters are set properly in sqlnet.ora.

 

查询相关资料,发现该问题可能与sqlnet.ora设置参数SQLNET.EXPIRE_TIME 有关。因此server上面的sqlnet.ora设置参数SQLNET.EXPIRE_TIME = 5(需在服务器监听reload一下使参数生效:lsnrctl reload),而在client不设置该参数,。等待一段时间后,没有出现该问题了,问题解决。

 

知识扩展:

在server端的sqlnet.ora文件中设置SQLNET.EXPIRE_TIME这一参数可以启用DCD功能,DCD是Dead Connection Detection的缩写,用于检查死掉但没有断开的session。

 

 

 

 

DCD可以用于防止防火墙的timeout。

 

当新连接建立的时候,会读取sqlnet.ora中的这一设定,当20分钟间隔到达时,对inactive的session发送”probe” SQL*NET packet来确认client是否活着。如果已经死掉,那么相对应的resource会被自动清除。
如果client和server中间有防火墙,防火墙设有timeout参数,例如设置为一个小时,当一个小时中client和server间没有数据传输的时候,防火墙会断开连接。开启DCD后,通过设置SQLNET.EXPIRE_TIME的值小于防火墙的timeout参数可以避免这一情况。“probe” package确保防火墙不会断开idle的session。

 

 

参考资料:

sqlnet.ora http://www.orafaq.com/wiki/Sqlnet.ora

oracle DCD  http://www.dbafan.com/blog/?p=174

sqlnet.expire_time and IDLE_TIME http://space.itpub.net/10687595/viewspace-420407

SQLNET.EXPIRE_TIME 的官方说明

Purpose

Use parameter SQLNET.EXPIRE_TIME to specify a the time interval, in minutes, to send a probe to verify that client/server connections are active. Setting a value greater than 0 ensures that connections are not left open indefinitely, due to an abnormal client termination. If the probe finds a terminated connection, or a connection that is no longer in use, it returns an error, causing the server process to exit. This parameter is primarily intended for the database server, which typically handles multiple connections at any one time.

Limitations on using this terminated connection detection feature are:

·         It is not allowed on bequeathed connections.

·         Though very small, a probe packet generates additional traffic that may downgrade network performance.

·         Depending on which operating system is in use, the server may need to perform additional processing to distinguish the connection probing event from other events that occur. This can also result in degraded network performance.

Default

0

Minimum Value

0

Recommended Value

10

Example

SQLNET.EXPIRE_TIME=10


例如:
SQLNET.EXPIRE_TIME = 20
可以设置为任意数值,单位分钟。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics