简体   繁体   English

Oracle 错误:池连接请求超时

[英]Oracle Error: Pooled connection request timed out

Im using Oracle12c with the application written in C# and using Oracle.ManagedDataAccess.dll to handle the DB Connection.我将 Oracle12c 与 C# 中编写的应用程序一起使用,并使用 Oracle.ManagedDataAccess.dll 来处理数据库连接。

A product we have has started to occasionally throw this exception after running fine for years:我们有一个产品在运行多年后开始偶尔抛出这个异常:

Oracle.ManagedDataAccess.Client.OracleException (0xFFFFFC0C): Pooled connection request timed out
   at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()

I know the cause of this error.我知道这个错误的原因。 Looking at the code neither the OracleConnection or the OracleCommand objects are being disposed.查看代码,既没有处理 OracleConnection 也没有处理 OracleCommand 对象。 So these connections are building up until it eventually throws this exception.所以这些连接一直在建立,直到它最终抛出这个异常。

The fix is straight forward.修复很简单。 Wrap these in Using statements.将它们包装在Using语句中。 I dont need help with that.我不需要帮助。

However my interests me is why this problem has started now.然而,我感兴趣的是为什么这个问题现在开始了。 This software was running for years without issue.该软件运行多年没有问题。 They did some database maintenance, updated other software on the same server, then this problem started.他们做了一些数据库维护,更新了同一台服务器上的其他软件,然后这个问题就开始了。 I dont know what Db maintenance they did.我不知道他们做了什么 Db 维护。

The connection string in the application does not specify any pool attributes.应用程序中的连接字符串未指定任何池属性。

Is there a oracle db setting which would cause a lower amount of simultaneous connections in the database that could have caused this to start occurring?是否有 oracle db 设置会导致数据库中的同时连接数量减少,从而导致这种情况开始发生?

UPATE更新

I wrote a little test app to check the limit.我写了一个小测试应用程序来检查限制。 It just loops around and opens a connection, performs a basic query and doesnt dispose the connection.它只是循环并打开连接,执行基本查询并且不处理连接。 On my test system it starts throwing this exception after 640ish loops.在我的测试系统上,它在 640ish 循环后开始抛出此异常。 It varies give or take 10 loops each time i run it.每次我运行它时,它会给出或采用 10 个循环。

What is setting this limit?什么设置了这个限制?

I just had the same problem.我只是有同样的问题。

The reason, why you get that exception is, that the Oracle Pool Manager doesn't have a free connection anymore (per default you can have up to 100 connections).出现该异常的原因是 Oracle 池管理器不再有空闲连接(默认情况下您最多可以有 100 个连接)。 Often the reason for that problem are not closed connections (so 'using' was the right ways).该问题的原因通常不是关闭的连接(因此“使用”是正确的方法)。

Even though you already found a solid solutions for that problem, I want to add those:即使您已经为该问题找到了可靠的解决方案,我还是想补充一下:

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

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