Fix it now
Error 7391 is published as the operation failing because the OLE DB provider for the linked server was unable to begin a distributed transaction, and 8501 as MSDTC on the named server being unavailable. The linked server itself is usually healthy, which is why plain SELECT statements keep working while anything that writes fails.
Get-DtcNetworkSetting -DtcName Local
Set-DtcNetworkSetting -DtcName Local -AuthenticationLevel NoAuth `
-InboundTransactionsEnabled $true -OutboundTransactionsEnabled $true `
-RemoteClientAccessEnabled $true -Confirm:$false
Test-Dtc -LocalComputerName SERVERA -RemoteComputerName SERVERB -Verbose
- Read the current settings on both machines first. Network DTC access is off by default on a freshly built Windows Server, and that alone produces 7391.
- Set the same authentication level on both. The documented values are
Mutual,IncomingandNoAuth; useMutualwhere both machines are in the same or trusting domains, andNoAuthon both only where mutual authentication cannot succeed. - In Windows Defender Firewall on both machines, enable the preconfigured Distributed Transaction Coordinator rule group, which is what Microsoft recommends rather than opening ports by hand.
- Run the test between the two machines and read every failure it prints, then retry the statement that failed.
8501 names the machine whose coordinator did not answer. Start on that machine rather than the one you are sitting at; it is the most useful part of the message.
If the statement now commits, stop here. If the test still fails, the next section separates the three things that have to work between two coordinators.
Why it happens
A statement that changes data on a linked server cannot be committed by the local engine alone. Either both sides commit or both roll back, so SQL Server escalates the local transaction into a distributed one and hands ownership to the Microsoft Distributed Transaction Coordinator. The local coordinator must then contact the coordinator on the remote machine, agree a transaction identifier and stay in contact until the two-phase commit finishes. Error 7391 says that first step never succeeded, so no work was attempted at all.
Three things trigger escalation. An explicit distributed transaction obviously does. So does an INSERT, UPDATE or DELETE against a four-part name inside an explicit transaction. The third catches people out: a remote procedure call over a linked server escalates too, because the option that promotes those calls into distributed transactions is documented as defaulting to true. Administrators certain they are only reading get 7391 and cannot see why.
The conversation between coordinators runs over RPC. Each side resolves the other by computer name, contacts the RPC endpoint mapper on TCP 135, then moves to a dynamically assigned port for the session itself. Three separate things must work: name resolution in both directions, TCP 135, and the dynamic port range. Microsoft’s own recommendation is to use the preconfigured Distributed Transaction Coordinator firewall rule group rather than reasoning about the ports individually.
The neighbouring codes are precise about which layer failed. Error 8501 is published as MSDTC on the named server being unavailable, which tells you where to go. Error 8522 is published as the Distributed Transaction Coordinator having stopped the transaction, which means the coordinator ended it rather than SQL Server, and the local work rolled back with it. Error 7411 is published as the server not being configured for a named option, which is the linked server definition missing something like RPC OUT or data access rather than anything to do with DTC.
Network DTC access is switched off
You have this one if On the Local DTC security settings of one or both machines, network access is not enabled. That is the default on a freshly built Windows Server.
- Enable inbound and outbound transactions and remote client access on both machines, either through Component Services or with the PowerShell above.
- Read the result back with
Get-DtcNetworkSetting -DtcName Localon both machines. - Retry the statement; the DTC service restarts as part of the change.
NoAuth is the loosest of the three documented authentication levels. Between two servers on a segment you control it is routine; do not use it where the traffic crosses anything untrusted.
The two coordinators disagree about authentication
You have this one if Network access is enabled on both sides and the test still fails, with a message about security rather than connectivity.
- Compare the authentication level on both machines. They have to match, because the coordinators do not negotiate downwards.
- Where both machines are in the same or trusting domains, set
Mutualon both. - Where one is in a workgroup or an untrusted domain, mutual authentication cannot succeed; set
NoAuthon both deliberately and restart the DTC service on each.
A firewall blocks the endpoint mapper or the dynamic port range
You have this one if The test passes name resolution and then fails at the RPC stage, or a port test to 135 fails.
- Enable the preconfigured Distributed Transaction Coordinator inbound rule group in Windows Defender Firewall on both machines.
- Confirm reachability to TCP 135 from each side, since that is the port MSDTC uses to start the conversation.
- Ask the network team to allow the RPC dynamic port range between the hosts as well, because the session moves off 135 immediately after the redirect.
The linked server escalates transactions it does not need to
You have this one if Only stored procedure calls across the linked server fail; four-part-name statements outside an explicit transaction work.
- Read the current setting, then turn promotion off if the remote call need not be atomic with local work:
EXEC sp_serveroption @server = N'LINKEDSRV', @optname = 'remote proc transaction promotion', @optvalue = 'false'; - Retry the procedure call.
- Leave it on wherever the remote work genuinely has to succeed or fail with the local work.
This is a correctness decision, not a workaround. With promotion off, a failure after the remote procedure commits will not roll the remote work back. The documented default is true.
The linked server definition is missing an option
You have this one if Error 7411 rather than 7391, naming the server and the option it is not configured for.
- Read the linked server’s options and compare them against what the statement needs, typically data access or outbound remote procedure calls.
- Set the missing option with
sp_serveroptionand retest. - Do not enable options you do not need; each one widens what the linked server can be used for.
Full reference
Narrowing it down before you change anything
| What you observe | Where to look first |
|---|---|
| SELECT works, INSERT fails | Transaction escalation, not connectivity |
| Only remote procedure calls fail | Remote procedure call promotion on that linked server |
| It works from A to B but not B to A | Inbound or outbound network DTC access is off on one side |
| The test fails at name resolution | The machines cannot resolve each other’s computer names |
| It broke after a move to a new subnet or cluster | Firewall rules, or the clustered DTC resource |
| 8501 names the remote machine | Start there, not on the machine you are sitting at |
| 7411 rather than 7391 | The linked server definition, not MSDTC |
The settings that have to match
| Setting | Values | Notes |
|---|---|---|
-AuthenticationLevel |
Mutual, Incoming, NoAuth |
Must be the same on both machines |
-InboundTransactionsEnabled |
$true or $false |
A transaction arriving from the other machine |
-OutboundTransactionsEnabled |
$true or $false |
A transaction this machine starts against the other |
-RemoteClientAccessEnabled |
$true or $false |
Needed when a third machine starts the transaction |
-DtcName |
Local for the local instance |
Omit and it defaults to the local DTC |
Writing a distributed transaction that fails cleanly
When you do need atomic writes across two instances, set XACT_ABORT on. Without it a runtime error inside a distributed transaction can leave the transaction open rather than rolling it back, and the second failure you get is far less informative than the first.
SET XACT_ABORT ON;
BEGIN DISTRIBUTED TRANSACTION;
UPDATE dbo.Orders
SET Status = 'Shipped'
WHERE OrderId = @OrderId;
UPDATE LINKEDSRV.WarehouseDb.dbo.Stock
SET Allocated = Allocated - @Qty
WHERE Sku = @Sku;
COMMIT TRANSACTION;
When a third machine is involved
An operation that works from Management Studio on the server and fails from the application usually has a third coordinator in it. When a client application starts the transaction itself, that machine’s coordinator becomes the transaction root and needs the same settings and the same firewall path to both database servers. Remote client access on the database servers is the setting that most often turns out to be missing in that shape.
Pinning the port range
Where policy will not allow a wide dynamic range between two hosts, RPC can be configured to use a fixed, identical port list on both machines. That is an RPC configuration change rather than a SQL Server one: agree the range with the network team, apply it identically on both sides, and expect to reboot, because RPC reads that configuration at startup. Back up whatever you change first, because a mismatch here breaks more than distributed transactions.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
7391 |
The operation could not be performed because the OLE DB provider for the linked server was unable to begin a distributed transaction | Microsoft Learn |
8501 |
MSDTC on the named server is unavailable | Microsoft Learn |
8522 |
The Microsoft Distributed Transaction Coordinator has stopped this transaction, so the coordinator ended it rather than SQL Server | Microsoft Learn |
7411 |
The named server is not configured for the option the statement needs, such as data access or outbound remote procedure calls | Microsoft Learn |
Confirm the fix worked
- The DTC test between the two machines completes with no reported failures in either direction.
Get-DtcNetworkSetting -DtcName Localreturns the same authentication level on both machines.- A test distributed transaction updating one row on each side commits, and both rows show the change.
- The Application log on both machines records no new MSDTC errors during the test.
- Reboot one server and repeat the test, to confirm the settings survived rather than applying to a running service only.
Questions people ask about this
Does fixing this cost anything?
No. MSDTC is a Windows component, already installed and licensed on both machines. Everything here is configuration: service settings, firewall rules and linked server options.
Is No Authentication Required acceptable?
Between two servers on a trusted internal segment it is common and workable; the coordinators simply do not verify each other. Keep it off paths you do not control, and prefer mutual authentication wherever the domain relationship supports it. The documented levels are Mutual, Incoming and NoAuth, and both machines must agree.
Can I avoid MSDTC altogether?
Often. If the remote work need not succeed or fail as one unit with the local work, drop the explicit transaction, turn off remote procedure call promotion, or move to a queue or a staged load. If the updates must be atomic, you need a coordinator.
Why does it work in SSMS on the server but fail from the application?
A third machine has joined in. When a client application starts the transaction itself, that machine’s coordinator becomes the transaction root and needs the same settings and firewall path to both database servers.
I am only calling a stored procedure. Why is a distributed transaction involved?
Because the linked server option that promotes remote procedure calls into distributed transactions is documented as defaulting to true. Turning it off is a correctness decision: with it off, a failure after the remote procedure commits will not roll the remote work back.
