Cannot create an instance of ole db provider “” for linked server

You know you’re dealing with something annoying when Google suggestions cannot wait to auto complete your error message!
Yet this is how I spent a good three hours of my life on earth, just chasing forums & blog posts, even translating a Russian one into English.
I needed that Oracle data, dammit. Sufficient to say that none of the suggestions worked, I kept receiving “Cannot create an instance of OLE DB provider “OraOLEDB.Oracle” for linked server”

Ok, lets go back to the start and list the environment.
Using my local SQL Server 2008 Express R2 on my Win7 x64 workstation, I had to query a Oracle g10 Database on one of my VMWare box.
Yes, you could use the MSDAORA provider by Microsoft for Oracle DBs, but this provider is deprecating and does not exist in x64 flavor.

It all started when i downloaded the ODAC pack for Oracle g10 ( This fails to install: Java(TM) 2 Platform Standard Edition binary has stopped working
At least there are a few confirmations that it’s save to use the OLEDB Oracle g11 driver, which uses an “Xcopy” deployment. So I download and extract it. Grab an oracle login here via bugmenot. As of Sep 2012, this is still the latest version.
Fair enough, it contains clear instructions and installs easily. I get the provider in the list of providers on my SQL server management studio – Awesome, i thought I was done!

Not so, not by a longshot, now the pain was just starting! First I went into the properties of the provider set the AllowInProcess to enabled.
Now attempting to link the server failed with the error message that I have decided to best be the title of this post. Now this post is not going to list all the possible causes there are, hell I never really want to touch this subject again after today, but I want to “broadcast” the thing that made it ultimately work for me.

Let me just say that I’ve attempted each suggestion that I found sensible, those that I think everyone else that has this issue should repeat are as below:
1.) Set NTFS permission to the install directly to Authenticated Users with Read/Execute.
2.) Enable AllowInProcess for the Provider as outlined above.
3.) Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI and remove the three values there (create a backup export if you are so inclined). This step I am the least certain about, however why would you want to reference these 3 completely outdated dll’s in the registry?)
4.) Create the Sub folder NETWORK\ADMIN in your install directory and copy a working tnsnames.ora into it(Maybe from another machine that has the full feature Oracle SQL Developer installed)

Nothing helped – so what does one do at such a point? Unleash the furry of Procmon.exe!
This tool from Sysinternals/Mark Russinovich is the best, and my only regret that day was not launching it earlier instead of scouring Google and going insane.
I’ve limited Procmon to just sqlservr.exe, as it’s the SQL Service itself that loads/handles the providers and not the ssms.exe. Also of note is that the sqlservr.exe is a 64bit process while the management studio is still just 32bit. As the server service is loading the provider, and the service process is 64bit, the provider must also be available in 64 bit format.

The was installed to C:\Oracle.
What Procmon showed me however is that sqlservr is attempting to find the oci.dll in any folder but his! (It iterates through the %Path% sysvariable). When it finally gives up on find the dll, the SQL Service is in a unstable shape and the only way to stop the service was to kill it via taskmgr/procexp.
Clearly I can see that the “xcopy” deployment – while not giving me any error messages – it also did not set the PATH variable!
And this is what this post is really about… adding C:\Oracle and C:\Oracle\Bin to the Path variable or maybe it’s about
employing investigative tools earlier in the process instead of relying on your search engine skills.

sqlservr.exe can now find the relevant DLL’s. The OCI.DLL in the root and the OraOLEDB11.DLL in the Bin subfolder.
At this point I could query the database! If you did my steps as above and you still get the same error, I strongly suggest using Procmon.exe as I have instead of jumping to the next search result.

I’ve left out the part where it initially could not find the tnsnames.ora file and it attempted to connect via the default oracle port instead of the custom one, and as an additional note if sqlservr cannot locate the tnsnames.ora in the first attempt, it’s not going to retry again until you restart the SQL service. I was actually surprised to even see the port connection attempt in procmon, it seems this tool just keeps getting better.

