摘自:https://support.microsoft.com/zh-cn/kb/293799#bookmark-4
————————————————————————————
概要
下載 DTCTester 工具
下列文件已可從 Microsoft 下載中心下載:
下載 DTCTester 軟件包。有關如何下載 Microsoft 支持文件的其他信息,請單擊下面的文章編號,以查看 Microsoft 知識庫中相應的文章:
119591如何從在線服務獲得 Microsoft 支持文件
Microsoft 已對此文件進行病毒掃描。Microsoft 使用自該文件發布日期起可用的最新的病毒檢測軟件。該文件存儲在安全增強型服務器上,以防止對文件進行任何未經授權的更改。
DTCTester 工具的作用是什么?
- 通過使用數據源名稱 (DSN)、 用戶名和密碼,您在命令行上使用提供的默認網絡庫建立與 SQL Server 的連接。
- 創建一個臨時表。
- 登記在事務中的連接。
- 會在臨時表上的插入。
- 提交分布式的事務。
- 選擇插入的值,以確保它已提交。
- 關閉連接。
如何使用 DTCTester 工具
- 為您的 SQL Server ODBC 控制面板實用程序中通過創建 ODBC 數據源。
- 從命令行執行以下命令︰
dtctester <dsn name><user name><password>替換為您的環境相應的括號中的值。
其中 DTCTester 工具失敗的常見原因
- 防火牆有關閉的正確端口。
- 沒有壞的 WINS/DNS 條目。
- 錯誤配置的 SQL Server 群集或雙網卡。
- 其他錯誤配置的網絡設置。
DTCTester 失敗時發生的錯誤的示例
Command Line: dtctester bad baduser badpass Executed: dtctester DSN: bad User Name: baduser Password: badpass tablename=#dtc7421 Creating Temp Table for Testing: #dtc7421 Warning: No Columns in Result Set From Executing: 'create table #dtc7421 (ival int)' Initializing DTC Beginning DTC Transaction Enlisting Connection in Transaction Error: SQLSTATE=25S12, Native error=-2147168242,msg='[Microsoft][ODBC SQL Server Driver] Distributed transaction error' Error: SQLSTATE=24000, Native error=0,msg=[Microsoft][ODBC SQL Server Driver]Invalid cursor state Aborting DTC Transaction Releasing DTC Interface Pointers Successfully Released pTransaction Pointer
成功的 DTCTester 輸出的示例
Command Line: dtctester test sa Executed: dtctester DSN: test User Name: sa Password is assumed to be NULL. Connecting to the database tablename= #dtc7488 Creating Temp Table for Testing: #dtc7488 Warning: No Columns in Result Set From Executing: 'create table #dtc7488 (ival int)' Initializing DTC Beginning DTC Transaction Enlisting Connection in Transaction Executing SQL Statement in DTC Transaction Inserting into Temp...insert into #dtc7488 values (1) Warning: No Columns in Result Set From Executing: 'insert into #dtc7488 values (1) ' Verifying Insert into Temp...select * from #dtc7488 (should be 1): 1 Press enter to commit transaction. Committing DTC Transaction Releasing DTC Interface Pointers Successfully Released pTransaction Pointer. Disconnecting from Database and Cleaning up Handles
DTC 的建議到打開的端口
| 輸入端口 | 端口的目的 |
|---|---|
| 打開 135 | RPC EPM (終結點映射程序) |
| 打開 1433 | TDS SQL 通信使用 TCP/IP 時 |
| 打開 1434 | SQL 2000 集成安全性 |
| 打開 5100 5200 | MSDTC [EPM 通過動態分配端口] |
參考資料
191168信息︰ 錯誤"-2147168246 (8004d00a)"無法在調用對象的事務中登記
其他信息,請參閱以下 Microsoft 網站上的白皮書︰
