在 Windows 7 x64 上运行 Oracle 11g r1 出现 64 位错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1691929/
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-18 19:22:55  来源:igfitidea点击:

Running Oracle 11g r1 on Windows 7 x64 getting 64 bit error

.netvisual-studiooraclewindows-764-bit

提问by runxc1 Bret Ferrier

I have installed Oracle 11g r1 64 bit on Windows 7. I am able to connect to it using Sql Developer and a command line tool written in .Net that is 32 bit. I am using Visual Studio to create an ASP.Net application. The solution has 4 projects all of which are compiling for "Any CPU" I installed the 64 bit version of Oracle client and I keep getting the error below. The project is using the System.Data.OracleClient provider. Everything is 64 bit so I don't know why I am getting the error.

我已经在 Windows 7 上安装了 Oracle 11g r1 64 位。我能够使用 Sql Developer 和一个用 .Net 编写的 32 位命令行工具连接到它。我正在使用 Visual Studio 创建一个 ASP.Net 应用程序。该解决方案有 4 个项目,所有这些项目都在为“任何 CPU”编译我安装了 64 位版本的 Oracle 客户端,但我不断收到以下错误。该项目正在使用 System.Data.OracleClient 提供程序。一切都是 64 位,所以我不知道为什么会出现错误。

[InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.]

[InvalidOperationException:尝试加载 Oracle 客户端库时抛出了 BadImageFormatException。在安装了 32 位 Oracle 客户端组件的情况下以 64 位模式运行时会出现此问题。]

采纳答案by runxc1 Bret Ferrier

Well not sure if this is the best answer or why this works and the other way doesn't but I installed the 32 bit oracle client after having installed the 64 bit client and was able to get oracle up and running on my dev machine.

不知道这是否是最好的答案,或者为什么这有效,而另一种方式却没有,但我在安装了 64 位客户端后安装了 32 位 oracle 客户端,并且能够在我的开发机器上启动并运行 oracle。

So as a recap I installed Oracle for Windows x64, Oracle Client Administrator for x64 and Oracle Client Administrator for 32 bit. I then added tnsnames.ora files to both of the clients that were duplicates of the one created for the DB server and restarted my machine and was able to run my Dev environment Visual Studio 2008 with an asp.net project.

总结一下,我安装了适用于 Windows x64 的 Oracle、适用于 x64 的 Oracle Client Administrator 和适用于 32 位的 Oracle Client Administrator。然后我将 tnsnames.ora 文件添加到两个客户端,这些文件是为数据库服务器创建的客户端的副本,并重新启动了我的机器,并且能够使用 asp.net 项目运行我的开发环境 Visual Studio 2008。

回答by Jeff Paquette

What version of ORacle.DataAccess do you have installed ? Check the GAC:

您安装了哪个版本的 ORacle.DataAccess?检查 GAC:

gacutil /l Oracle.DataAccess

gacutil /l Oracle.DataAccess

Make sure you have the 64 bit version installed. Also make sure you don't have the 32bit Oracle client on your path before 64 bit client.

确保您安装了 64 位版本。还要确保在 64 位客户端之前,您的路径上没有 32 位 Oracle 客户端。

I found last week that installing the 32bit Oracle ODP.NET package removes the 64 bit publisher policies...

我上周发现安装 32 位 Oracle ODP.NET 包会删除 64 位发布者策略......