So this is what I’ve done on my “Day off” from work…. I hope you were reading this while at work yourself and can get back to the real work & fun stuff, writing queries!


Reporting on 1E Nomad Enterprise activity in SCCM

Most 1E products have dedicated reporting, however Nomad Enterprise does not.
This may be because adverts are already well reported on by SCCM via Status Messages, and usually the buck stops here. However you may still want to know more
about how it actually got there…
I order to “see the Nomad story” we can actually take advantage of Status Messages as well, and hence this will allow us to report on Nomad directly in SCCM!

First we need to configure Nomad to send the status messages.
You can do this at install time using the MSI property STATUSMSGEVENTS, or after the install directly in the registry or via GPO.
The possible values for this can be found in the Admin guide, I am not going to copy paste this massive document here :)
Be careful not to simply select “Everything” as this can be quite spammy! The report I wrote uses these messages:
Evt_Rqst_Started >>> I use this to identity the Package that we download and the start time
Evt_MasterChanged >>> This is being used to see from which machine this client actually downloads.
Evt_Completed >>> If Nomad finished successful this is used to record the end time.
Evt_Error >>> If Nomad errors for any reason this is used to record the end time as well as the detailed error message.
This means I have to set my STATUSMSGEVENTS to 0x0000002064

Now onto the report itself
This is actually an older report I did for a customer back in SMS 2003 times. I was surprised to find out the query still worked fine for SCCM and the latest Nomad,
so I thought let me polish it back up and share it on my blog.
This really answers who on the subnet became the master? How long did the master take to download it from the DP, and how soon did everyone finish downloading it,
of course it also is a good tool to find machines that had any kind of error.

Here I have chosen to display one advert but for all sites and packages. I was cheeky and hard coded (non existing) DP path in SCCM halfway through to get some error messages.

SQL Challenges
There where numerous challenges in this one!
First of all the Status messages are split into many rows, I joined them back up via FOR XML as a kind of rows concatenation trick.  Let me show you.
Say you have a sales territory team: Tom, Jerry, Micky and Mouse.  (Copyright expired on these names, right? Damn you Walt)
I am going to aggregate the whole team and display the sum. However I also would like to display each Team members name in order of sales.

SELECT TerritoryID
, SUM(SalesYTD) AS TerritorySales
, Accounts = REPLACE((            SELECT
SalesPersonID AS [data()]
[AdventureWorks].[Sales].[SalesPerson] XMLSales
XMLSales.TerritoryID = Sales.TerritoryID
FOR XML PATH ('') ), ' ', ',')
FROM [AdventureWorks].[Sales].[SalesPerson] Sales
GROUP BY TerritoryID

This can be run against the good old sample Microsoft DatabaseAdventureWorks.
In effect this is like a glorified subquery. The REPLACE function is added to add commas between the sales reps. The MIN and MAX function can be used to similar effect but only for the largest and smallest of the aggregated values. Some of the status messages here contain 4 rows, so concatenation them together seemed like the best course of action. Later on I can get to my desired value via the SUBSTRING command.

The next challenge was the fact that only the Evt_Rqst_Started message contained the PackageId. This is made worse if you consider that each advert may really copy down multiple packages.
The way I solved it is to first define for each Package and Advert the start and end time, and then update the previous table with the PackageId between those timeframes.
I usually do not like using temp tables, but in this case it made it a whole lot easier. Due to this it’s advisable to filter by AdvertID – if filtration is needed – instead of PackageId.


Followup 11/28/2012
This report has been further developed to have additional features such as reporting on BITS and TS downloads as well.
Additionally 1E has created 7 further reports on Nomad and bundled them into a reporting pack that you can freely request from 1E.
Here are some screenshots from the improved report(s). I am leaving this original report intact as this one still works fine and is a classic report, whereas the report pack is SSRS based.