使用 Oracle 客户端 11 部署 .NET 应用程序所需的最少设置是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/923283/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:53:52  来源:igfitidea点击:

What is the minimal setup required to deploy a .NET application with Oracle client 11?

oracleodp.net

提问by Josh Kodroff

What is the minimal setup required to be able to deploy a .NET application that talks to an Oracle database?

部署与 Oracle 数据库通信的 .NET 应用程序所需的最少设置是什么?

回答by

Josh-

乔什-

Thank you very much for taking the time to answer. Your instructions helped a whole lot, and are very close to what I have found on my own.

非常感谢您抽出时间来回答。您的说明帮助很大,并且与我自己发现的非常接近。

Interestingly enough, I found it can be slimmed a little more.

有趣的是,我发现它可以再瘦一点。

For those in my situation who

对于那些在我的情况下

  1. Do not want their users to have to install ODAC or the full-size Oracle Client
  2. Do not care about the re-usability of the particular client installtion
  3. Need a "clickOnce" compatible solution
  1. 不希望他们的用户必须安装 ODAC 或全尺寸 Oracle 客户端
  2. 不关心特定客户端安装的可重用性
  3. 需要“clickOnce”兼容解决方案

I found a way to do that.

我找到了一种方法来做到这一点。

a. Download the "Oracle Instant Client 11.1.0.6 - Basic Lite". b. unzip to any folder and copy the following files to your Visual Studio project root:

一种。下载“Oracle Instant Client 11.1.0.6 - Basic Lite”。湾 解压缩到任何文件夹并将以下文件复制到您的 Visual Studio 项目根目录:

  • oci.dll
  • ociw32.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll
  • msvcr71.dll (not necessary, should be supplied with most Windows versions)

    (the first five are the minimum needed for the Oracle Instant Client, the last is the microsoft common runtime they use.)

  • oci.dll
  • ociw32.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll
  • msvcr71.dll(不是必需的,大多数 Windows 版本都应该提供)

    (前五个是 Oracle Instant Client 所需的最低要求,最后一个是他们使用的 microsoft 公共运行时。)

c. Download the ODAC 11 XCopy (the current version is 11.1.0.6) and unzip.

C。下载 ODAC 11 XCopy(当前版本为 11.1.0.6)并解压。

  • OraOps11w.dll - in the odp.net20 folder, goes in your project root.

    (this file is what the Oracle.DataAccess.dll talks to and uses to work with the Instant Client files).

  • OraOps11w.dll - 在 odp.net20 文件夹中,进入您的项目根目录。

    (该文件是 Oracle.DataAccess.dll 与之对话并用于处理 Instant Client 文件的文件)。

d. For compatibility with ClickOnce deployment, select these files in your project and make sure they are "Content" and "Copy Local" in your project. The manifest will then deploy them properly.

d. 为了与 ClickOnce 部署兼容,请在您的项目中选择这些文件,并确保它们在您的项目中是“Content”和“Copy Local”。然后清单将正确部署它们。

Result... the payload added to your project is 30mb, which kinda sucks, but much better than 100+ or 400+, supports western characters, but kicks butt in that

结果..。添加到您的项目中的有效负载为 30mb,这有点糟糕,但比 100+ 或 400+ 好得多,支持西方字符,但在其中踢屁股

  1. it requires no path,
  2. requires no registry entries,
  3. is isolated in deployment and does not hose other Oracle Client installations,
  4. works will all DBs back through 9.2.
  1. 它不需要路径,
  2. 不需要注册表项,
  3. 在部署中是隔离的,不会对其他 Oracle 客户端安装进行管控,
  4. 作品将所有数据库返回到 9.2。

回答by Josh Kodroff

  1. Download the ODAC 11 XCopy deployment.
  2. Extract the zip file and run the following:

    install.bat odp.net20 c:\oracle\11.1\odac myoraclehome true

  3. Copy the files from the 11.1 directory and place them in a subdirectory of your application's executable (e.g. debug\bin\oracle)

  4. Add the following statements to your Main() method. They will change the path such that your application executable will use the oracle client exclusive of any other oracle home's. The environment change is exclusive to your process and has no lasting effects when the application terminates:

    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);

  1. 下载 ODAC 11 XCopy 部署。
  2. 解压缩 zip 文件并运行以下命令:

    install.bat odp.net20 c:\oracle\11.1\odac myoraclehome true

  3. 从 11.1 目录复制文件并将它们放在应用程序可执行文件的子目录中(例如 debug\bin\oracle)

  4. 将以下语句添加到 Main() 方法中。他们将更改路径,以便您的应用程序可执行文件将使用不包括任何其他 oracle home 的 oracle 客户端。环境更改对您的进程而言是专有的,并且在应用程序终止时不会产生持久影响:

    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);

回答by Jim Mahaffey

A while back, this is the thread that got my program working (THANKS!). I now have been told that Oracle doesn't like you picking out 6 dlls and dropping them into your executable folder. So now, every dll that gets installed when running install.bat odp.net2 c:\oracle odac has to placed in your executable folder (eating up space)

不久前,这是让我的程序工作的线程(谢谢!)。我现在被告知 Oracle 不喜欢您挑选 6 个 dll 并将它们放入您的可执行文件夹中。所以现在,运行 install.bat odp.net2 c:\oracle odac 时安装的每个 dll 都必须放在您的可执行文件夹中(占用空间)

回答by Christian Ernst Rysgaard

Im running with the oracle instant client 11g. The following, and very minimal, list of files is what ive found necessary for deployment:

我使用 oracle 即时客户端 11g 运行。以下是我发现部署所必需的文件列表,并且非常少:

OCI.dll
Oracle.DataAccess.dll
OraOCIEI11.dll
OraOps11w.dll

Just install the full client and copy those files from the bin folder.

只需安装完整的客户端并从 bin 文件夹中复制这些文件。