0

我已经安装了完整的 oracle 客户端 12.2.0,并且我正在尝试使用 SSMA 将一些数据库从 oracle 迁移到 sql server,但是当我尝试连接到 oracle 时,出现以下错误:

Unable to find specified provider.
Compatible Oracle Data Access Connectivity libraries were not found on the machine.

我已经设置了环境变量 HOME_ORACLE 并且 PATH 是在安装过程中默认设置的,所以我排除了问题的存在。我还搜索了有关 ODAC 的信息,所有提示都让我想起了 oracle istant 提供程序,但是由于我已经使用管理员安装(完整)安装了客户端,所以我认为安装也会涵盖它们。有什么建议吗?

编辑:我尝试使用标准模式和 tnsnames 模式登录,但结果是一样的

4

1 回答 1

1

看起来 Oracle Universal Installer 12.2 中有一个错误,它没有注册 ODP.NET 组件。您可以运行下面的脚本(根据您的系统修改文件夹名称)以正确配置它们。

set Oracle_x64=c:\oracle\product\12.1\Client_x64\odp.net
set OraProvCfg_x64=%Oracle_x64%\bin\4\OraProvCfg.exe

set Oracle_x86=c:\oracle\product\12.1\Client_x86\odp.net
set OraProvCfg_x86=%Oracle_x86%\bin\4\OraProvCfg.exe

set TNS_ADMIN=C:\oracle\network\admin



IF EXIST "%Oracle_x64%\managed\common\Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\common\Oracle.ManagedDataAccess.dll
IF EXIST "%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.121.Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.121.Oracle.ManagedDataAccess.dll
IF EXIST "%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.122.Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.122.Oracle.ManagedDataAccess.dll

IF EXIST "%Oracle_x64%\managed\common\Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:%Oracle_x64%\managed\common\Oracle.ManagedDataAccess.dll /set:settings\TNS_ADMIN:%TNS_ADMIN%
IF EXIST "%Oracle_x86%\managed\common\Oracle.ManagedDataAccess.dll" "%OraProvCfg_x86%" /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:%Oracle_x86%\managed\common\Oracle.ManagedDataAccess.dll /set:settings\TNS_ADMIN:%TNS_ADMIN%

rem Oracle.ManagedDataAccessDTC was used in earlier versions, not used anymore
"%OraProvCfg_x64%" /action:ungac /providerpath:Oracle.ManagedDataAccessDTC

IF EXIST "%Oracle_x64%\bin\2.x\Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\bin\2.x\Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll

IF EXIST "%Oracle_x64%\bin\4\Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\bin\4\Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll

IF EXIST "%Oracle_x86%\bin\2.x\Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\bin\2.x\Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll

IF EXIST "%Oracle_x86%\bin\4\Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\bin\4\Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll
IF EXIST "%Oracle_x86%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll" "%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll

更新

根据Oracle Doc ID 2272241.1,这似乎是有意的:

适用于:适用于
.NET 的 Oracle 数据提供程序 - 版本 12.1.0.2 及更高版本
Microsoft Windows x64(64 位)
Microsoft Windows(32 位)

症状
为 .Net 安装 12.2 Oracle 数据提供程序时,提供程序不会自动在全局程序集缓存 (GAC) 中注册。

更改
为 .Net 的 Oracle Provider 的 12.2 版本

原因
这是预期的行为。由于如此多的环境同时使用多个版本的 ODP.Net,从 12.2 开始,默认情况下,安装程序不会自动在 GAC 中注册 ODP.Net 提供程序。

解决方案
按照文档 ID 1169890.1 中所述手动将 dll 注册到 GAC:HOWTO:使用 OraProvCfg.exe 的示例从全局程序集缓存中添加/删除 Oracle 程序集

但是,我认为这是一个错误。并行运行多个版本的 ODP.Net 是相当困难的,因为版本必须与Oracle 客户端的版本完全Oracle.DataAccess.dll匹配。安装多个 Oracle 客户端(即 64 位和 32 位各一个以上)通常会导致很多问题,而且并不常见。

于 2019-01-03T10:44:39.920 回答