Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle oci.dll in ASP.NET bin directory can't be deleted/doesn't work

Tags:

I followed the directions here: http://splinter.com.au/blog/?p=156 in an attempt to use a newer version of ODP.NET without installing the Oracle 11g client. I followed everything, so far, except for restarting IIS.

However, this has caused some problems and I'm really curious as to why. If I try to use ODP.NET I'm met with a blank exception thrown when the Oracle connection tries to connect (ConnectExample.Open() for instance).

But most curiously: I can't delete oci.dll. It says it's in use. What could be using this dll? What exactly does ASP.NET do with a native dll when it's within the Bin directory? I thought that maybe this is something involving the oci.dll, but if I use the dll in a similar fashion in a desktop WinForm application then the oci.dll doesn't get locked, and I can delete it freely.

Also, after I tried using it the normal System.Data.OracleClient stopped working. It now throws an exception that OCIEnvCreate returns with a -1.

I will try restarting IIS, and hopefully that will fix this, but I'd like to know what's going on here (and if it can be solved without restarting IIS). Does anyone have an idea?

Edit: I tried restarting IIS and that didn't fix a thing

Edit #2: I don't think I formulated this question very well, but that was due to my assuming restarting IIS would work. Now I just need to know why it isn't working. In Googling for similar problems I've only encountered 2 forum posts which told of my exact problem: Oracle ODP.NET returning a blank exception when trying to connect. Here's the links to those:

http://kr.forums.oracle.com/forums/thread.jspa?threadID=632296

http://forums.oracle.com/forums/thread.jspa?threadID=549864

The Korean link above is the most interesting. They have a full install which leads me to suspect my problem isn't with the files or missing files. I wonder what they mean by "production servers throwing blank exceptions if a call to the OCI DLL is made before the ODP one can be established"?

Edit/Update #3: We have an intranet server here for our department that I was able to test on today. I added the required dll's to the Bin folder and everything worked without the need to restart IIS. I don't ask. I'll try some more testing on this server to see if I can replicate the problem

Edit #4 (the odyssey continues): I determined that oraocci11.dll (the C++ call interface DLL) is needed initially by ASP.NET (or the ODP.NET library) to even find the 11g client dll's, after that oraocci11.dll seems to never be used again and can be deleted. Not sure what that means for my problem, but since it adds to the knowledge base here I figured I'd mention it

Edit #5: I added mfc71.dll and msvcr71.dll, 2 Windows systems files dealing with C/MFC, to the Bin directory as I discovered they're needed by ODP.NET (or at least, needed by the client). This, at the very least, made things stay on the old familiar "Client not compatible" error. I removed those 2 DLLs and sure enough it went back to the same errors given above. Adding them back didn't make those errors go away, however, so I'll have to reset IIS again.

like image 371
Bob Avatar asked Jan 26 '10 21:01

Bob


People also ask

How do I close OCI dll?

use Oracle Universal utility. start>program>oracle>oracle installation product>Oracle Universal installer. Just stop the Distributed Transaction Coordinator Service before deleting oci. dll.

Where is the OCI dll file?

Linking OCI Applications for Windows The DLLs are located in the ORACLE_BASE\ORACLE_HOME \bin directory and are part of the Required Support Files (RSFs).

What is Oracle OCI dll?

Oci. dll errors are caused by situations that lead to the removal or corruption of the ​oci DLL file, which is an API used with Oracle software that stands for Oracle Call Interface. In some cases, oci. dll errors could indicate a registry problem, a virus or malware issue, or even a hardware failure.


3 Answers

Instead of (or as well as) stopping IIS, stop the World Wide Web Publishing Service using services.msc and then make your changes.

We found that for a graph control DLL being used by an asp.net application, just stopping IIS wasn't enough as you were not able to delete the file (or paste etc). But once the World Wide Web Publishing Service was stopped, it could then be deleted or overwritten...

like image 81
davidsleeps Avatar answered Oct 06 '22 00:10

davidsleeps


A typical Oracle experience.

I had this same problem. Unlockers do not work. I tried several -- all report that the file isn't locked at all, but then report that they cannot delete it.

Stopping IIS and most non-core Windows services doesn't work.

The solution is to rename the file, reboot, then delete it. For some reason, Windows allows you to rename a locked file and keeps it locked, but upon rebooting the attempt to lock "oci.dll" fails because it no longer exists under that name.

like image 45
Charles Burns Avatar answered Oct 05 '22 23:10

Charles Burns


As for the DLL's, you'll have to stop IIS, delete them, then start IIS. This is because they are native DLL's, not C# dll's. C#'s 'shadow copy' feature doesn't apply to native dll's, which is why they are locked.

As for oracle, i've emailed you some stuff to try... really we should update this SO page when you find a solution.

like image 24
Chris Avatar answered Oct 05 '22 22:10

Chris