Why doesn't ODP.NET 11 xcopy deployment work on a machine with Oracle DB 10 installed?

前端 未结 4 1914
青春惊慌失措
青春惊慌失措 2020-12-15 13:31

I have an app that uses a local version of ODAC 11 below the directory that the .exe file is in. The idea is that we want our app to use the local ODAC 11 regardless of wha

相关标签:
4条回答
  • 2020-12-15 14:11

    An article titled "Deploying ODP.NET with Oracle Instant Client" found at http://alderprogs.blogspot.com/2009/04/deploying-odpnet-with-oracle-instant.html gave what was for me about the best explanation of how to deliver a stripped down xcopy type deployment with your application. Only 5 Oracle DLLs required for support.

    That said the answers by ObiWanKenobi and Josh Kodroff provides important additional info which matches with my experience.

    Add to that: http://www.brothersincode.com/post/Oracle-ODPnet-xcopy-deployment-for-aspnet.aspx

    0 讨论(0)
  • 2020-12-15 14:12

    So as I understand it, the issue was that while Oracle.DataAccess.dll was in the same directory as the app, it could not find its lower-level homies (oci, et al), hence the compatibility error.

    Turns out that if you want an application to work with ODAC 11 xcopy deployment regardless of what else the user may have installed on her machine, you need to do 2 things:

    1. Set the PATH environment variable for the process. (I was already doing this.)
    2. Set the ORACLE_HOME environment variable for the process. (I was not doing this.)

      Environment.SetEnvironmentVariable("PATH", Environment.CurrentDirectory + "\\oracle\\11.1\\odac;" + Environment.CurrentDirectory + "\\oracle\\11.1\\odac\\bin;", EnvironmentVariableTarget.Process);
      Environment.SetEnvironmentVariable("ORACLE_HOME", Environment.CurrentDirectory + "\\oracle\\11.1\\odac", EnvironmentVariableTarget.Process);
      

    EDIT: It's also important to note that Oracle will throw this error not just for environmental issues, but also if one of the files is missing on the target machine. I got this same error on other machines despite the Environment settings because I had Subversion set to ignore directories called "bin", so the OraOps DLL was not being copied to the client.

    0 讨论(0)
  • 2020-12-15 14:13

    You want to force your ODP.NET drivers to use the copy of oci.dll that is in your local folder, instead of the one already installed.

    You can force this by either

    • setting the PATH variable so the system finds your copy of of oci.dll first (as in the answer by Josh Kodroff)

    or

    • you can use ODP.NET configuration section in app.config (or web.config) to explicitly set the value of "DllPath".

    For details, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html and http://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/win.111/e10927/featConfig.htm

    0 讨论(0)
  • 2020-12-15 14:20

    If you're using oracle client 10.2.0.1 or 10.2.0.2, Oracle Note 215255.1 indicates that if you apply patchset 10.2.0.3 it fixes the issue. Get the 10.2.0.3 database patch (852MB) and patch the client home. Yes, it's the full database server patchset, but it applies to the client as well.

    0 讨论(0)
提交回复
热议问题