Sdílet prostřednictvím


Understanding MSDTC & BizTalk

 

MSDTC is the Microsoft Distributed Transaction Coordinator.

DTC provides the functionality to ensure complete transactions along a distributed environment, which means: across two or more networked computers.

It May help to think in a typical database transaction to imagine what is happening under the hood:

BEGIN TRANSACTION

o DO SOMETHING across several DIFFERENT MACHINES (MAY USE LOCAL TRANSACTIONS)

COMMIT TRANSACTION (OR ROLLBACK)

In this way, database and distributed transactions enforce the ACID properties, Atomicity, Consistency, Isolatation and durability.

By default, network DTC access is disabled. Without network DTC access on the server, applications can only use transactions that stay on the local computer. For example, transactions cannot flow from a local computer to a database that runs on a separate computer. Since BizTalk leverages several different databases, and in most cases spans multiple servers, MSDTC is used extensively to “communicate” with SQL Server, especially if using adapters supporting transactions, such as: classic SQL Server

· WCF SQL Server

· MQ Series

· …

How MSDTC works:

The basic concept is that Server A initiates work in a transactional context (initiates a transaction).  To complete the operation, it must do something in a SQL Server database running on Server B .  It then connects to Server B hosting the SQL Server database and does some work.  Imagine the operation on the SQL Server machine fails due to some kind of problem, so that the transaction initiated on the SQL Server machine must be rolled back, as well as the operations on Server B.

Each computer, in a distributed transaction, has its own resources and participates as an element in the global transaction that must be committed or aborted across all the serversinvolved. MSDTC performs the coordination role for the components (and machines) and decides if a global transaction is successfully committed or must be rolled back.

DTC uses a protocol based on two phases:

1. Phase one involves the transaction manager requesting each enlisted component to prepare to commit;

2. In phase two, if all enlistees successfully prepare, the transaction manager broadcasts the commit decision.

In general, each transaction involve the following steps:

1. Applications call the transaction manager (DTC) to begin a transaction. At this point, the transaction is no longer local and DTC will coordinate the state.

2. When the application has prepared its changes, it asks the transaction manager to commit the transaction. The transaction manager keeps a sequential transaction log so its commit or abort decisions will be durable. The transaction log is a physical log file on disk .

For all settings (on Windows 2008) you can find DTC under the standard Component Services snap-in:

clip_image001[1]

Tracing

Set up on your own. By default DTC will trace just Aborted and Long-Lived Transactions

Logging

Right Click on LocalDTC (of course if using a local coordinator) and click on Logging TAB

clip_image002[1]

You can then choose a location for the log file. When configuring MSDTC on the SQL Server Machine, make sure to take the following rules into account:

· Specify a disk location other than the disk used by the MessageBoxDb, TrackingDB and BAM databases.

· Specify a location other than the system drive

  • A dedicated local disk would be perfect

By default the Capacity of the log file is set to 4 MB.   Increase this value as needed and as ruled by the availability of disk space in your storage selection.

Security

On a non-clustered MSDTC installation, the security settings are stored under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\Security  

And when it is clustered they are at:

HKEY_LOCAL_MACHINE\Cluster\Resources\<MSDTC resource GUID>

Warning:   You should not directly modify these settings in the registry, but rather do so through the administrative console as described below.

In windows 2008:

Go to Distributed transaction coordinator and Right Click the Local DTC

Go to the security TAB

clip_image003[1]

Explanation of the Security TAB

· Network DTC Access allows you to configure whether or not the transaction coordinator has access to the network.  We must enable Network DTC access for BizTalk to work properly. .

· Allow Remote Clients and Allow remote Administration. No explanations needed. it is what it means;- ).   It has no implications on BizTalk but the recommendation, for security restrictions will be to disable both. If using MQSeries, Allow Remote Administration must me enabled

· Allow Inbound specifies whether transactions Initiated on source machines will be allowed By default this check box is disabled.  Must be enabled for BizTalk to work properly.

· Allow Outbound determines whether to allow the local computer to initiate a transaction and run that transaction on a remote computer.

· Mutual Authentication Required. If the remote access communication is performed between two DTC services, this authentication information must specify a computer account that matches the remote transaction mode computer's host name.

· Incoming caller Authentication Required. Following Microsoft Best Practices , MSDTC on SQL Server must be clustered. If this is your case, you must configure the Transaction Manager Communication with this option because In a clustered environment, DTC authentication does not use the host name, it uses the name of the virtual service and just for being clustered, the configured DTC already trusts on the destination DTC.

· No Authentication Required is used in the following instances:

· Running Microsoft Windows 2000.  (Non applicable to BizTalk 2006 and above)

· The transaction occurs between servers in two domains that do not have a mutual trust (Could be the case)

· Computers are communicating through workgroup  (non applicable to BizTalk)

· Enable XA Transactions  Should be enabled when using an adapter which is XA compliant based (such as MQ Series)

TOOLS to assist you

DTCPing.exe   visit https://go.microsoft.com/fwlink/?LinkId=72166.

DTCTester Tool   visit https://support.microsoft.com/kb/293799

For more information about how to troubleshoot MSDTC, see https://go.microsoft.com/fwlink/?LinkId=72203.

Important Updates:

https://support.microsoft.com/kb/979919