Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "OraOLEDB.Oracle" for linked server xxxx

来源:https://www.cnblogs.com/kerrycode/archive/2018/09/04/9589163.html
-Advertisement-
Play Games

今天遇到了一個關於LINKED SERVER查詢報錯的案例,鏈接伺服器鏈接ORACLE資料庫,測試沒有錯誤,但是執行腳本的時候,報如下錯誤: Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "OraOLEDB.Oracle" for l... ...


 

今天遇到了一個關於LINKED SERVER查詢報錯的案例,鏈接伺服器鏈接ORACLE資料庫,測試沒有錯誤,但是執行腳本的時候,報如下錯誤:

 

clip_image001

 

 

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "OraOLEDB.Oracle" for linked server "xxxx" reported an error. Access denied.

Msg 7301, Level 16, State 2, Line 1

Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "OraOLEDB.Oracle" for linked server "xxxx".

 

 

其實以前遇到過類似的案例,但是這次案例發生在SQL Server 2012 (SP4) (KB4018073) - 11.0.7001.0 (X64)下,LINKED SERVER使用 Oracle Provider for OLE DB驅動,跟之前遇到的案例Cannot create an instance of OLE DB provider "OraOLEDB.Oracle" for linked server "xxxxxxx".有一些區別。解決方案相同,需要在Oracle Provider for OLE DB驅動的選項裡面勾選Allow inporcess",或者修改註冊表,具體參考下麵Metalink官方文檔。(另外,今天還遇到了很奇葩的事情,設置後,SQL 語句在其他資料庫執行OK,但是在master庫下麵就一直報這個錯誤,但是一段時間後又OK了。十分奇怪,暫時不清楚具體原因)

 

 

clip_image002

 

 

 

MetalinkUsing Oracle OLE DB Provider and MS SQL Server To Acccess Oracle Database Raise Errors 7399 And 7301 (文檔 ID 396648.1)的詳細介紹

 

 

SYMPTOMS

You are unable to connect to the Oracle database when using Microsoft SQL Server's Linked Server and the Oracle Provider for OLE DB and receive errors messages like

 

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "OraOLEDB.Oracle" for linked server "TEST" reported an error. The provider reported an unexpected catastrophic failure.

Msg 7301, Level 16, State 2, Line 1

Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "OraOLEDB.Oracle" for linked server "TEST".

 

CAUSE

 

The Oracle Provider for OLE DB has been configured to run out-of-process (in a separate process than the SQL Server process, typically DLLHOST.EXE) but it is mandatory to run the Oracle Provider for OLE DB as in-process to function properly with SQL Server.

 

SOLUTION

 

Please apply solution from

Note:333327.1 Error "Could not execute query against OLE DB provider 'OraOLEDB.Oracle'" when Querying Against an Oracle Database using Microsoft SQL Server Linked Server and the Oracle Provider for OLE DB

which describes the same problem but with different symptoms.

 

REFERENCES

NOTE:333327.1 - Error "Could not execute query against OLE DB provider 'OraOLEDB.Oracle'" when Querying Against an Oracle Database using Microsoft SQL Server Linked Server and the Oracle Provider for OLE DB

 

 

 

另外,關於文檔333327.1 ——Error "Could not execute query against OLE DB provider 'OraOLEDB.Oracle'" when Querying Against an Oracle Database using Microsoft SQL Server Linked Server and the Oracle Provider for OLE DB (文檔 ID 333327.1)的具體內容如下:

 

APPLIES TO:

Oracle Provider for OLE DB - Version 10.2.0.1 and later
Microsoft Windows (32-bit)

***Checked for relevance on 10-Oct-2016*** 



SYMPTOMS

You are unable to connect to the Oracle database when using Microsoft SQL Server's Linked Server and the Oracle Provider for OLE DB. When issuing the following query from Microsoft's SQL Query Analyzer  

SELECT * FROM DEV..SCOTT.EMP

You receive the following error

Server: Msg 7320, Level 16, State 2, Line 1
  Could not execute query against OLE DB provider 'OraOLEDB.Oracle'.
  OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' ICommandText::Execute returned 0x80040155].

 

If you change the query so that it will not return any rows it runs successfully

SELECT * FROM DEV..SCOTT.EMP where 1=0

CAUSE

The Oracle Provider for OLE DB has been configured to run out-of-process (in a separate process than the SQL Server process, typically DLLHOST.EXE).  The Oracle Provider for OLE DB must run in-process to function properly with SQL Server.

By SQL*Net tracing the failing query you can look at the TNS information inside of a SQL*Net trace you can see the difference between a provider running IN and OUT of process:

  
In-Process Trace:

(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=gbednars-pc)(PORT=1521)))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl.rmmslang.us.oracle.com)
(CID=(PROGRAM=C:\PROGRA~1\MI6841~1\MSSQL\binn\sqlservr.exe)(HOST=GBEDNARS-PC)
(USER=SYSTEM))))

  Out-Of-Process Trace:

