一同事在測試服務器(系統: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'選項。
- exec sp_configure 'show advanced options',1;
- go
- reconfigure;
- go
- exec sp_configure 'remote access',1;
- go
- reconfigure;
- go
- exec sp_configure 'remote admin connections',1;
- go
- reconfigure;
- go
- exec sp_configure 'remote proc trans',1 ;
- go
- reconfigure;
- 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)
Step 2: 右鍵單擊"Local DTC"的屬性,就可以看到“Tracing”、“Logging”、“Security”三個面板。關於設置屬性。可以點擊下面的“Learn more about setting these properties”
如下所示,一般只用設置“Security”下的屬性,具體情況,根據實際情況配置,可以參考下面“本地DTC屬性頁:“安全選項”卡說明
注意:如果服務器開啟了防火牆,那么必須確保防火牆是否開放了135端口(即允許Distributed Transaction Coordinator程序通過防火牆)
參考資料: