SSMA 无法找到指定的提供程序

SSMA unable to find specified provider

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

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

我已经设置了环境变量HOME_ORACLE,并且安装时默认设置了PATH,所以我排除了问题所在。 我还搜索了 ODAC,所有提示都让我想起了 oracle istant provider,但由于我已经安装了带有管理员安装(完整)的客户端,我认为安装也会覆盖它们。 有什么建议吗?

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

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

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

set Oracle_x86=c:\oracle\product.1\Client_x86\odp.net
set OraProvCfg_x86=%Oracle_x86%\bin\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\Policy.4.121.Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\Policy.4.121.Oracle.ManagedDataAccess.dll
IF EXIST "%Oracle_x64%\managed\PublisherPolicy\Policy.4.122.Oracle.ManagedDataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\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.x\Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\bin.x\Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy.x\Policy.2.102.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy.x\Policy.2.102.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy.x\Policy.2.111.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy.x\Policy.2.111.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy.x\Policy.2.112.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy.x\Policy.2.112.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy.x\Policy.2.121.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy.x\Policy.2.121.Oracle.DataAccess.dll
IF EXIST "%Oracle_x64%\PublisherPolicy.x\Policy.2.122.Oracle.DataAccess.dll" "%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy.x\Policy.2.122.Oracle.DataAccess.dll

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

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

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

更新

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

Applies to:
Oracle Data Provider for .NET - Version 12.1.0.2 and later
Microsoft Windows x64 (64-bit)
Microsoft Windows (32-bit)

Symptoms
When installing the 12.2 Oracle Data Provider for .Net, the provider is not automatically registered in the Global Assembly Cache (GAC).

Changes
Moved to the 12.2 version of the Oracle Provider for .Net

Cause
This is the expected behavior. Since so many environments are using multiple versions of ODP.Net side by side, starting with 12.2, the installer does not automatically register the ODP.Net provider in the GAC by default.

Solution
Manually register the dll into the GAC as outlined in Doc ID 1169890.1: HOWTO: Example use of OraProvCfg.exe to add/remove Oracle assemblies from the Global Assembly Cache

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