C# OraOLEDB.Oracle 提供程序未在本地计算机上注册

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12903366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 00:54:52  来源:igfitidea点击:

OraOLEDB.Oracle provider is not registered on the local machine

c#.netwindowsoracle

提问by Jared

I just migrated from XP to Win 7. I am guessing this error has to do with switching operating systems. I wrote a .net application that basically massages a large amount of data and then connects to a database and inserts/updates a table.

我刚刚从 XP 迁移到 Win 7。我猜这个错误与切换操作系统有关。我编写了一个 .net 应用程序,它基本上处理大量数据,然后连接到数据库并插入/更新表。

When I hit a button to connect to the database I run into the error regarding the oracle provider not being registered on my local machine.

当我点击按钮连接到数据库时,我遇到了有关 oracle 提供程序未在我的本地计算机上注册的错误。

A clear, step by step outline of how I can fix this quickly would be much appreciated.

将非常感谢我如何快速解决此问题的清晰分步概述。

The exact error message is:

确切的错误消息是:

'OraOLEDB.Oracle.1' provider is not registered on the local machine

“OraOLEDB.Oracle.1”提供程序未在本地计算机上注册

回答by AnBisw

  1. Right Click on My Computer
  2. Click on properties
  3. Click on Advanced System Settings
  4. Click on "Environment Variables" button.
  5. In the system Variable section find the "PATH" variable
  6. Edit the "PATH" variable and add Oracle installation path to it (from your local machine) like ;C:\oracle\product\10.2.0\client_1\bin
  1. 右键单击我的电脑
  2. 点击属性
  3. 点击高级系统设置
  4. 单击“环境变量”按钮。
  5. 在系统变量部分找到“PATH”变量
  6. 编辑“PATH”变量并将 Oracle 安装路径添加到它(从您的本地机器),如 ;C:\oracle\product\10.2.0\client_1\bin

回答by Der Wolf

I had the same issue after installing the 64 bit Oracle client on Windows 7 64 bit. The solution that worked for me:

在 Windows 7 64 位上安装 64 位 Oracle 客户端后,我遇到了同样的问题。对我有用的解决方案:

  1. Open a command prompt in administrator mode
  2. cd \oracle\product\11.2.0\client_64\BIN
  3. c:\Windows\system32\regsvr32.exe OraOLEDB11.dll
  1. 在管理员模式下打开命令提示符
  2. cd \oracle\product\11.2.0\client_64\BIN
  3. c:\Windows\system32\regsvr32.exe OraOLEDB11.dll

回答by julison

Do the following test:

做以下测试:

Open a Command Prompt and type: tnsping instance_name

打开命令提示符并键入:tnsping instance_name

