Creating 32-bit ODP.Net OracleConnection object is very slow

不羁的心 提交于 2019-12-10 18:06:23

问题


I'm using the Oracle ODP.Net 11.2.0.2 provider to connect to an Oracle database. When I run the following code as a Console application, the creation of the OracleConnection object takes over 2 minutes:

using System;
using Oracle.DataAccess.Client;

namespace OracleConnectionTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Creating connection...");
            OracleConnection conn = new OracleConnection("Data Source=mydatabase;User Id=myuserid;Password=mypassword");

            Console.WriteLine("Opening connection...");
            conn.Open();

            Console.WriteLine("Closing connection");
            conn.Close();

            Console.WriteLine("Done");
        }
    }
}

The slow creation occurs whether I run the console application from the command line or from Visual Studio. However, if I run it with the debugger enabled (using F5), then it runs extremely quickly. If I compile the .Net project as 64-bit (and use the 64-bit Oracle client) it runs quickly. If I create the connection in a Windows Service application and start the service, it connects quickly. A co-worker is able to run the same code with the same 32-bit client installed and it runs quickly for him.

There must be something unique to my environment causing the slowdown. Where would I look to determine what is happening?


回答1:


Try creating the "log\diag\clients" directory structure in your Oracle home. See this blog post - the blogger had the same problem you had and resolved it by creating that directory structure.



来源:https://stackoverflow.com/questions/15009090/creating-32-bit-odp-net-oracleconnection-object-is-very-slow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!