简体   繁体   中英

OraOLEDB.Oracle provider is not registered on the local machine

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.

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.

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

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

  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

I had the same issue using IIS.

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

Do the following test:

Open a Command Prompt and type: 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"

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

It solved for me in both cases.

  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

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

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

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'

That solved the problem.

After spend hours to fix that; and for some who installed it uncorrectly, you need to uninstall current version and reinstall it again as Administrator在此处输入图片说明

I had the same issue but my solution was to keep the Platform target as Any CPU and UNCHECK Prefer 32-bit checkbox. After I unchecked it I was able to open a connection with the provider.

关闭首选 32 位

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:

        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 guide to force your application to run as 64 or 32 bit (X64 and X86 respectively). You have to make sure that Platform Target in your project properties is not set to Any CPU and that it is explicitley set.

在此处输入图片说明

Switching that option from Any CPU to X86 resolved my error and I was able to connect to the Oracle provider.

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)

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:

  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.

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.

just check for which architecture you installed the driver

open Powershell both in 32 and 64 (seperate instance) and fire up:

# OLEDB-drivers
(New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION

# ODBC-drivers
Get-OdbcDriver | select Name,Platform

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.

If you can't change compile use x64, try uninstall x64 version of odac and install 32bit version. Then, don't forget to add install directory like C:\\oracle and also the child directory C:\\oracle\\bin to the PATH environment variable. This worked out for me in .net 4 application.

Don't forget to run your cmd as Administrator or you will get the misleading error message :

The module "OraOLEDB12.dll" may not be compatible with the version of Windows that you are running. Check to see if module is compatible with x86 (32 bit) or x64 (64 bit) version of regsvr32.exe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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