在開發(fā)分布式數(shù)據(jù)庫軟件時,經(jīng)常碰到下面的錯誤:
服務器: 消息 7391,級別 16,狀態(tài) 1,行 6
該操作未能執(zhí)行,因為 ole db 提供程序 'sqloledb' 無法啟動分
布式事務。
[ole/db provider returned message: 不能在指定的事務處理器中
獲得新事務。]
-----------------------------------------
服務器: 消息 8520,級別 20,狀態(tài) 1,行 8
內(nèi)部 msdtc 事務的提交失敗: result code = 0x8004d019。
連接中斷
-----------------------------------------
搜索了網(wǎng)上類似問題的解決方案,都建議采用下面的方法(方法一):
1、運行 regedt32,瀏覽至 hkey_local_machine oftware/microsoft/msdtc。
添加一個 dword 值 turnoffrpcsecurity,值數(shù)據(jù)為 1。
2、重啟ms dtc服務。
3、打開“管理工具”的“組件服務”。
a. 瀏覽至"啟動管理工具"。 b. 選擇"組件服務"。 c. 展開"組件服務"樹,然后展開"我的電腦"。 d. 右鍵單擊"我的電腦",然后選擇"屬性"。 在 msdtc 選項卡中,確保選中了下列選項:
網(wǎng)絡 dtc 訪問 網(wǎng)絡管理 網(wǎng)絡事務xa 事務
另外,"dtc 登錄帳戶"一定要設置為"nt authority/networkservice"。4、重啟ms dtc服務。
5、再次運行 regedt32,瀏覽至 hkey_local_machine oftware/microsoft/msdtc,然后刪除 turnoffrpcsecurity 項。
但是實際上該方法基本上解決不了問題,經(jīng)過長時間的反復實踐,我終于按下面的方法解決了:
(方法二)
1、按照方法一的方法處理一遍,如果不行,再繼續(xù)下面的方法
2、安裝windows 2003 sp1,安裝好后,方法一中的第4步設置對話框和原來不一樣了,選擇“事務管理通訊”中的“不要求驗證”
3、最好安裝好mdac2.8
3、通過查找,在c:找到名為“hosts”的文件(沒有擴展名),通常路徑為c:/windows/system32/drivers/etc,將對方服務器的ip和計算機對應起來,參考如下:
========================================
# copyright (c) 1993-1999 microsoft corp.
#
# this is a sample hosts file used by microsoft tcp/ip for windows.
# www.knowsky.com
# this file contains the mappings of ip addresses to host names. each
# entry should be kept on an individual line. the ip address should
# be placed in the first column followed by the corresponding host name.
# the ip address and the host name should be separated by at least one
# space.
#
# additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# for example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
192.168.1.2 中心
192.168.1.3 西站
192.168.106.35 信息中心2
=============================================
一定要將每臺服務器的hosts文件都修改好
通過以上辦法,我的分布式就可以正常運行了,速度也非常快
新聞熱點
疑難解答
圖片精選