MS SQL 錯誤:The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "test" was unable to begin a distributed transaction.


   一同事在測試服務器(系統:Windows 2008 R2 Standard 數據庫:SQL SERVER 2008 R2)通過鏈接服務器test使用分布式事務測試時出錯,出錯信息如下:

set xact_abort on

begin tran

update test.mydb.dbo.test_one set name='test' where  id= 3 ;

commit

OLE DB provider "SQLNCLI10" for linked server "test" returned message "The transaction manager has disabled its support for remote/network transactions.".

消息 7391,級別 16,狀態 2,第 5 行

The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "test" was unable to begin a distributed transaction.

出現這個錯誤時因為這台服務器,或者鏈接服務器那台服務器沒有配置好MS DTC(Microsoft Distributed Transaction Coordinator  微軟 分布式事務協調器)。

    首先確保開啟了 'remote access'、 'remote admin connections'、 'remote proc trans'選項。

Code Snippet
  1. exec sp_configure 'show advanced options',1;
  2.  
  3. go
  4.  
  5. reconfigure;
  6.  
  7. go
  8.  
  9. exec sp_configure 'remote access',1;
  10.  
  11. go
  12.  
  13. reconfigure;
  14.  
  15. go
  16.  
  17. exec sp_configure 'remote admin connections',1;
  18.  
  19. go
  20.  
  21. reconfigure;
  22.  
  23. go
  24.  
  25. exec sp_configure 'remote proc trans',1 ;
  26.  
  27. go
  28.  
  29. reconfigure;
  30.  
  31. go

配置DTC步驟

Step 1:Start(開始)-Control Panel(控制面板)-System and Security(系統和安全)- Administrative Tools(管理工具)-Component Services(組件服務)(或者Run->dcomcnfg 直接跳出組件服務)。

  進入界面點擊(Console Root->Componet Services->Computers->My Computer-> Local DTC)

clipboard

Step 2: 右鍵單擊"Local DTC"的屬性,就可以看到“Tracing”、“Logging”、“Security”三個面板。關於設置屬性。可以點擊下面的“Learn more about setting these properties”

clipboard[1]

clipboard[2]

如下所示,一般只用設置“Security”下的屬性,具體情況,根據實際情況配置,可以參考下面“本地DTC屬性頁:“安全選項”卡說明

clipboard[3]

clipboard[4]

 

image

注意:如果服務器開啟了防火牆,那么必須確保防火牆是否開放了135端口(即允許Distributed Transaction Coordinator程序通過防火牆)

參考資料:

http://blog.csdn.net/wobuwei/article/details/4352792


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM