0

I have a c# console application which is scheduled to import bulk data from oracle to sql database. I am leaning towards using the oracle client dlls from the installation folder instead of having it installed on server. I read many existing SO answers on copying required dlls in installation folder.

https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/

The application works fine on my windows 10 machine where no oracle client is installed. But on Windows Server 2008 R2 it throws error saying OraOps12.dll is not found. Though I have the dll available. What can I do to troubleshoot the issue?

Jay
  • 408
  • 2
  • 6
  • 27

3 Answers3

1

Make sure the dll is referenced in the project and it's set to copy to the output directory. I can't explain why, but I have had referenced dll's not set to copy and have run into similar issues as you are describing.

enter image description here

gilliduck
  • 2,762
  • 2
  • 16
  • 32
  • Yes, I have dll referenced in the project with Copy Local = Ture. I am unable to understand how it works fine on windows 10 machine but not on windows server 2008 R2. I tried this on 3 Windows server machine with same result. Not sure, if any one can throw some light, whether does it has to do with windows version? – Jay Apr 17 '19 at 16:12
  • @Jay how about 64bit vs 32bit? Are both machines the same bits, even if they're different OS versions? – gilliduck Apr 17 '19 at 16:15
  • https://stackoverflow.com/questions/33509331/oracle-dataaccess-client-dependencies – gilliduck Apr 17 '19 at 16:16
  • yes, both are 64-bit machines. I have 64-bit oracle client xcopy dlls. I tried to build by project with Any Cpu & in 64 bit. And I also already gone through the link you shared. I tried to copy specific dlls mentioned in the post as well all the dlls in instant client. I copied OraOps dll in installed location also. Still it shows the same error as unable to load OraOps12 dll – Jay Apr 17 '19 at 16:31
0

I think it is a bad idea to copy the DLL's from the Oracle Client manually. You may provide a copy of Oracle.DataAccess.dll - for all the rest ask your customer to install an appropriate Oracle Client, i.e. the version and architecture has to match the Oracle.DataAccess.dll.

Or use the ODP.NET Managed Driver (Oracle.ManagedDataAccess.dll), this is a stand-alone DLL which does not require any additional file.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • I need a BulkCopy feature so I can't use Managed dll. & I wanted to work with manual copy because the server already has older oracle client installed. – Jay Apr 17 '19 at 17:45
  • @Jay; Then it is even more a reason to use the existing Oracle installation rather than providing your own DLL's. It should work provided the version of `Oracle.DataAccess.dll` matches **exactly** the version the Oracle client. Anyway, if you still want to provide your own DLL's then you must set `PATH` and `ORACLE_HOME` environment variable accordingly before your start the application. They must point to the folder where you copied the DLL's and must not contain the folder of already installed Oracle client. Perhaps you also have to modify settings in Registry. – Wernfried Domscheit Apr 17 '19 at 20:15
  • I suppose, installing oracle client is clean way to setup. Since, I have older oracle client installed. I am checking how to install newer oracle client & make it work for new applications. – Jay Apr 18 '19 at 09:05
0

Finally I could work it out without actually installing Oracle Client on the server. I was receiving error about not able to load OraOps12.dll but eventually I found out that the dll I was missing was msvcr120.dll. The dll is Microsoft Visual C++ Runtime. So now, I have following Oracle dlls in my deployment folder & the application is working. No changes in configuration are required.

  1. msvcr120.dll
  2. Oracle.DataAccess.dll
  3. OraOps12.dll
  4. oraociei12.dll
  5. oraons.dll
  6. oci.dll
Jay
  • 408
  • 2
  • 6
  • 27