如何在同一台计算机上并排安装ODP.NET 2.111和ODP.NET 4.112,同时它们都指向同一数据库服务器 [英] How to install ODP.NET 2.111 and ODP.NET 4.112 in the same machine side-by-side while both point to the same database server

查看:90
本文介绍了如何在同一台计算机上并排安装ODP.NET 2.111和ODP.NET 4.112,同时它们都指向同一数据库服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是如何同时在同一台计算机上同时安装ODP.NET 2.111和ODP.NET 4.112,同时它们都使用tnsnames.ora指向同一数据库服务器

我需要支持基于Oracle 11.1.0的旧系统.系统正在使用ODP.NET 2.111连接到oracle.在以下位置安装了两个客户端:

I need to support a legacy system based on Oracle 11.1.0. The system is using ODP.NET 2.111 to connect to oracle. There are two clients installed at:

C:\ oracle \ product \ 11.1.0 \ client_1

C:\oracle\product\11.1.0\client_1

C:\ oracle \ product \ 11.1.0 \ client_2

C:\oracle\product\11.1.0\client_2

两者的tnsnames.ora都是这样的:

The tnsnames.ora for both is something like this:

xxxx1_SERVICE=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xxxx2)(PORT = xxx3))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = xxx4)
    )
  )

yyyy1_SERVICE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = yyyy2 )(PORT = yyyy3))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = yyyy4)
    )
  )

kkkk1_SERVICE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = kkkkk2 )(PORT = kkkk3))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = kkk4)
    )
  )

pppp1_SERVICE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ppppp2 )(PORT = pppp3))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = pppp4)
    )
  )

oooo1_SERVICE = (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ooooo2 )(PORT = oooo3))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oooo4)
    )
  )

使用以上设置,系统已启动并正在运行.我需要开发一个基于EntityFramework的新系统,该系统需要使用较新版本的Oracle.DataAccess.Dll(4.112).

The system is up and running using the above settings. I need to develop a new system based on EntityFramework which requires me to use a newer version of Oracle.DataAccess.Dll (4.112).

我想知道如何在不损害旧系统功能的情况下安装新客户端,以便两者可以并行工作:

I was wondering that how I could install the new client without hurting the functionality of the legacy system so both can work side by side:

注意:我确实尝试在以前的客户端上安装新的ODP.NET,并且能够使用以下连接字符串连接到数据库:

Note: I did try to install the new ODP.NET over the previous client and was able to connect to database using the following connection string:

数据 SOURCE = {DESCRIPTION = {ADDRESS_LIST = {ADDRESS = {PROTOCOL = TCP} {HOST = zzzzz1)(PORT = zzzzz2)}} {CONNECT_DATA = {SERVICE_NAME = zzz3_SERVICE)));用户 ID = \"zzzz4 \";密码= \"zzzz5 \";

DATA SOURCE=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=zzzzz1)(PORT=zzzzz2)))(CONNECT_DATA=(SERVICE_NAME=zzz3_SERVICE)));User ID=\"zzzz4\";Password=\"zzzz5\";

那是不可取的,因为1-它破坏了旧系统,因为由于ODP.NET的升级,它不再可以连接到Oracle 2-连接字符串看起来很奇怪

Thats is not desirable because 1- It breaks the legacy system because it no longer can connect to Oracle due to the upgrade in ODP.NET 2- The connection string is very strange looking

我将不胜感激,

谢谢, 爱丁

推荐答案

简短答案:

注意:我确实尝试通过以前的客户端安装新的ODP.NET. 并能够使用以下连接连接到数据库 字符串...

Note: I did try to install the new ODP.NET over the previous client and was able to connect to database using the following connection string...

这表明您的新安装在/Network/Admin中没有tnsnames.ora和sqlnet.ora.如果您对使用新ODP.net安装程序的旧客户端程序感到满意,则可以从旧安装程序中复制它们,也可以使用

This indicates that your new install does not have a tnsnames.ora and sqlnet.ora in /Network/Admin. If you're OK with the old client using the new ODP.net install, than you can either copy them from the old installation or you can specify a global location for all instances with the TNS_ADMIN environment variable, ie TNS_ADMIN=C:\MyOracleFilesDir

长答案:

在安装新客户端时,它很可能还将发布者策略文件安装到GAC中,该文件将在

When you installed the new client it most likely also installed publisher policy files into the GAC that redirect references to the old Oracle.DataAccess.dll to the new version during the assembly resolution process. Oracle.DataAccess then locates the client via a parameter (DllPath) in the registry. You can override this location by setting the dllPath in your .config file:

<configuration>
  <oracle.dataaccess.client>
    <add key="DllPath"            value="C:\yourotherpath"/>
  </oracle.dataaccess.client>
</configuration>

通常这是我的工作,但是据我所了解,我意识到我正在针对较旧的客户端强制使用新的dll.如果您的目标是保持原有客户端不变,那么更好的选择可能是从GAC删除发布者策略(我认为它们甚至没有完全安装ODAC来安装,只有ODP.net可以安装):

This is generally what I do, but as I understand this more, I realize that I'm forcing a newer dll against an older client. If your goal is to leave the old client untouched, a better option may be to delete the publisher policies from the GAC (I don't think they are even installed with the full ODAC install, only ODP.net):

如果需要重新安装它们,通常可以在oraclepath \ odp.net \ PublisherPolicy中找到它们.

If you need to reinstall them they are generally found at oraclepath\odp.net\PublisherPolicy.

另一种,也许是一个更好的长期选择,是配置旧客户端以忽略发布者策略: http://msdn.microsoft.com/zh-cn/library/cf9025zt%28v = vs.80%29.aspx

Another, and maybe a better long term option, is to configure the old clients to ignore the publisher policy: http://msdn.microsoft.com/en-us/library/cf9025zt%28v=vs.80%29.aspx

最后,我很确定2.0与4.0框架的.net组件在ODP.net安装过程中是单独的安装选项.我认为您可能可以通过不安装2.0组件来避免此问题.关于这一点,您可以通过针对64位odp.net开发新项目来进行类似的工作.像v2​​.0和v4.0一样,32位和64位也互不了解.

Finally, I'm pretty sure the .net components for the 2.0 vs. 4.0 frameworks are separate install options during the ODP.net installation. I think you might be able to avoid this issue simply by not installing the 2.0 components. On that note you could do a similar work around by developing your new project against the 64 bit odp.net instead. Like v2.0 and v4.0, 32 bit and 64 bit also do not have any awareness of each other.

这篇关于如何在同一台计算机上并排安装ODP.NET 2.111和ODP.NET 4.112,同时它们都指向同一数据库服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