Troubleshooting Guide: Error 11304 – Failed to Record Outcome of Local Two-Phase Commit Transaction
Why This Error Happens
This error occurs when SQL Server 2025 cannot write the outcome of a two-phase commit (2PC) transaction to the database’s transaction log, usually because the log file or data file is inaccessible, corrupted, or has run out of disk space. It can also happen if the MSDTC (Microsoft Distributed Transaction Coordinator) service encountered an I/O failure while resolving the transaction state, or if underlying storage (SAN/NAS/disk) experienced a transient failure during the commit phase. Because SQL Server cannot guarantee transactional consistency when this write fails, it automatically takes the database offline to prevent data corruption.
Step-by-Step Resolution Guide
Step 1: Check Disk Space and Storage Health
- Verify the drive hosting the
.mdfand.ldffiles has sufficient free space (navigate toServer Properties > Database Settingsor check directly via File Explorer). - Run
Get-PSDrivein PowerShell to confirm available space on the volume. - Check Windows Event Viewer under Windows Logs > System for Disk or NTFS warnings (Event ID 7, 9, 11, 51, or 153) indicating underlying hardware or SAN issues.
Step 2: Verify MSDTC Service and Configuration
- Open
Component Services(dcomcnfg.exe) and confirm Distributed Transaction Coordinator is running under Component Services > Computers > My Computer > Distributed Transaction Coordinator. - Ensure “Network DTC Access” is enabled, especially if the 2PC transaction spans linked servers or distributed queries.
- Restart the MSDTC service via PowerShell:
Restart-Service -Name MSDTC -Force.
Step 3: Bring the Database Online and Check Integrity
- Attempt to bring the database back online manually using SQL Server Management Studio (SSMS) or T-SQL:
ALTER DATABASE [YourDB] SET ONLINE; - If it fails, run
DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS;to check for corruption in data or log files. - Review the SQL Server Error Log (
Management > SQL Server Logsin SSMS) for accompanying I/O error messages (e.g., Error 823, 824, or 9001) that may pinpoint the exact file or sector causing the failure.
Step 4: Restore from Backup if Corruption Persists
- If
DBCC CHECKDBreports unrecoverable corruption in the transaction log, perform a restore using the most recent full backup plus transaction log backups:RESTORE DATABASE [YourDB] FROM DISK = 'BackupPath.bak' WITH NORECOVERY;followed byRESTORE LOGstatements as needed. - Ensure backups were taken with
CHECKSUMvalidation enabled to confirm backup file integrity before restoring.
Alternative or Verification Steps
- After bringing the database online, run a test distributed transaction (via linked server or
BEGIN DISTRIBUTED TRANSACTION) to confirm MSDTC and 2PC commit functionality are fully restored. - If the issue recurs intermittently, enable trace flag 3609 and monitor the SQL Server Error Log alongside Windows System Event Logs to capture the exact I/O subsystem failure at the next occurrence.