一同僚在測試伺服器(系統: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
exec sp_configure 'show advanced options',1;
go
reconfigure;
exec sp_configure 'remote access',1;
exec sp_configure 'remote admin connections',1;
exec sp_configure 'remote proc trans',1 ;
配置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程式通過防火牆)