在oracle中一直有10几个资源不释放,而且是处于非活动状态,甚至有的持续了1周多了,请问这是什么原因造成的?如下图所示:备注:程序里面所有连接数据库的地方连接完成后都已经关闭了连接。

解决方案 »

  1.   


    程序已经做了处理:包括正常退出和不正常退出都进行了数据库的关闭。 stmt.close();
    conn.close();
    if(conn!=null&&!conn.isClosed()){
    conn.close();
    }
    }catch(Exception err){ if(conn!=null&&!conn.isClosed()){
    conn.close();
    } err.printStackTrace();
    out.println("错误是 "+err.getMessage());
    }
      

  2.   

    配置 sqlnet.ora  sqlnet.expire_time 参数  单位分钟
      

  3.   

    是不是对D:\oracle\ora92\network\admin\sqlnet.ora 进行增加一个参数
    sqlnet.expire_time = 1(1是分钟数)
      

  4.   

    楼主,关闭链接时要做:
    OCISessionEnd
    OCIServerDetach
    OCIHandleFree
    看看你调用的函数中,是否包含了这几个方法。
      

  5.   

    谢谢您的解答,这几个方法我都不懂,我是在java程序里把打开的数据库连接关闭的。
    关闭方法在二楼。6楼能详细点吗?
      

  6.   

    对D:\oracle\ora92\network\admin\sqlnet.ora 进行增加一个参数
    sqlnet.expire_time = 1(1是分钟数)经过测试这个方法无效。
      

  7.   

    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.Default0
    Minimum Value0
    Recommended Value10
    ExampleSQLNET.EXPIRE_TIME=10
      

  8.   

    10几个资源不释放,而且是处于非活动状态,oracle 解锁下呗。