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
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...