(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=gbednars-pc)(PORT=1521)))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl.rmmslang.us.oracle.com)
(CID=(PROGRAM=C:\WINDOWS\System32\DllHost.exe)(HOST=GBEDNARS-PC)(USER=SYSTEM))))

In the In-Process trace the TNS information shows us that the Oracle Provider for OLE DB is running under the sqlservr.exe process.  In the Out-Of-Processtrace we see that the same provider is running under the DllHost.exe process.  DllHost is used as a surrogate process in place of SQL Server to host out-of-process executions and clearly shows us that the Oracle OLE DB provider has been configured this way.

SOLUTION

  1. Open the registry and check the value of the AllowInProcess key being used by the Oracle Provider for OLE DB
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Providers\OraOLEDB.Oracle
    
         AllowInProcess     REG_DWORD     0x00000000 (0)
  2. If the AllowInProcess key has been set to a value of 0 then it is configured to run out-of-process.  Change the value from 0 to 1 or if the key does not exist, create it as a DWORD with a value of 1.  The value 1 is also the default setting signifying in-process.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Providers\OraOLEDB.Oracle
    
         AllowInProcess     REG_DWORD     0x00000001 (1)
    
    OR
    
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Providers\OraOLEDB.Oracle
         AllowInProcess     REG_DWORD     0x00000001 (1)        
            

NOTE:  Microsoft states that the out-of-process setting AllowInProcess=0, is not to be used with any provider other than SQLOLEDB (Microsoft's OLEDB Provider for SQL Server).  See the following link for more information:

  Microsoft Knowledge Base Article ID 833388
       
You cannot create out-of-process providers with MDAC OLE DB components

Additionally, the Oracle Provider for OLE DB Developer's Guide states that the Oracle Provider for OLE DB (OraOLEDB) is an in-process server.

 

 

 

 

參考資料

 

Using Oracle OLE DB Provider and MS SQL Server To Acccess Oracle Database Raise Errors 7399 And 7301 (文檔 ID 396648.1)

Error "Could not execute query against OLE DB provider 'OraOLEDB.Oracle'" when Querying Against an Oracle Database using Microsoft SQL Server Linked Server and the Oracle Provider for OLE DB (文檔 ID 333327.1)


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1.清理電腦桌面: 桌面文件越少越好,畢竟桌面東西多是很占資源的; 2.更改電腦虛擬記憶體: 虛擬記憶體可以彌補系統記憶體的不足,也就是拿硬碟空間當記憶體使用; 3.清空“Temp”文件夾: 在C盤的windows文件夾下有一個temp,刪除即可; 4.刪除工具欄圖標: 工具欄有很多用不著的圖標,放哪也沒 ...
  • 實例拓撲圖: DR1和DR2部署keepalived和lvs作主從架構或主主架構,RS1和RS2部署nginx搭建web站點。 註意:各節點的時間需要同步(ntpdate ntp1.aliyun.com);關閉firewalld(systemctl stop firewalld.service,sy ...
  • 另一篇關於終端會話共用的文章: "Linux錄製、回放和共用終端操作" kibitz可以將一個會話(你所操作的)實時分享給本機的其它登陸用戶(你想讓別人看到的)。通過這個工具,你敲什麼命令,輸出了什麼內容對方都能立即看到,用來演示很不錯。 它是是expect中的一個工具,所以先安裝expect。 使 ...
  • Linux 內核使用 task_struct 數據結構來關聯所有與進程有關的數據和結構,Linux 內核所有涉及到進程和程式的所有演算法都是圍繞該數據結構建立的,是內核中最重要的數據結構之一。 該數據結構在內核文件include/linux/sched.h中定義,在目前最新的Linux 4.5(截至目 ...
  • 一、簡單的多級菜單 顯示效果如下: ...
  • 如下圖所示,Checktime這個欄位有很多重覆數據,我需要把所有Checktime這個欄位重覆的都刪掉,但是還需要保留一條; 在Access做刪除查詢怎麼做呀,來個Access高手,複製粘貼黨請手下留情,謝謝。 ...
  • 背景介紹: 查詢MongoDB配置參數,可以知道關於最大連接數的參數是maxConns。但是連接實例後,查看支持的最大連接數,還是預設的819。 說明:最大連接數是由maxConn (maxIncomingConnections)和操作系統單個進程能打開的最大文件描述符數總量的80%決定的,取兩個之 ...
  • 一、簡單實現mysql一鍵安裝 參考:【第二章】MySQL資料庫基於Centos7.3-部署 此腳本前提條件是防火牆,selinux都已經設置完畢: 二、修改Mysql初始密碼 1)由於mysql5.7初始化是有密碼的,需要找到密碼才能登陸,所以我們直接通過腳本修改密碼,並實現登陸: 2)優化以上腳 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...