创建32位ODP.Net OracleConnection对象非常慢 [英] Creating 32-bit ODP.Net OracleConnection object is very slow

查看:94
本文介绍了创建32位ODP.Net OracleConnection对象非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Oracle ODP.Net 11.2.0.2提供程序连接到Oracle数据库.当我将以下代码作为控制台应用程序运行时,创建OracleConnection对象需要2分钟以上的时间:

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");
        }
    }
}

无论我是从命令行还是从Visual Studio运行控制台应用程序,都会发生创建缓慢的问题.但是,如果我在启用调试器(使用F5)的情况下运行它,则它运行得非常快.如果将.Net项目编译为64位(并使用64位Oracle客户端),则它将快速运行.如果我在Windows服务应用程序中创建连接并启动服务,则它会快速连接.同事可以在安装了相同32位客户端的情况下运行相同的代码,并且可以为他快速运行.

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?

推荐答案

尝试在Oracle主目录中创建"log \ diag \ clients"目录结构.参见此博客文章-博客作者拥有同样的问题,您可以通过创建该目录结构来解决.

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.

这篇关于创建32位ODP.Net OracleConnection对象非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