版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。









这里补充一点:windows通过SYSWOW64子系统,提供了在64位windows系统上运行32位应用的能力,这么变态的行为,是给我们广大程序员造成崩溃的祸乱之源。哈哈。那么怎么看我们的程序是运行在32位或者64位之下呢?真相就藏在任务管理器中:打开进程选项卡,在进程名这一栏,如果进程名后面多了“ *32”,这样的字符,那就表示是跑在32位模式下了。如果没有的话,就是64位模式运行。



Considerations Using The Oracle Client With Microsoft Products on 64 bit Windows Operating System (文档 ID 781432.1) 转到底部转到底部

In this Document

  Questions and Answers



Oracle Database Extensions for .NET - Version and later
Oracle Provider for OLE DB - Version and later
Oracle Data Provider for .NET - Version and later
Oracle Providers for ASP.NET - Version and later
Oracle Objects for OLE - Version and later
Microsoft Windows x64 (64-bit)
Microsoft Windows Itanium (64-bit)


The purpose of this note is to discuss some of the Oracle specific considerations and issues that occur when using Oracle client with Microsoft products on a 64 bit operating system, their solutions, and notes for further reference.



With the introduction of 64 bit Windows operating system, Microsoft provides the ability to run 32 bit applications via the SYSWOW64 subsystem. As both 64 bit and 32 bit applications can be run on a 64 bit operating system, issues may be encountered if the correct bit version of the Oracle client software is not installed to meet your specific requirements. 

Examples of problems may include the inability to find the ODBC or OLEDB provider presented in the list of selectable drivers during configuration, an error indicating that Oracle client software is not installed, or a BadImageFormatException, among others.

Numerous Microsoft tools are 32 bit, even when installed on a 64 bit Operating system. These include, but are not limited to: 
- Visual Studio 
- SQL Server Integration Services tools (SSIS) 
While both of these tools can develop code that runs as 64 bit in production, the development tools themselves are 32 bit and as such require 32 bit Oracle client software during development, and 64 bit Oracle client software deployment. If development is to occur on the target deployment machine, both 32 bit and 64 bit Oracle client software will need to be installed.

Example: Using Visual Studio and ODP.NET :  using Server Explorer inside Visual Studio requires a 32 bit Oracle client install as the Visual Studio IDE is 32 bit.   Debugging an application in Visual Studio requires a 64 bit Oracle client install : although you're using the 32 bit IDE, the 64 bit host runtime is invoked.  Running the resulting application/executable outside Visual Studio requires the appropriate bit version for the platform you're running the application on; if running on a 64 bit OS, you'll need a 64 bit Oracle client install.  The same scenario applies to developing SSIS packages with Oracle's OLEDB provider.

An easy way to determine if a process is running as 32 bit or 64 bit, is to look for the name of the process under the Process tab of Task Manager.   Processes running under SYSWOW64 (ie, 32 bit) will have a *32 next to their name in the process list.

IIS applications run as 64 bit on a 64 bit Operating system by default, so 64 bit Oracle client software is needed.  In the case of Oracle Objects for Ole for example, which has only a 32 bit version, IIS will need to be configured to run as 32 bit (see below).

The Oracle Client Install

64 bit applications require 64 bit Oracle Client software, and 32 bit applications require 32 bit Oracle client software. Oracle does not currently provide a single bundle that will install both 32 bit and 64 bit Oracle client, so in order to run both 32 bit and 64 bit applications on the same operating system both 32 bit and 64 bit Oracle client software will need to be installed as separate steps, and the installs need to go into separate Oracle homes. 

32 bit installation and 64 bit installation are not aware of each other, and as with all multiple home installations the TNSNames.ora in both homes will need to be updated with the connect information, or TNS_ADMIN environment variable set. The 32 bit Oracle Universal Installer will only show information on the 32 bit home, and the same with 64 bit. 

Please note: that there is currently an issue where installing both 32 bit and 64 bit client on the same box will cause the second installation to overwrite the Start Menu shortcuts of the first installation if separate Oracle Home names are not used. 11.2 does not give you the opportunity to set the Oracle Home names via the OUI, but you can pass it as a command line argument, 
       setup.exe  ORACLE_HOME_NAME=OraHome11g_client64
for example.

Additionally, while both homes can share an ORACLE_BASE and function correctly, separate ORACLE_BASEs should be used due to issues when de-installing one client but not the other, as documented in <Bug:10360738>

When installing both 32 bit and 64 bit Oracle client software onto a single box, both Oracle homes will need to be in the PATH environment variable, although the order is not important. 

The Oracle home information is stored in the registry as follows, which can be used to infer whether 32 bit or 64 bit Oracle client software is installed. 

     -The 64 bit Oracle home will be setup in the registry in the following location: 

     - The 32 bit Oracle home will be setup in the registry in the following location: 

Earlier versions of Oracle client software had a known bug that resulted in a ora-6413 or ora-12154 when an application was run from a path containing parenthesis, which is the default location for installation of 32 bit applications on a 64 bit operating system - Program Files (x86).  Applying the latest patches to the client install should resolve this issue.  For more information refer to Note.334528.1.