where instance_name is the name of the instance you want to connect (if it's a XE database, use "tnsping xe"

其中 instance_name 是您要连接的实例的名称(如果它是 XE 数据库,请使用“tnsping xe”

If it returns ok, follow steps of Der Wolf's answer. If doesn't return ok, follow steps of Annjawn's answer.

如果返回正常,请按照 Der Wolf 的回答步骤操作。如果没有返回,请按照 Annjawn 的回答步骤操作。

It solved for me in both cases.

它在两种情况下都为我解决了。

回答by Nuno G

Building on Der Wolfs tip, I uninstalled the Oracle client and installed it again, right-clicking on the setup program, and running it as Administrator. It worked.

基于 Der Wolfs 提示,我卸载了 Oracle 客户端并再次安装,右键单击安装程序,并以管理员身份运行它。有效。

回答by Diogenes Chepe Ardines Salazar

If you have windows 64 bits, try to install oracle driver 32 bits first then 64 bits driver, thats what i do and is working

如果您有 Windows 64 位,请尝试先安装 32 位 oracle 驱动程序,然后再安装 64 位驱动程序,这就是我所做的并且正在工作

回答by Daniel Bonetti

It only worked for me after I changed the 'Platform target' to 'x64' (considering I'm using Oracle 12c 64 bits)

它仅在我将“平台目标”更改为“x64”后才对我有用(考虑到我使用的是 Oracle 12c 64 位)

To do that, I did:

为此,我做了:

  1. Right click on the project name (at the Solution Explorer panel locate, in general, at the left)

  2. Clicked on 'Build' (in the new opened window)

  3. Changed the 'Platform target' from 'Any CPU' to 'x64'

  1. 右键单击项目名称(在解决方案资源管理器面板中,通常位于左侧)

  2. 单击“构建”(在新打开的窗口中)

  3. 将“平台目标”从“任何 CPU”更改为“x64”

That solved the problem.

那解决了问题。

回答by Vagner Gon

I had the same issue using IIS.

我在使用 IIS 时遇到了同样的问题。

Make sure the option 'Enable 32bit Applications' is set to trueon Advanced Configuration of the Application Pool.

确保在应用程序池的高级配置中将“启用 32 位应用程序”选项设置为true

回答by John August

If you are getting this in a C# projet, check if you are running in 64-bit or 32-bit mode with the following code:

如果您在 C# 项目中获得此功能,请使用以下代码检查您是在 64 位还是 32 位模式下运行:

        if (IntPtr.Size == 4)
        {
            Console.WriteLine("This is 32-Bit!");
        }
        else if (IntPtr.Size == 8)
        {
            Console.WriteLine("This is 64 Bit!");
        }

If you find that you are running in 64-Bit mode, you may want to try switching to 32-Bit (or vice versa). You can follow this guideto force your application to run as 64 or 32 bit (X64 and X86 respectively). You have to make sure that Platform Targetin your project properties is not set to Any CPUand that it is explicitley set.

如果您发现您在 64 位模式下运行,您可能需要尝试切换到 32 位(反之亦然)。您可以按照本指南强制您的应用程序以 64 位或 32 位(分别为 X64 和 X86)运行。您必须确保Platform Target在您的项目属性中未设置为Any CPU并且已显式设置。

enter image description here

在此处输入图片说明

Switching that option from Any CPUto X86resolved my error and I was able to connect to the Oracle provider.

切换该选项Any CPUX86解决我的错误,我能够连接到 Oracle 提供程序。

回答by Bashar Abu Shamaa

After spend hours to fix that; and for some who installed it uncorrectly, you need to uninstall current version and reinstall it again as Administratorenter image description here

花了几个小时来解决这个问题;对于一些安装不正确的人,您需要卸载当前版本并以管理员身份重新安装在此处输入图片说明

回答by XDS

My team would stumble upon this issue every now and then in random machines that we would try to install our platform in (we use oracle drivers 12c ver 12.2.0.4 but we came across this bug with other versions as well)

我的团队会时不时地在我们尝试安装平台的随机机器上偶然发现这个问题(我们使用 oracle 驱动程序 12c ver 12.2.0.4,但我们在其他版本中也遇到了这个错误)

After quite a bit of experimentation we realized what was wrong:

经过大量的实验,我们意识到出了什么问题:

Said machines would have apps that were using the machine-wide oracle drivers silently locking them and preventing the oracle driver-installer from working its magic when would attempt to upgrade/reinstall said oracle-drivers. The sneakiest "app" would be websites running in IIS and the like because these apps essentially auto-start on reboot. To counter this we do the following:

所述机器将具有使用机器范围的 oracle 驱动程序的应用程序静默锁定它们并阻止 oracle 驱动程序安装程序在尝试升级/重新安装所述 oracle 驱动程序时发挥其魔力。最狡猾的“应用程序”是在 IIS 等中运行的网站,因为这些应用程序基本上会在重新启动时自动启动。为了解决这个问题,我们执行以下操作:

  1. Disable IIS from starting automagically on restart. Do the same for any other apps/services that auto-start themselves on reboot.
  2. Uninstall any previous Oracle driver and double-check that there are no traces left behind in registry or folders.
  3. Reboot the machine
  4. (Re)Install the Oracle drivers and re-enable IIS and other auto-start apps.
  5. Reboot the machine <- This is vital. Oracle's OLE DB drivers won't work unless you reboot the machine.
  1. 禁止 IIS 在重新启动时自动启动。对在重新启动时自动启动的任何其他应用程序/服务执行相同的操作。
  2. 卸载任何以前的 Oracle 驱动程序并仔细检查注册表或文件夹中是否没有留下任何痕迹。
  3. 重启机器
  4. (重新)安装 Oracle 驱动程序并重新启用 IIS 和其他自动启动应用程序。
  5. 重新启动机器 <- 这很重要。除非您重新启动机器,否则 Oracle 的 OLE DB 驱动程序将无法工作。

If this doesn't work then rinse repeat until the OLE DB drivers work. Hope this helps someone out there struggling to figure out what's going on.

如果这不起作用,则冲洗重复直到 OLE DB 驱动程序工作。希望这可以帮助那里的人努力弄清楚发生了什么。