简体   繁体   English

Oracle ManagedDataAccess - 连接请求超时 - 池化

[英]Oracle ManagedDataAccess - Connection Request Timed out - Pooling

I'm finally admitting defeat and asking for help.我终于承认失败并寻求帮助。 I've done everything I can think of to solve this problem, but it seems I'm incapable of doing it.我已经做了我能想到的一切来解决这个问题,但似乎我无能为力。

I'm working with: VS2010 C# Oracle 12c ODP.Net Managed121012我正在使用:VS2010 C# Oracle 12c ODP.Net Managed121012

I have inherited an app that uses both the managed and unmanaged dataaccess dll.我继承了一个同时使用托管和非托管数据访问 dll 的应用程序。 It was working until I de-installed oracle.在我卸载 oracle 之前它一直在工作。 I then re-installed the 11g client for a 64bit machine.然后我为 64 位机器重新安装了 11g 客户端。 Right away I noticed that there was only dataaccess dll for framework 2 installed, but I continued anyway.我马上注意到只有用于框架 2 的 dataaccess dll 安装,但我还是继续了。 I then copied all the oci and ora dlls from the client_1 folder into the bin directory of my app as well as the Oracle.DataAccess.dll into my bin directory too.然后,我将 client_1 文件夹中的所有 oci 和 ora dll 复制到我的应用程序的 bin 目录中,并将 Oracle.DataAccess.dll 也复制到我的 bin 目录中。 I also copied Oracle.ManagedDataAccess.dll into this folder.我还将 Oracle.ManagedDataAccess.dll 复制到此文件夹中。

My application ran successfully as long as I didn't change anything on my datasets.只要我没有更改数据集上的任何内容,我的应用程序就会成功运行。 I would have happily carried on like this, except I have to create more datasets.我会很高兴地继续这样下去,除非我必须创建更多的数据集。 When I tried to add a new dataset, my data source connection wizard drop down list was blank.当我尝试添加新数据集时,我的数据源连接向导下拉列表是空白的。 Then I tried to re-create the connections, but could only see the .Net Framework DProviders.然后我尝试重新创建连接,但只能看到 .Net Framework DProviders。 I could not see the managed provider.我看不到托管提供程序。 At some point I also got this error "no data provider is currently selected".在某些时候,我也收到了这个错误“当前没有选择数据提供者”。

Thinking it's because the managed provider wasn't installed I uninstalled the 11g client and installed the 64bit 12c client and copied all the relevant files into the bin of my app.认为这是因为没有安装托管提供程序我卸载了 11g 客户端并安装了 64 位 12c 客户端并将所有相关文件复制到我的应用程序的 bin 中。 I added the following lines to my app.config file:我在 app.config 文件中添加了以下几行:

      <configSections>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />

  <system.data>
<DbProviderFactories>
  <remove invariant="Oracle.DataAccess.Client" />
  <remove invariant="Oracle.ManagedDataAccess.Client" />
  <add name="ODP.NET, Managed Driver" invariant="Oracle.DataAccess.Client"
         description="Oracle Data Provider for .NET, Managed Driver"
         type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />     
</DbProviderFactories>

After this I can now see some of the old data sources, but I can't connect to my database because I get a "Connection Request Timed out".在此之后,我现在可以看到一些旧的数据源,但我无法连接到我的数据库,因为我收到“连接请求超时”。 When I manually creating a new connection, I can connect fine with the unmanaged provider, but get a connection request timed out error.当我手动创建新连接时,我可以与非托管提供程序正常连接,但出现连接请求超时错误。

I'm really at the end of my rope and would really appreciate fresh eyes before I use the rope.我真的在我的绳索的尽头,并且在我使用绳索之前真的很感激新鲜的眼睛。

Thanks in advance.提前致谢。

I had identical problem after switching to managed driver. 切换到托管驱动程序后我遇到了同样的问题。 Even wrote a test app using both native and managed drivers. 甚至使用本机和托管驱动程序编写了测试应用程序。 The conclusion was that the managed driver needs much more time to open new connection than the native driver. 结论是托管驱动程序需要比本机驱动程序更多的时间来打开新连接。 A solution that worked for us was to set a large connection timeout using connection string. 对我们有用的解决方案是使用连接字符串设置大的连接超时。

<connectionStrings>
    <add name="ConnectionString" connectionString="data source=xxxx;user id=xxxx;password=xxxx;persist security info=false;Connection Timeout=120;" />

</connectionStrings>

Just in case anyone is suffering from this issue when running on mono 4.8. 以防万一在运行mono 4.8时遇到此问题。 There seems to be a synchronization bug, causing Oracle client is unable to extend connection pool once all connections are used. 似乎存在同步错误,导致Oracle客户端在使用所有连接后无法扩展连接池。 See this bug 看到这个bug

We saw this same error when doing some testing using the immediate window in Visual Studio.在 Visual Studio 中使用即时窗口进行一些测试时,我们看到了同样的错误。 We were really confused for awhile until we ran the code normally (not using the immediate window) and the problem went away.我们真的很困惑一段时间,直到我们正常运行代码(不使用即时窗口)并且问题消失了。 So there is some kind of interaction with the Oracle ManagedDataAccess and the immediate window in Visual Studio that can cause this error.因此,与 Oracle ManagedDataAccess 和 Visual Studio 中的即时窗口的某种交互可能导致此错误。

I know this isn't going to be the answer for most of you, but I hope it's useful to someone.我知道这不会成为你们大多数人的答案,但我希望它对某人有用。

Please check the Oracle output parameter.请检查 Oracle 输出参数。 Because my application also was facing the same scenario.因为我的应用程序也面临同样的情况。

We changed oracle output parameter to Refcursor .我们将 oracle输出参数更改为Refcursor Maybe this solution is useful.也许这个解决方案很有用。

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

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