STATUS_TRANSACTION_ABORTED (0XC000020F) Fix – SQL Server & DTC
SQL Server transaction aborts when DTC or network transport drops the connection mid-commit. Here's how to fix it without rebooting everything.
Quick Answer
If you're seeing STATUS_TRANSACTION_ABORTED (0XC000020F), restart the MSDTC service and check network timeouts. If that doesn't stick, disable transaction logging in DTC or increase the timeout to 300 seconds.
Why This Error Happens
I've seen this error more times than I'd like—usually when a SQL Server query tries to commit a distributed transaction across linked servers. The transport layer (typically TCP/IP or Named Pipes) drops the connection mid-commit, and DTC (Distributed Transaction Coordinator) can't complete the two-phase commit. The result? Transaction gets aborted, and you're staring at that 0XC000020F code.
Most common scenario: a client had a linked server query that fetched data from a remote SQL box, did some processing, and wrote back. Every time the remote server had a hiccup—like a brief network blip or a timeout—the transaction died. Took me three hours to trace it back to the DTC's default 60-second timeout.
Another trigger: when the SQL Server agent runs a job that uses linked servers, and the remote server's firewall or antivirus software kills the connection. Had a client last month whose entire print queue died because of this—their order processing job couldn't finalize transactions over a VPN link.
Fix Steps
- Check DTC service status. Open Services.msc, find Distributed Transaction Coordinator. If it's stopped, start it. Make sure it's set to Automatic startup. If it's already running, restart it—helps clear stuck transactions.
- Enable network DTC access. Run
dcomcnfg, go to Component Services > Computers > My Computer > Distributed Transaction Coordinator > Local DTC. Right-click Properties. Under Security tab, check Network DTC Access, Allow Inbound, Allow Outbound. Also check No Authentication Required if both servers are in the same domain and you trust them. Apply, restart DTC. - Increase DTC timeout. In Registry Editor, go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC. Create a DWORDTransactionTimeout(if missing) and set value to300(in seconds). Restart DTC. This gives the transport more time to complete. - Check Windows Firewall. Ensure inbound rules for MSDTC (TCP port 135 and dynamic RPC ports) are allowed. On both servers, open firewall and allow the 'Distributed Transaction Coordinator' rule. If you're on Windows Server 2016 or later, you might need to allow
%SystemRoot%\system32\msdtc.exeexplicitly. - Test with a simple query. Run
SELECT * FROM [LinkedServer].[Database].[dbo].[Table]. If it works, the transport issue is resolved. If it times out, you've got a network problem or the remote server's DTC isn't configured.
Alternative Fixes When the Main One Fails
- Disable transaction logging in DTC. This is a bit risky—it disables DTC's write-ahead logging. But if you're in a lab or non-critical environment, it can bypass transport aborts. In Registry, go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC, add DWORDTurnOffRpcSecuritywith value1. Then setTransactionLoggingto0. Restart DTC. I only recommend this as a temporary test. - Switch to SQL Server Native Client. If you're using OLEDB providers in linked servers, change to SQL Server Native Client (or ODBC). Go to Linked Server properties, select Provider, and switch to SQL Server Native Client 11.0 (or whatever version matches your SQL Server). I've seen this stabilize flaky connections.
- Increase SQL Server remote query timeout. From SSMS, right-click server, go to Properties > Connections. Set Remote query timeout to
300(seconds). Runsp_configure 'remote query timeout', 300; RECONFIGURE;. - Recreate the linked server. Sometimes the linked server's connection string gets corrupted. Drop and recreate it. Use a dedicated login with a static SPN for SQL Server. I've fixed two cases this way.
Prevention Tips
Once you've got it working, lock it down. Set DTC timeout to 300 seconds permanently. Schedule a weekly restart of the MSDTC service during maintenance windows—prevents stale transactions from piling up. Also monitor network latency between servers; if it's consistently over 50ms, consider using a different transport like TCP/IP with keepalives enabled.
For high-volume environments, avoid distributed transactions if you can. Use service brokers or message queues instead. Had one client who replaced all linked server queries with Service Broker—dropped this error to zero.
Bottom line: 0XC000020F is almost always DTC or network timeout. Fix the timeout, fix the firewall, or kill the transaction logging. You'll be back in business in 10 minutes.
Was this solution helpful?