Specific considerations regarding specific Oracle Products

Oracle ODBC Driver- The 32 bit ODBC driver framework and 64 bit ODBC driver framework are separate and distinct.  To use the Oracle ODBC driver with a 32 bit application, the 32 bit driver and Oracle client need to be installed, and the 32 bit ODBC administrator must used to setup a 32 bit DSN. See Note 308645.1for more information.

The ODBC administrator will only show you the Data Source Names (DSN) of the appropriate bitness (32 vs 64) when selecting from a list of SYSTEM DSNs, however USER and FILE DSNs are not stored separately based on architecture,  Ensure you're trying to use a dsn that is the proper architecture for your application.

Note that the driver dll is named sqora32.dll in both 32 bit and 64 bit cases, and there is no sqora64.dll

Applications that rely on the Microsoft OLEDB provider for ODBC drivers (MSDASQL), an ASP page using Active Data Objects (ADO) for example, will need to make sure the 64 bit MSDASQL driver is installed on the target deployment machine. While 64 bit MSDASQL comes built in on Windows 2008, it comes as a separate download for Windows 2003, and is included with Service Pack 1 for Windows Vista.

 Oracle Provider for OLEDB - Although the Oracle OLEDB provider is typically a single Oracle home product, this restriction does not apply in the case of a 32 bit install and a 64 bit install, as the COM registry locations for 32 bit and 64 bit are not shared. Both a 32 bit and 64 bit Oracle OLEDB provider can be installed at once.

On Windows 7, the 64 bit regsvr32 utility can be used to register both 32 bit and 64 bit ORAOLEDB, but it needs to be done once for each version .  Note however that uninstalling ORAOLEDB (via regsvr32 /u) will uninstall BOTH the 32 bit and 64 oledb provider at the same time, so the other version will need to be re-registered.

Numerous recent fixes with respect to metadata and the 64 bit Oracle OLEDB provider reports have occurred.  If using OraOledb with SQLServer it is highly recommended to use the latest version to have all the available fixes. See Note 191368.1 for more information on configuring a linked server.

Oracle Data Provider for .NET (ODP.NET) -   While ODP.NET installs policy files to redirect applications looking for older versions of the provider to the currently installed version, the policy files do not include redirection from versions earlier than, or applications compiled with ODP 1.x, as .NET framework version of 2.x is the minimum 64 bit version. Explicit redirection by the user can be enabled via the use of a .config file, but by default 1.x .NET applications can only run as 32 bit applications since there is no 1.x framework for x64, and as such require 32 bit software.   For more information, please refer to the "ODP.NET Publisher Policy Files, .NET Framework 2.0 Support and Breaking Changes" section of Note 761214.1

The first version of ODP.NET for 64 bit operating system is

A .NET application developed on a 32 bit operating system can be deployed to a 64 bit operating system without changes.  In such cases, 64 bit Oracle software will need to be installed on the deployment target as the default compilation target is Any CPU which will cause .NET applications to run as 64 bit on a 64 bit Operating System, and 32 bit on a 32 bit Operating system.  If the application is compiled with a target of "x86", then the application will only run as 32 bit will and require 32 bit ODP.NET and Oracle software to be installed. Corflags.exe can be used to determine the compilation flags.

Oracle Objects for OLE (OO4O) -  The Oracle Objects for OLE product is not available as a 64-bit product. If you plan to migrate your oo4o applications to 64-bit Windows they will be required to run in 32-bit mode with the 32 bit oracle client. If you are deploying an oo4o web application hosted under IIS 6.0, then you will need to be aware that worker processes within IIS 6.0 will have to be configured to run as 32 bit processes.

Note however that 32 bit OO4O on a 64 bit OS is not considered a supported configuration by Oracle.

We highly recommend you consider the migration path to the Oracle Data Provider for .NET and rewrite the application to run on the .NET platform.

Oracle Developer Tools for Visual Studio (ODT.NET) - Visual Studio is a 32 bit product, even when run on a 64 bit operating system.  In order to use Oracle Developer Tools for Visual Studio on a 64 bit operating system, the 32 bit ODAC installation will need to be used and installed.  64 bit Oracle software will need to be installed (into a separate home) to run the resulting program outside the IDE.

However, as of this writing, due to Bug 7622155, installing 32 bit ODAC onto a 64 bit operating system results in the wrong Machine.config being updated, which can be worked around by following the suggestions in this thread.

Oracle Database Extensions for .NET (ODE) - The Oracle Database Extensions for .NET are supported on 64 bit Windows running in 64 bit mode only, as the Oracle 32 bit database is not supported or certified on 64 bit Windows. You must deploy your .NET stored procedures as 64 bit images/binaries (Target AnyCPU) to run inside a 64 bit Oracle database on 64 bit Windows.

Oracle COM Automation Feature - The 64 bit database process can only run 64 bit libraries, so the database cannot run a 32 bit VB dll, for example.

The window below is a live discussion of this article (not a screenshot).  We encourage you to join the discussion by clicking the "Reply" link below for the entry you would like to provide feedback on.  If you have questions or implementation issues with the information in the article above, please share that below.