简体   繁体   English

使用Oracle的ASP .Net连接池

[英]ASP .Net Connection Pooling With Oracle

Hello all respective genius there, thanks in advance. 大家好,各位天才,谢谢。

I have an Asp.NET Web service which have around 20 to 30 methods to expose . 我有一个Asp.NET Web服务,它提供了大约20到30种方法。 For database I am using Oracle database with the help of Delete repeated wordNet and a single class for the DB Operation and for every request I open the connection and close once its job get done for sure , means that I am closing all the connection there is no connection leak in my code. 对于数据库,我正在使用Delete重复的wordNet和DB操作的单个类来使用Oracle数据库,对于每个请求,我打开连接并确定完成其工作后就关闭它,这意味着我将关闭那里的所有连接我的代码中没有连接泄漏。 I have checked this like 10 times but as I go and check in the database (Oracle 11G) there are many session are inactive more than 20 hours . 我已经检查了10次,但是当我检查数据库(Oracle 11G)时,有超过20小时处于非活动状态的会话。 I am looking these sessions in V$Session table but I am very confused how they are not getting destroyed after long time even I am closing all the connections . 我正在V $ Session表中查找这些会话,但是我很困惑,即使关闭所有连接,它们也不会在长时间后被破坏。

Please share your answers with me because all I can do close all the connection and that I am doing very well but still there are many inactive session more than 20 hours . 请与我分享您的答案,因为我可以关闭所有连接,并且我做得很好,但是仍然有20多个小时的非活动会话。 How is this possible ? 这怎么可能 ?

We had similar problem in asp.net mvc project with connecting to Oracle Database (with pooling). 在asp.net mvc项目中,我们与连接到Oracle数据库(带有池)存在类似的问题。

After a long time we found out the problem was with oracle db-links. 很长一段时间后,我们发现问题出在oracle db-links。 If you calling a stored procedure which uses oracle db-link then you have to call DBMS_SESSION.CLOSE_DATABASE_LINK('db_link_name'); 如果调用使用oracle db-link的存储过程 ,则必须调用DBMS_SESSION.CLOSE_DATABASE_LINK('db_link_name'); at the beginning of stored procedure . 存储过程开始

For example: 例如:

PROCEDURE simple_procedure(refCur out SYS_REFCURSOR) AS BEGIN

    /* we don't really know if db-link is open or not */
    BEGIN
        DBMS_SESSION.CLOSE_DATABASE_LINK('dblink_name');
        EXCEPTION WHEN OTHERS THEN null;
    END;

    /* call db-link */
    OPEN refCur FOR SELECT * FROM DUAL@dblink_name

    EXCEPTION WHEN NO_DATA_FOUND THEN null;

END simple_procedure;

After this problems with session has gone. 之后,会话问题就消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM