How to fix Error 3950 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3950 occurs when a long-running transaction holds row versions in the version store (tempdb) for an extended period, causing the version store scan to exceed its internal timeout while trying to locate the next required row version. This is typically triggered by high transactional activity combined with insufficient tempdb throughput, aggressive snapshot isolation usage, or a tempdb that is undersized and heavily fragmented. In Windows Server 2025 / Windows 11 environments, this can be exacerbated by slow disk I/O on the tempdb volume or misconfigured tempdb file counts relative to CPU core allocation.

Step-by-Step Resolution Guide

Step 1: Identify Long-Running Transactions Blocking the Version Store

  • Run the following query to find open transactions consuming version store space:
SELECT * FROM sys.dm_tran_active_snapshot_database_transactions
ORDER BY elapsed_time_seconds DESC;
  • Look for transactions with high elapsed_time_seconds and cross-reference with sys.dm_exec_sessions to identify the offending session or application.
  • Kill or commit any orphaned long-running transactions using KILL <session_id> if safe to do so.

Step 2: Expand and Reconfigure tempdb

  • Navigate to SQL Server Management Studio > Databases > tempdb > Properties > Files.
  • Increase the initial size of tempdb data files (e.g., set to 10GB+ depending on workload) and set autogrowth in fixed MB increments (e.g., 512MB) rather than percentage-based growth.
  • Ensure the number of tempdb data files matches CPU core count (up to 8), each file equal in size:
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev2, SIZE = 5120MB, FILEGROWTH = 512MB);
  • Relocate tempdb files to a dedicated SSD/NVMe volume if currently sharing disk I/O with OS or user databases.

Step 3: Adjust Version Store Timeout Threshold

  • Use trace flag 1255 or configure the version store cleanup interval via sp_configure if your workload requires longer snapshot retention windows:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'version store cleanup interval', 120;
RECONFIGURE;
  • Restart the SQL Server service via services.msc on Windows Server 2025 for configuration changes to take effect.

Step 4: Review Isolation Level Usage in Application Code

  • Audit application connection strings and stored procedures for excessive use of READ COMMITTED SNAPSHOT or SNAPSHOT ISOLATION.
  • Where possible, shorten transaction scope by committing batches more frequently instead of wrapping large bulk operations in a single transaction.

Alternative or Verification Steps

  • Re-run the previously failing query/statement during a lower-traffic window and monitor sys.dm_db_file_space_usage to confirm tempdb version store space is stable and not climbing uncontrollably.
  • If the error persists, consider temporarily disabling snapshot isolation on the affected database (ALTER DATABASE [YourDB] SET ALLOW_SNAPSHOT_ISOLATION OFF;) as a fallback while you address the root cause of long-running transactions.

How to fix Error 3948 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3948 in Always On Availability Groups

Why This Error Happens

Error 3948 occurs when a long-running transaction under snapshot isolation (or RCSI) on a secondary replica requires row versions that have already been removed by the ghost cleanup process on the primary replica. This typically happens because the secondary replica fell behind in redo, the availability replica underwent a role change (failover), or the version store was aggressively cleaned up while a query was still referencing older row versions. Essentially, the data snapshot your query depends on no longer exists because the system determined it was safe to reclaim.

Step-by-Step Resolution Guide

Step 1: Identify the Long-Running Query and Replica Lag

  • Open SQL Server Management Studio (SSMS) and connect to the secondary replica.
  • Run SELECT * FROM sys.dm_exec_requests WHERE transaction_isolation_level = 5; to identify active snapshot isolation transactions.
  • Check SELECT * FROM sys.dm_hadr_database_replica_states; to confirm redo_queue_size and log_send_queue_size values are not excessively high.
  • Review the SQL Server Error Log at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for correlating failover or state-change timestamps.

Step 2: Adjust the Ghost Cleanup and Secondary Replica Settings

  • Increase the readable secondary’s tolerance for data lag by configuring REPLICA ON settings with SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY) and ensure applications aren’t querying stale snapshots indefinitely.
  • If using a readable secondary heavily for reporting, consider setting a controlled delay using ALTER AVAILABILITY GROUP [YourAGName] MODIFY REPLICA ON 'SecondaryReplicaName' WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_LIST=(...))); to manage load distribution.
  • Evaluate disabling automatic failover temporarily during known heavy batch/reporting windows via ALTER AVAILABILITY GROUP [YourAGName] MODIFY REPLICA ON 'ReplicaName' WITH (FAILOVER_MODE = MANUAL);.

Step 3: Reduce Long-Running Transaction Duration

  • Break up large reporting queries or batch jobs into smaller transactions to reduce the window where old row versions are needed.
  • Add OPTION (RECOMPILE) or indexing improvements to speed up query execution time on the secondary.
  • Avoid wrapping read-only reporting queries in unnecessarily long explicit transactions (BEGIN TRAN...COMMIT).

Step 4: Validate Network and Replica Health

  • Open Server Manager > Tools > Windows Admin Center (or Failover Cluster Manager) on Windows Server 2025 to confirm no unexpected failovers or cluster resource flapping is occurring.
  • Check Event Viewer > Applications and Services Logs > MSSQLSERVER for Event ID 3948 correlated with Event ID 1135 (cluster resource state change) or Always On Health events (Event ID 1480).
  • Confirm stable network latency between primary and secondary replicas using ping and Test-NetConnection in PowerShell to rule out connectivity-induced redo delays.

Step 5: Apply Latest Cumulative Update

  • Verify your SQL Server 2025 build number via SELECT @@VERSION;.
  • Download and apply the latest Cumulative Update (CU) from the Microsoft Update Catalog, as ghost cleanup and version store interactions with Always On have received stability fixes in past CUs.
  • Reboot the Windows Server 2025 instance after patching to ensure the SQL Server service fully reinitializes.

Alternative or Verification Steps

  • To verify the fix, rerun the previously failing report/query on the secondary replica during a period of similar transactional load and confirm it completes without Error 3948 in the Application log or SSMS output.
  • If the issue persists, as an alternative, redirect read-only workloads temporarily to the primary replica (if licensing/performance allows) or implement Query Store/Resource Governor to throttle long-running snapshot queries until replica lag stabilizes.

How to fix Error 3949 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3949 occurs when a readable secondary replica in an Always On Availability Group attempts to access a versioned row (used for row versioning under RCSI or Snapshot Isolation) that was never properly created because the operation generating that version was executed directly on the secondary rather than the primary. This typically happens due to replication latency, aggressive version store cleanup, or when long-running read queries on the secondary outlast the retention window of the version store. It can also surface when the secondary’s redo thread is significantly behind the primary, causing version mismatches during row retrieval.

Step-by-Step Resolution Guide

Step 1: Check Availability Group Replication Latency

  • Open SQL Server Management Studio (SSMS) and connect to the primary replica.
  • Run SELECT * FROM sys.dm_hadr_database_replica_states; to check redo_queue_size and log_send_queue_size.
  • If the secondary is significantly behind, investigate network throughput or disk I/O bottlenecks on the secondary node using Windows Performance Monitor (perfmon.exe).

Step 2: Increase Version Store Retention on the Primary

  • Navigate to the primary replica and verify the REQUIRED_SECONDARY_REPLICAS_TO_COMMIT setting is not causing unintended delays.
  • Run the following to check current retention behavior:
  SELECT name, is_read_committed_snapshot_on, snapshot_isolation_state_desc 
  FROM sys.databases WHERE name = 'YourDatabaseName';
  • Consider enabling ALTER DATABASE SCOPED CONFIGURATION SET ACCELERATED_DATABASE_RECOVERY = ON; if not already active, as ADR helps manage version store cleanup more efficiently in SQL Server 2025.

Step 3: Adjust Query Timeout and Retry Logic on Secondary

  • On the secondary replica, identify long-running read queries using:
  SELECT * FROM sys.dm_exec_requests WHERE command = 'SELECT';
  • Reduce query duration by adding appropriate indexing or breaking large read operations into smaller batches.
  • Implement application-side retry logic for Error 3949, since it is often transient and resolves on re-execution once version data synchronizes.

Step 4: Validate Read-Only Routing Configuration

  • Open a PowerShell session as Administrator and verify the Availability Group listener configuration:
  Get-ClusterGroup | Where-Object {$_.GroupType -eq "AvailabilityGroup"}
  • Confirm ALLOW_CONNECTIONS = READ_ONLY is correctly set on the intended secondary replicas in SSMS under Always On High Availability > Availability Group Listeners.
  • Restart the SQL Server service on the secondary node via services.msc if configuration changes were made.

Alternative or Verification Steps

  • To verify the fix, run your original read-only workload against the secondary replica during a period of active writes on the primary and confirm no 3949 errors appear in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • If the issue persists, consider failing over the Availability Group temporarily and rebuilding the secondary replica from a fresh backup to eliminate any underlying version store corruption.

How to fix Error 3947 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3947 – Secondary Compute Failed to Catch Up Redo

Why This Error Happens

This error occurs in SQL Server 2025 configurations utilizing compute replicas (such as Hyperscale or Always On secondary compute nodes) where the redo thread on the secondary falls too far behind the primary’s log generation rate. This lag is typically caused by insufficient I/O throughput, CPU bottlenecks on the secondary compute node, or network latency between the primary and secondary replicas that prevents timely log shipping. When the redo queue exceeds the internal threshold, SQL Server proactively aborts the transaction to prevent unbounded data divergence rather than allowing the secondary to fall further out of sync.

Step-by-Step Resolution Guide

Step 1: Verify Secondary Compute Resource Health

  • Open Performance Monitor (PerfMon) on the secondary node and check the SQL Server:Database Replica > Redo Queue Size and Recovery Queue counters.
  • Confirm CPU and Disk Queue Length are not consistently maxed out using Task Manager or Resource Monitor.
  • Run the following query on the secondary to check redo lag in real time:
  SELECT database_id, redo_queue_size, redo_rate, last_redo_time 
  FROM sys.dm_hadr_database_replica_states;

Step 2: Increase Redo Throughput Capacity

  • Navigate to SQL Server Configuration Manager > SQL Server Services and confirm the secondary instance has parallel redo enabled (default in SQL Server 2025, but verify via trace flag status).
  • If running on constrained hardware, increase vCPU allocation for the secondary compute node in your Windows Server 2025 Hyper-V or Azure VM configuration settings.
  • Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters for any legacy startup parameters limiting worker threads, and remove unnecessary restrictions.

Step 3: Reduce Network Latency Between Replicas

  • Use Test-NetConnection -ComputerName <PrimaryNodeName> -Port 5022 in PowerShell on the secondary to validate the Always On endpoint connectivity and latency.
  • Ensure both primary and secondary nodes reside in the same Availability Zone or low-latency subnet if hosted in a virtualized or cloud environment.
  • Adjust the SESSION_TIMEOUT property on the Availability Group endpoint if network jitter is causing premature session drops:
  ALTER AVAILABILITY GROUP [YourAGName] 
  MODIFY REPLICA ON 'SecondaryNodeName' 
  WITH (SESSION_TIMEOUT = 30);

Step 4: Retry the Transaction and Monitor the Log

  • Manually retry the failed transaction once resource contention has cleared.
  • Check the SQL Server Error Log (located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for recurring 3947 events to confirm the issue is resolved rather than intermittent.

Alternative or Verification Steps

  • Verify the Fix: Re-run the sys.dm_hadr_database_replica_states query from Step 1; the redo_queue_size should trend toward zero and remain stable under load.
  • Alternative Solution: If hardware constraints persist, consider scaling out the secondary compute tier (e.g., upgrading the Hyperscale compute size) or temporarily removing the lagging replica from synchronous commit mode to asynchronous to reduce pressure during peak loads.

How to fix Error 3941 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3941

Why This Error Happens

Error 3941 occurs when a transaction began before replication or Change Data Capture (CDC) was enabled on the database, but then attempts to modify a table that is now tracked by one of those features. SQL Server cannot retroactively associate the already-open transaction with the CDC/replication metadata structures (like the cdc.lsn_time_mapping table or distribution tracking), causing it to reject the write. This is common in applications using long-running or pooled connections that hold open transactions while a DBA enables CDC or replication on the same database in parallel.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Session and Retry the Transaction

  • Check the application logs or SSMS Activity Monitor for the specific session ID (SPID) that threw Error 3941.
  • Simply re-running the failed transaction from a new connection/session often resolves it immediately, since the new session will correctly recognize the CDC/replication metadata.
  • Run KILL <SPID> only if the session is stuck and not self-terminating, to force the app’s connection pool to reset.

Step 2: Audit Application Connection Pooling and Long-Running Transactions

  • Review application code (ORM frameworks like Entity Framework, Dapper, or raw ADO.NET) for connections that open a transaction and stay idle for extended periods.
  • In SSMS, run the following to find long-running open transactions:
SELECT session_id, transaction_id, transaction_begin_time 
FROM sys.dm_tran_active_transactions 
WHERE transaction_begin_time < DATEADD(MINUTE, -5, GETDATE());
  • Shorten transaction scope in code so transactions commit/rollback quickly rather than spanning across DBA maintenance windows.

Step 3: Coordinate CDC/Replication Enablement with a Maintenance Window

  • Before running EXEC sys.sp_cdc_enable_db or configuring replication publications, ensure no active long-running transactions exist on the target database.
  • Use sp_who2 or sys.dm_exec_requests to confirm the database is in a quiet state.
  • Schedule CDC/replication setup during a low-traffic maintenance window on Windows Server 2025 using SQL Server Agent to avoid overlapping with live application transactions.

Step 4: Restart the SQL Server Service (If Issue Persists System-Wide)

  • If multiple sessions across the application pool continue to throw Error 3941 even after retries, the internal transaction sequence number (XSN) tracking may be stuck.
  • Restart the SQL Server service via services.msc or PowerShell:
Restart-Service -Name 'MSSQLSERVER' -Force
  • This clears all in-memory transaction states and forces every new connection to pick up the current CDC/replication configuration cleanly.

Alternative or Verification Steps

  • Verify the fix: Open a brand-new connection (not reused from pool) and run a test UPDATE or INSERT against the previously failing table — it should complete without Error 3941.
  • Alternative: If the error persists only for specific stored procedures, check if sp_cdc_enable_table was run very recently; wait 1–2 minutes for metadata propagation before retrying, as SQL Server 2025 batches CDC capture job initialization asynchronously.

How to fix Error 3940 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3940 – Failed to Acquire Necessary Locks During Commit

Why This Error Happens

Error 3940 occurs when a distributed or multi-file transaction (often involving filegroups, memory-optimized tables, or cross-database operations) cannot obtain the locks it needs during the commit phase, typically due to lock escalation conflicts, insufficient lock pages in memory allocation, or contention from a long-running blocking session. This can also surface when the transaction log or tempdb is under heavy I/O pressure, causing the Lock Manager to time out before the commit can finalize. In some cases, corrupted transaction log VLFs (Virtual Log Files) or an improperly configured MAXDOP/lock threshold setting on SQL Server 2025 exacerbates the issue under concurrent workloads.

Step-by-Step Resolution Guide

Step 1: Identify the Blocking Session and Lock Contention

  • Open SQL Server Management Studio (SSMS) and run sp_who2 or query sys.dm_tran_locks to identify sessions holding conflicting locks.
  • Check for long-running transactions using:
  SELECT * FROM sys.dm_exec_requests WHERE blocking_session_id <> 0;
  • Kill the blocking session if it is safe to do so using KILL <session_id>.

Step 2: Increase Lock Resources and Adjust Memory Configuration

  • Navigate to SQL Server Configuration Manager on Windows Server 2025 / Windows 11 and verify the service account has the Lock Pages in Memory policy enabled via secpol.msc under Local Policies > User Rights Assignment.
  • Restart the SQL Server service for the policy to take effect:
  Restart-Service -Name 'MSSQLSERVER'
  • If using named instances, restart via Restart-Service -Name 'MSSQL$<InstanceName>'.

Step 3: Check and Repair the Transaction Log

  • Run DBCC OPENTRAN to check for old open transactions holding locks during commit.
  • Verify VLF health and log file fragmentation using:
  DBCC LOGINFO;
  • If fragmentation is excessive, shrink and regrow the log file in controlled increments via DBCC SHRINKFILE followed by ALTER DATABASE ... MODIFY FILE.

Step 4: Review Lock Escalation and Isolation Level Settings

  • Check the database’s current isolation level and consider switching to READ_COMMITTED_SNAPSHOT to reduce lock contention:
  ALTER DATABASE [YourDB] SET READ_COMMITTED_SNAPSHOT ON;
  • Adjust lock escalation thresholds at the table level if a specific table is frequently involved:
  ALTER TABLE YourTable SET (LOCK_ESCALATION = AUTO);

Step 5: Apply the Latest Cumulative Update

  • Confirm you are running the latest Cumulative Update (CU) for SQL Server 2025, as lock manager fixes are frequently included in servicing releases.
  • Download and install the update from the Microsoft Update Catalog, then verify the build number using:
  SELECT @@VERSION;

Alternative or Verification Steps

  • Re-run the previously failing transaction during an off-peak window and monitor sys.dm_tran_locks in real time to confirm no lock waits exceed the configured timeout threshold.
  • If the error persists, enable Trace Flag 1222 (deadlock verbose logging) via DBCC TRACEON (1222, -1) to capture detailed lock/deadlock graphs in the SQL Server error log for deeper root-cause analysis.

How to fix Error 3939 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3939 — Uncommittable Transaction Due to FILESTREAM Request Failure

Why This Error Happens

Error 3939 occurs when a transaction involving a FILESTREAM operation encounters an I/O failure, permission issue, or filesystem-level conflict that SQL Server cannot resolve mid-transaction, forcing an automatic rollback. The most common root causes are NTFS permission mismatches between the SQL Server service account and the FILESTREAM data container, antivirus or backup software locking files in the FILESTREAM filegroup, or corruption/inconsistency in the FILESTREAM container directory structure. In Windows Server 2025 environments, this is frequently exacerbated by stricter default ACL inheritance settings and enhanced Windows Defender real-time scanning on data volumes.

Step-by-Step Resolution Guide

Step 1: Verify FILESTREAM is Properly Enabled at Both OS and Instance Level

  • Open SQL Server Configuration Manager → right-click your instance → Properties → FILESTREAM tab → confirm “Enable FILESTREAM for Transact-SQL access” and “Enable FILESTREAM for file I/O streaming access” are checked.
  • Run the following T-SQL to confirm instance-level configuration matches:
  EXEC sp_configure 'filestream access level';
  RECONFIGURE;
  • Ensure the value is set to 2 (full access), not 0 or 1.

Step 2: Audit NTFS Permissions on the FILESTREAM Data Container

  • Navigate to the physical path of your FILESTREAM filegroup (e.g., D:\SQLData\FileStreamContainer).
  • Right-click the folder → Properties → Security tab → confirm the SQL Server service account (e.g., NT Service\MSSQLSERVER) has Full Control.
  • Also verify the account has Modify and Write rights at the parent directory level, since inherited permissions in Windows Server 2025 can silently restrict child folder access.
  • Reset permissions if needed using an elevated PowerShell session:
  icacls "D:\SQLData\FileStreamContainer" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" /T

Step 3: Exclude FILESTREAM Directories from Antivirus and Backup Scanning

  • Open Windows Security → Virus & threat protection → Manage settings → Add or remove exclusions.
  • Add the full FILESTREAM container path and the mssqlsystemresource.mdf directory to exclusions.
  • If using third-party backup agents (e.g., Veeam, Commvault), confirm they are not holding file locks on FILESTREAM BLOBs during active transactions.

Step 4: Check for FILESTREAM Filegroup Corruption

  • Run a consistency check against the affected database:
  DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • If corruption is reported specifically in FILESTREAM pointers or the filestream.hdr file, restore the affected filegroup from a known-good backup rather than attempting an in-place repair.

Step 5: Review SQL Server Error Log for the Underlying I/O Exception

  • Open SQL Server Management Studio (SSMS) → Management → SQL Server Logs.
  • Look for accompanying errors such as 5120 (file access denied) or 823/824 (I/O errors) immediately preceding Error 3939 — these pinpoint the exact file-level failure triggering the rollback.

Alternative or Verification Steps

  • To verify the fix, re-run the original transaction or stored procedure that referenced FILESTREAM data and confirm no rollback occurs; check sys.dm_tran_active_transactions to ensure no orphaned transactions remain.
  • If the issue persists after permission and antivirus fixes, as a fallback, migrate the affected FILESTREAM filegroup to a new volume using ALTER DATABASE ... ADD FILE with a fresh container path, then transfer BLOB data via INSERT INTO ... SELECT to bypass the corrupted container entirely.

How to fix Error 3937 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3937 occurs when SQL Server attempts to roll back a transaction but encounters a corrupted or inconsistent log record (LSN) that it cannot process. This typically stems from physical corruption in the transaction log file, often caused by faulty storage hardware, an unexpected power loss, or an abrupt shutdown of the SQL Server service. Because the rollback operation cannot complete safely, SQL Server marks the database as suspect to prevent further data integrity issues.

Step-by-Step Resolution Guide

Step 1: Check the Windows Event Log for Underlying I/O Errors

  • Open Event Viewer (eventvwr.msc) on Windows Server 2025 / Windows 11.
  • Navigate to Windows Logs > System and Application logs.
  • Look for disk-related errors (Event ID 7, 9, 15, 51) that occurred around the same timestamp as Error 3937 — these confirm hardware/storage-level corruption.

Step 2: Attempt Database Recovery via Restart

  • Restart the SQL Server service to allow automatic recovery to retry rollback:
  net stop MSSQLSERVER
  net start MSSQLSERVER
  • Check ERRORLOG located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG to confirm if recovery completed or failed again.

Step 3: Run DBCC CHECKDB to Assess Corruption

  • Connect via SSMS or sqlcmd and run:
  DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for allocation or consistency errors tied to the log or data pages.

Step 4: Restore From a Known Good Backup

  • If corruption is confirmed, the safest fix is restoring from your last clean full backup plus transaction log backups:
  RESTORE DATABASE YourDatabaseName 
  FROM DISK = 'D:\Backups\YourDatabaseName_Full.bak' 
  WITH NORECOVERY;

  RESTORE LOG YourDatabaseName 
  FROM DISK = 'D:\Backups\YourDatabaseName_Log.trn' 
  WITH RECOVERY;

Step 5: Emergency Repair (Only If No Backup Exists)

  • As a last resort, set the database to EMERGENCY mode and attempt repair:
  ALTER DATABASE YourDatabaseName SET EMERGENCY;
  DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
  ALTER DATABASE YourDatabaseName SET MULTI_USER;
  • Note this may result in data loss and should only be used when restoration is not possible.

Alternative or Verification Steps

  • Run DBCC CHECKDB again post-fix to confirm zero allocation/consistency errors are returned.
  • If the error recurs intermittently, run hardware diagnostics (chkdsk /f /r on the volume) to rule out ongoing disk-level corruption affecting the log file.

How to fix Error 3938 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3938 (FILESTREAM Transaction Conflict)

Why This Error Happens

Error 3938 occurs when a transaction attempts to access or modify a FILESTREAM data stream while that same transaction is concurrently executing a close operation on the file handle. This typically happens because an application closed a FILESTREAM handle using TxFSetTransactionStatus or let the handle fall out of scope before the parent transaction was explicitly committed or rolled back. SQL Server detects this race condition between the Win32 file handle closure and the transactional context, forcing a rollback to preserve data consistency between the structured data and the unstructured FILESTREAM data.

Step-by-Step Resolution Guide

Step 1: Audit Application Code for Handle Management

  • Review the client application (C#, C++, or PowerShell scripts) handling FILESTREAM data retrieval.
  • Ensure every SqlFileStream object (.NET) is wrapped in a using statement to guarantee disposal occurs before the SqlTransaction.Commit() method is called.
  • Verify that no asynchronous threads are holding the file handle open while the main thread attempts to commit the transaction.

Step 2: Verify Transaction Isolation Levels

  • Open SQL Server Management Studio (SSMS) 21 and connect to the Windows Server 2025 instance.
  • Check if the session is running under READ_COMMITTED_SNAPSHOT or SNAPSHOT isolation, as high concurrency under these levels can increase the likelihood of handle conflicts.
  • Run the following query to check current settings:
 SELECT name, snapshot_isolation_state_desc, is_read_committed_snapshot_on FROM sys.databases WHERE name = 'YourDBName';

Step 3: Reset the FILESTREAM Filegroup Configuration

  • Navigate to the SQL Server Configuration Manager on Windows Server 2025.
  • Right-click the SQL Server service instance and select Properties, then navigate to the FILESTREAM tab.
  • Toggle off “Enable FILESTREAM for Transact-SQL access,” apply the change, and re-enable it to clear any stuck I/O handles in the Windows Kernel Transaction Manager (KTM).
  • Restart the SQL Server (MSSQLSERVER) service via services.msc to apply the KTM reset.

Step 4: Check Antivirus and Windows Defender Exclusions

  • Navigate to Windows Security > Virus & threat protection > Manage settings > Exclusions.
  • Add an exclusion for the specific FILESTREAM data container path (e.g., D:\SQLData\FileStreamContainer).
  • This prevents real-time scanning engines from locking the file handle externally while SQL Server attempts to close it within the transaction scope.

Alternative or Verification Steps

  • Verification: Re-run the specific stored procedure or application workflow that triggered the error while monitoring Extended Events (XEvents) for the filestream_transaction_log event to confirm the handle closes cleanly without triggering the 3938 rollback.
  • Alternative: If the error persists in high-throughput environments, consider migrating the logic to use FileTable instead of raw FILESTREAM columns, as FileTable manages the Win32 handle lifecycle automatically, reducing manual transaction-scope errors.

How to fix Error 3936 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3936 — FILESTREAM Data Flush Failure in SQL Server 2025

Why This Error Happens

Error 3936 occurs when SQL Server’s FILESTREAM filegroup is unable to flush buffered data to disk at the moment a transaction attempts to commit. This typically happens because a file handle to the FILESTREAM BLOB was still open by an external process or application thread, blocking the atomic commit operation. It can also stem from underlying disk I/O failures, insufficient NTFS permissions on the FILESTREAM data container, or antivirus/backup software locking files within the FILESTREAM directory.

Step-by-Step Resolution Guide

Step 1: Verify FILESTREAM File Handles Are Properly Closed

  • Ensure your application code uses SqlFileStream objects within a using block or explicitly calls .Close()/.Dispose() before the transaction commits.
  • Check for long-running System.IO.FileStream references pointing to the FILESTREAM data path (e.g., C:\SQLData\FileStreamStore\) that haven’t been released.
  • Review application logs for any exception swallowing that might prevent stream disposal in a finally block.

Step 2: Check Disk I/O Health and Storage Subsystem

  • Open Event Viewer on Windows Server 2025 and navigate to Windows Logs > System to look for Disk or NTFS warnings (Event ID 7, 11, or 51) around the same timestamp as the SQL error.
  • Run chkdsk C: /f /r (replace C: with the actual volume hosting the FILESTREAM filegroup) during a maintenance window to repair file system errors.
  • If using SAN/NAS storage, validate latency and connectivity using Get-PhysicalDisk | Get-StorageReliabilityCounter in PowerShell.

Step 3: Exclude FILESTREAM Directories from Antivirus and Backup Locks

  • Add an exclusion rule in Windows Defender or your third-party AV software for the FILESTREAM root path (e.g., C:\SQLData\FileStreamStore\*).
  • Disable real-time scanning on the .hdr and data container files used internally by FILESTREAM.
  • Confirm no third-party backup agent is holding an open handle on the filegroup folder during the SQL transaction window.

Step 4: Validate NTFS and Service Account Permissions

  • Right-click the FILESTREAM data folder, go to Properties > Security, and confirm the SQL Server service account has Full Control.
  • Run icacls "C:\SQLData\FileStreamStore" in an elevated Command Prompt to audit current permission entries.
  • Re-apply permissions if needed: icacls "C:\SQLData\FileStreamStore" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F".

Step 5: Restart SQL Server and Clear Orphaned Locks

  • Restart the SQL Server service via services.msc or run net stop MSSQLSERVER && net start MSSQLSERVER in an elevated prompt.
  • This clears any orphaned file handles held in memory by the Database Engine’s FILESTREAM provider.

Alternative or Verification Steps

  • Re-run the original transaction that triggered Error 3936 and monitor sys.dm_tran_locks for any FILESTREAM-related lock escalation during the commit.
  • If the error persists, run DBCC CHECKFILEGROUP on the affected FILESTREAM filegroup to rule out corruption, and consider failing over to a standby replica if available to isolate whether the issue is storage-specific.

How to fix Error 3935 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3935 – FILESTREAM Transaction Context Initialization Failure

Why This Error Happens

Error 3935 occurs when the SQL Server Database Engine cannot allocate a transaction context for a FILESTREAM operation, typically due to insufficient system resources such as memory, file handles, or NTFS filesystem contention on the FILESTREAM data container. This can also happen if the underlying volume hosting the FILESTREAM filegroup is low on disk space, experiencing I/O bottlenecks, or if the RPC/FSCTL communication between the SQL Server process and the Windows Filter Driver (RsFx driver) is being blocked or throttled. In some cases, antivirus or backup software locking files in the FILESTREAM container can also trigger this resource contention error.

Step-by-Step Resolution Guide

Step 1: Verify System Resource Availability

  • Open Task Manager or Performance Monitor on Windows Server 2025 / Windows 11 and check available Memory, Handle Count, and Disk Queue Length for the sqlservr.exe process.
  • Confirm the volume hosting the FILESTREAM filegroup (e.g., D:\SQLData\FileStreamContainer) has sufficient free space (at least 15-20% free is recommended).
  • Check Event Viewer under Windows Logs > System for disk or NTFS-related warnings coinciding with the error timestamp.

Step 2: Confirm RsFx Driver and FILESTREAM Configuration

  • Open SQL Server Configuration Manager and navigate to SQL Server Services.
  • Right-click your instance (e.g., MSSQLSERVER) and select Properties, then go to the FILESTREAM tab to confirm “Enable FILESTREAM for Transact-SQL access” and “Enable FILESTREAM for file I/O streaming access” are checked.
  • Run the following T-SQL to confirm the instance-level setting matches:
EXEC sp_configure 'filestream access level';
RECONFIGURE;
  • Ensure the value is set to 2 (full access) if remote client access is required.

Step 3: Exclude Antivirus and Backup Interference

  • Add an exclusion in Windows Defender (or third-party antivirus) for the FILESTREAM data container directory.
  • Use PowerShell to add the exclusion:
Add-MpPreference -ExclusionPath "D:\SQLData\FileStreamContainer"
  • Disable any third-party backup agents that may be actively scanning or locking files in the FILESTREAM folder during database activity.

Step 4: Increase Resource Limits and Restart Services

  • Check the “Max Worker Threads” and “Min Server Memory / Max Server Memory” settings in SQL Server to ensure the engine is not resource-starved:
EXEC sp_configure 'max worker threads';
EXEC sp_configure 'max server memory';
  • Restart the SQL Server service and the SQL Server FILESTREAM driver (RsFx) via Services.msc (SQL Server (MSSQLSERVER) and ensure dependent services restart cleanly).
  • If running in a virtualized environment, confirm the VM has not hit a memory ballooning or CPU ready-time constraint on the hypervisor.

Step 5: Rebuild or Check FILESTREAM Filegroup Integrity

  • Run DBCC CHECKDB with the DATA_PURITY option on the affected database to rule out corruption in the FILESTREAM filegroup:
DBCC CHECKDB ('YourDatabaseName') WITH DATA_PURITY;
  • If corruption is detected, restore from the last known good backup or rebuild the FILESTREAM filegroup container.

Alternative or Verification Steps

  • After applying the fixes, retry the original FILESTREAM transaction (e.g., an INSERT/UPDATE involving a FILESTREAM column) and confirm Error 3935 no longer appears in SQL Server Error Logs or Event Viewer.
  • As an alternative, if the issue persists under high concurrency, consider migrating large object storage to FileTable with a dedicated high-IOPS volume, or increase the TXCTX timeout via trace flag 1807 (test in a non-production environment first).

How to fix Error 3934 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3934 — FILESTREAM Transaction Context Invalid

Why This Error Happens

This error occurs when a FILESTREAM operation attempts to use a transaction context that has already been committed, rolled back, or was never properly obtained from the current session. It commonly happens when application code opens a FILESTREAM handle using SqlFileStream but executes the file I/O operation outside the scope of the original transaction, or when the transaction isolation level changes mid-operation. Additionally, this can surface when multiple threads share the same SqlConnection/transaction object and one thread commits or rolls back before another finishes its FILESTREAM read/write.

Step-by-Step Resolution Guide

Step 1: Verify Transaction Scope in Application Code

  • Ensure the GET_FILESTREAM_TRANSACTION_CONTEXT() call happens inside an active, uncommitted transaction (BEGIN TRANSACTION must precede it).
  • Confirm the FILESTREAM file handle (via SqlFileStream in .NET or Win32 CreateFile) is opened and closed before the transaction is committed or rolled back.
  • Check that no TransactionScope or SqlTransaction.Commit() call executes prematurely while a file stream is still open.

Step 2: Check Isolation Level and Connection Settings

  • Confirm the connection is using an isolation level compatible with FILESTREAM operations — avoid SNAPSHOT isolation for FILESTREAM writes unless explicitly required.
  • Run the following to check current session settings:
  DBCC USEROPTIONS;
  • Ensure SET IMPLICIT_TRANSACTIONS OFF is configured unless your application explicitly manages implicit transactions.

Step 3: Validate FILESTREAM Configuration on the Server

  • Open SQL Server Configuration Manager on Windows Server 2025/Windows 11, navigate to SQL Server Services, right-click your instance, and confirm FILESTREAM access level is set to “Enabled for Transact-SQL and I/O streaming access.”
  • Verify at the instance level with:
  EXEC sp_configure 'filestream access level';
  • If the value is 0, run:
  EXEC sp_configure 'filestream access level', 2;
  RECONFIGURE;
  • Restart the SQL Server service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER.

Step 4: Rebuild the Connection and Retry Logic

  • Dispose of and recreate the SqlConnection/SqlTransaction objects for each FILESTREAM operation rather than reusing stale references.
  • Wrap FILESTREAM read/write logic in a using block to guarantee proper disposal order:
  using (SqlFileStream sfs = new SqlFileStream(path, context, FileAccess.ReadWrite))
  {
      // perform I/O here, then commit transaction after disposal
  }
  • Avoid passing the transaction context across different application threads or async continuations without proper synchronization.

Alternative or Verification Steps

  • To verify the fix, run a test insert/update on a FILESTREAM-enabled table and confirm the file commits to the filesystem path without throwing Error 3934.
  • If the issue persists, check for orphaned transactions using DBCC OPENTRAN and ensure no long-running or zombie transactions are holding the FILESTREAM context open.

How to fix Error 3932 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3932 – Save Point Name Too Long

Why This Error Happens

This error occurs when a transaction save point name defined via SAVE TRANSACTION or SAVE TRAN exceeds the maximum character limit enforced by SQL Server (typically 32 characters). It is commonly triggered by dynamically generated save point names—often created by ORMs (like Entity Framework), middleware frameworks, or custom scripts—that concatenate GUIDs, timestamps, or long identifiers into the name string. This is not a corruption or permissions issue; it is strictly a syntax/validation constraint within the T-SQL transaction engine.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Transaction Code

  • Capture the exact T-SQL statement throwing error 3932 using SQL Server Profiler or Extended Events (sqlserver.error_reported filtered on error 3932).
  • Check application logs, stored procedures, or ORM-generated SQL (common in Entity Framework, Dapper, or NHibernate) for dynamic save point naming.
  • Confirm the save point name length by running:
  SELECT LEN('YourSavePointNameHere');

Step 2: Shorten the Save Point Name

  • Manually edit the SAVE TRANSACTION statement to use a name under the limit:
  SAVE TRANSACTION SP_Short01; -- Instead of SAVE TRANSACTION SP_VeryLongDynamicGUIDBasedName12345;
  • If the name is auto-generated by application code (e.g., C# TransactionScope or EF Core SaveChanges), modify the naming logic to truncate or hash the identifier (e.g., using SUBSTRING or a shorter GUID segment).
  • For ORM-specific fixes, update the save point naming convention in the DbContext or connection interceptor to enforce a max length of 32 characters.

Step 3: Update Stored Procedures or Scripts

  • Search all stored procedures for hard-coded or variable-based save point names:
  SELECT OBJECT_NAME(object_id), definition 
  FROM sys.sql_modules 
  WHERE definition LIKE '%SAVE TRANSACTION%';
  • Replace any variable-driven save point names with static, pre-validated short strings or add a truncation step:
  DECLARE @SPName NVARCHAR(32) = LEFT(@DynamicName, 32);
  EXEC('SAVE TRANSACTION ' + @SPName);

Step 4: Deploy and Test in a Non-Production Environment

  • Apply the corrected code to a staging instance of SQL Server 2025 on Windows Server 2025/Windows 11.
  • Re-run the transaction workflow that previously failed to confirm the error no longer appears.
  • Monitor the SQL Server Error Log (Management > SQL Server Logs in SSMS) for recurrence of Error 3932.

Alternative or Verification Steps

  • Run the corrected transaction in SQL Server Management Studio (SSMS) manually and confirm it commits without throwing Error 3932.
  • If the issue persists in third-party or vendor software, check for a patch or update addressing save point name generation, as this is often a known bug in older ORM versions interacting with newer SQL Server builds.

How to fix Error 3933 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3933 — Cannot Promote Transaction Due to Active Save Point

Why This Error Happens

This error occurs because SQL Server’s MS DTC (Distributed Transaction Coordinator) cannot promote a local transaction to a distributed one while a SAVE TRANSACTION save point is still active within that transaction scope. Save points are inherently incompatible with distributed transaction promotion because the transaction manager cannot guarantee rollback consistency across multiple resource managers when a partial rollback point exists. This typically surfaces in applications using System.Transactions.TransactionScope or ORM frameworks (like Entity Framework) that implicitly open save points, then later attempt a cross-database or linked-server call that forces promotion.

Step-by-Step Resolution Guide

Step 1: Identify the Code Path Creating the Save Point

  • Review application code or stored procedures for explicit SAVE TRANSACTION savepoint_name statements.
  • Check ORM configurations (e.g., Entity Framework Core, NHibernate) — some versions auto-create save points when nested TransactionScope blocks are used.
  • Use SQL Server Profiler or Extended Events (sqlserver.save_transaction_completed) to trace where the save point is issued relative to the distributed call.

Step 2: Restructure the Transaction Scope

  • Remove or avoid nested TransactionScope blocks that trigger implicit save points before a linked-server or cross-database query executes.
  • In .NET code, ensure TransactionScopeOption.RequiresNew is used only when necessary, and move any cross-server/distributed calls to occur before any save point is created, not after.
  • If using raw T-SQL, reorder statements so SAVE TRANSACTION is issued only after all distributed operations (e.g., calls to linked servers via OPENQUERY or four-part names) have completed.

Step 3: Force Early Promotion Where Required

  • If the distributed call must happen regardless of save points, explicitly force promotion early using BEGIN DISTRIBUTED TRANSACTION at the start of the batch, before any SAVE TRANSACTION is issued.
  • Validate that MS DTC is properly configured and running on both Windows Server 2025 and the client via Component Services (dcomcnfg.exe → Distributed Transaction Coordinator → Local DTC → Security tab → enable “Network DTC Access” and “Allow Inbound/Outbound”).
  • Restart the MSDTC service after configuration changes:
  • net stop msdtc && net start msdtc

Step 4: Patch and Update SQL Server

  • Confirm SQL Server 2025 is updated to the latest Cumulative Update, as earlier builds had known issues with save point handling in promoted transactions.
  • Check via: SELECT @@VERSION; and compare against Microsoft’s latest CU release notes.

Alternative or Verification Steps

  • Verify the fix by re-running the transaction workflow while capturing an Extended Events session filtered on error_reported for Error 3933 — confirm no occurrences remain.
  • As an alternative, if save points are functionally required, isolate the distributed operation into a separate, independent transaction scope (using TransactionScopeOption.Suppress or a new connection) so it is not affected by the save point in the parent transaction.

How to fix Error 3931 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3931 in Microsoft SQL Server 2025

Why This Error Happens

Error 3931 occurs when SQL Server detects that the transaction log has been marked as corrupted or the session’s transaction state has become inconsistent, typically due to a failed write to disk, unexpected I/O interruption, or storage subsystem failure during a transaction. This can also happen when a database is forcibly taken offline, experiences a power failure, or when the underlying storage (SAN, virtual disk, or local volume) reports inconsistent sector data mid-transaction. Because the transaction log itself is compromised, SQL Server cannot safely roll back to a savepoint and instead forces a full transaction rollback to preserve database integrity.

Step-by-Step Resolution Guide

Step 1: Verify Storage and I/O Health

  • Check Windows Event Viewer under Windows Logs > System for Disk or NTFS warnings (Event ID 7, 11, or 51) around the same timestamp as Error 3931.
  • Run chkdsk C: /f /r (replace with your actual SQL data/log drive letter) during a maintenance window to detect and repair physical disk errors.
  • Confirm your SAN/virtual disk controller firmware and drivers are up to date, especially on Windows Server 2025 Hyper-V or Storage Spaces Direct configurations.

Step 2: Run DBCC CHECKDB to Identify Corruption

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Execute the following against the impacted database:
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for allocation or consistency errors tied to the transaction log or data pages.

Step 3: Repair or Restore the Affected Database

  • If corruption is confirmed, take the database offline and restore from the most recent clean backup:
RESTORE DATABASE [YourDatabaseName] FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE;
  • If no backup is available, attempt a repair as a last resort (data loss risk):
ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE [YourDatabaseName] SET MULTI_USER;

Step 4: Review Application Transaction Handling

  • Inspect application code for nested transactions using SAVE TRANSACTION combined with long-running or high-latency operations.
  • Ensure explicit BEGIN TRAN / COMMIT TRAN / ROLLBACK TRAN blocks include proper TRY...CATCH error handling to avoid orphaned transactions after Error 3931 triggers.

Alternative or Verification Steps

  • After applying fixes, re-run the failing transaction or stored procedure in SSMS and confirm it commits successfully without triggering Error 3931 again.
  • If the issue persists, check SQL Server error logs (EXEC sp_readerrorlog) for recurring I/O or storage-related warnings, and consider engaging your storage vendor’s diagnostic tools to rule out hardware-level failures.

How to fix Error 3930 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3930 occurs when a transaction encounters a critical failure that prevents SQL Server from writing further log records, most commonly due to the transaction log running out of space or becoming corrupted. This can also happen when a doomed transaction state is triggered by an underlying I/O failure, disk subsystem error, or when the transaction log file has reached its maximum configured size with autogrowth disabled. Since the transaction is marked as “doomed,” SQL Server blocks any further writes and forces a rollback to maintain database consistency.

Step-by-Step Resolution Guide

Step 1: Check Transaction Log Space and Disk Capacity

  • Open SQL Server Management Studio (SSMS) and run DBCC SQLPERF(LOGSPACE); to check log usage percentage.
  • Verify the physical drive hosting the .ldf file has sufficient free space (navigate to the drive in Windows File Explorer or run Get-PSDrive in PowerShell).
  • If disk space is low, free up space or move the log file to a drive with more capacity using ALTER DATABASE [YourDB] MODIFY FILE.

Step 2: Review and Adjust Autogrowth Settings

  • In SSMS, right-click the database > Properties > Files, and check the Autogrowth/Maxsize settings for the log file.
  • Ensure autogrowth is enabled and not restricted to an unrealistically small maximum file size.
  • Set growth increments in fixed MB values (e.g., 512MB) rather than percentages to avoid unpredictable growth spikes, especially on large databases.

Step 3: Inspect Windows Event Viewer and SQL Server Error Logs

  • Open Event Viewer (eventvwr.msc) on Windows Server 2025/Windows 11 and check the Application log for related I/O or disk errors (Event IDs 823, 824, or 9001).
  • Cross-reference with the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Look for entries indicating log corruption, disk write failures, or antivirus/backup software locking the log file.

Step 4: Run Database Consistency Checks

  • Execute DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to detect corruption in the database or log file.
  • If corruption is found, restore from the most recent clean backup rather than attempting repair options that may cause data loss.

Step 5: Restart the SQL Server Service (If Safe)

  • Open Services.msc on Windows Server 2025, locate SQL Server (MSSQLSERVER), and restart the service to clear any stuck transaction states.
  • Confirm no active user transactions are mid-process before restarting, as this will roll back all open transactions.

Alternative or Verification Steps

  • After applying fixes, run a test transaction (BEGIN TRAN; UPDATE...; COMMIT;) on the affected database to confirm it commits successfully without triggering Error 3930.
  • If the issue persists, restore the database from a verified backup to a secondary instance and compare log file integrity, as this isolates whether the problem is disk-related or database-corruption-related.

How to fix Error 3929 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3929 – No Distributed or Bound Transaction Allowed in Single User Database

Why This Error Happens

This error occurs when SQL Server 2025 is placed in single-user mode (SINGLE_USER) while a distributed transaction, a bound session, or an application using MS DTC attempts to enroll that connection in a larger transaction scope. Single-user mode restricts the database to one connection at a time for maintenance purposes, which is architecturally incompatible with the multi-session coordination that distributed or bound transactions require. This typically surfaces during restore operations, database repair (DBCC CHECKDB with repair options), or when ORM frameworks (like Entity Framework) wrap connections in TransactionScope without disabling distributed transaction promotion.

Step-by-Step Resolution Guide

Step 1: Identify the Transaction Context Triggering the Error

  • Check the application connection string or code for TransactionScope usage, especially in .NET applications.
  • Run SELECT * FROM sys.dm_tran_active_transactions; in SQL Server Management Studio (SSMS) to see if a distributed transaction is active.
  • Confirm whether MS DTC (Distributed Transaction Coordinator) service is running via services.msc on Windows Server 2025 or Windows 11.

Step 2: Disable Distributed Transaction Enlistment in the Application

  • If using .NET, replace TransactionScope with TransactionScope(TransactionScopeOption.Suppress) for operations hitting the single-user database.
  • For connection strings, ensure Enlist=false; is explicitly set to prevent automatic enlistment:
  Server=myServer;Database=myDB;Enlist=false;
  • If using linked servers, verify sp_configure 'remote proc trans' is not forcing distributed transaction promotion unnecessarily.

Step 3: Take the Database Out of Single-User Mode Before Running Transactional Operations

  • Open a new query window in SSMS and run:
  ALTER DATABASE [YourDatabaseName] SET MULTI_USER;
  • If the database must remain in single-user mode for maintenance (e.g., DBCC CHECKDB repairs), ensure only local, non-distributed transactions are issued against it.
  • Avoid running repair scripts through tools or ORMs that implicitly wrap commands in TransactionScope — use raw ADO.NET or SSMS native queries instead.

Step 4: Restart MS DTC Service to Clear Stale Transaction States

  • Open Command Prompt as Administrator on Windows Server 2025 / Windows 11.
  • Run the following to restart the service cleanly:
  net stop msdtc
  net start msdtc
  • Verify DTC security settings via Component Services > Computer > My Computer > Distributed Transaction Coordinator and ensure “Network DTC Access” is configured correctly if cross-server transactions are involved.

Step 5: Re-run the Operation in Single-User Mode Without Transaction Promotion

  • Reconnect using a dedicated admin connection (DAC): sqlcmd -S myServer -A
  • Execute the required maintenance or repair command directly without wrapping it in any explicit or implicit transaction scope.
  • Once complete, switch the database back: ALTER DATABASE [YourDatabaseName] SET MULTI_USER;

Alternative or Verification Steps

  • Verify the fix: After switching back to MULTI_USER mode, run the original application transaction again and confirm no Error 3929 appears in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • Alternative approach: If the application cannot avoid distributed transactions, perform all single-user maintenance tasks via a separate isolated script (PowerShell or sqlcmd) rather than through the main application pipeline, ensuring no TransactionScope or MSDTC enlistment occurs during the maintenance window.

How to fix Error 3927 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3927 (DTC Enlistment Failure)

Why This Error Happens

This error occurs when a session attempts to enlist an already active local transaction into a Distributed Transaction Coordinator (MSDTC) transaction, which violates the transaction isolation boundary SQL Server enforces. It is commonly triggered by application code that opens a local BEGIN TRANSACTION before calling EnlistTransaction() or using TransactionScope in .NET, causing a conflict between the local and distributed transaction managers. In Windows Server 2025 and Windows 11 environments, this is frequently exacerbated by misconfigured MSDTC security settings or outdated connection pooling behavior in the application driver.

Step-by-Step Resolution Guide

Step 1: Verify Application Transaction Logic

  • Review the application code for instances where a local transaction (SqlTransaction or BEGIN TRAN) is started on a connection before a TransactionScope or distributed transaction is initiated.
  • Ensure the connection object is not reused across different transaction contexts without being properly closed or reset.
  • Refactor code so that distributed transaction enlistment happens immediately upon connection opening, prior to any local transaction commands.

Step 2: Configure MSDTC Security Settings

  • Open the Component Services console by running comexp.msc from the Run dialog (Win + R).
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator > Local DTC.
  • Right-click Local DTC, select Properties, and go to the Security tab.
  • Ensure “Network DTC Access,” “Allow Inbound,” “Allow Outbound,” and “Enable XA Transactions” are checked.
  • Restart the Distributed Transaction Coordinator service via services.msc to apply changes.

Step 3: Check SQL Server Connection Pooling Settings

  • In the application’s connection string, verify that Enlist=false is not incorrectly set if distributed transactions are required, or vice versa if local pooling is causing conflicts.
  • If using ODBC or OLE DB drivers, update them to the latest version compatible with SQL Server 2025, as older drivers often mishandle the enlistment sequence.
  • Clear the connection pool manually using SqlConnection.ClearAllPools() in a test environment to rule out stale pooled connections holding a local transaction state.

Step 4: Validate Firewall and Port Configuration

  • Confirm that the Windows Firewall on Windows Server 2025 allows MSDTC traffic (TCP Port 135 and dynamically assigned RPC ports).
  • Navigate to Windows Defender Firewall > Advanced Settings > Inbound Rules and ensure “Distributed Transaction Coordinator” rules are enabled for Domain, Private, and Public profiles.

Alternative or Verification Steps

  • To verify the fix, run the application workload again and check the SQL Server Error Log or Event Viewer (Windows Logs > Application) to confirm Error 3927 no longer appears during transaction enlistment.
  • If the issue persists despite code and configuration changes, as a temporary workaround, isolate the distributed transaction logic into a separate connection object that has never executed a local BEGIN TRAN command, effectively bypassing the state conflict.

How to fix Error 3928 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3928 — Marked Transaction Failed Due to Log Mark Timeout

Why This Error Happens

Error 3928 occurs when SQL Server cannot commit a marked transaction within the expected timeframe because it is unable to place a mark in the transaction log. This is most commonly caused by lock contention from a long-running or orphaned Microsoft Distributed Transaction Coordinator (MS DTC) transaction, an overloaded or fragmented transaction log file, or network latency between nodes in a distributed transaction scenario. In some cases, insufficient disk I/O throughput on the log drive or a stalled DTC service on Windows Server 2025 can also prevent the log mark from being written in time.

Step-by-Step Resolution Guide

Step 1: Identify Blocking or Orphaned DTC Transactions

  • Run sp_who2 or query sys.dm_tran_active_transactions and sys.dm_tran_database_transactions to locate long-running or uncommitted transactions.
  • Check sys.dm_tran_locks to see if the marked transaction is being blocked by another session.
  • Use the MS DTC console (Component Services > Distributed Transaction Coordinator > Local DTC > Transaction List) to view and, if necessary, manually resolve in-doubt transactions.

Step 2: Restart and Reconfigure the MS DTC Service

  • Open Services.msc on Windows Server 2025 / Windows 11 and restart the Distributed Transaction Coordinator service.
  • Verify DTC network access is enabled: Component Services > My Computer > Properties > MSDTC tab > Security Configuration, ensure “Network DTC Access,” “Allow Inbound,” and “Allow Outbound” are checked.
  • Confirm firewall rules allow DTC traffic (default dynamic RPC port range, or a statically configured port if hardened).

Step 3: Increase Transaction Log Capacity and Performance

  • Check the log file size and autogrowth settings using sys.database_files or SSMS > Database Properties > Files.
  • Ensure the log file is on a dedicated, low-latency disk (SSD/NVMe recommended) separate from data files.
  • Manually grow the log file ahead of time to avoid autogrowth stalls:
  ALTER DATABASE [YourDB] MODIFY FILE (NAME = YourDB_log, SIZE = 5GB);

Step 4: Adjust the Marked Transaction Timeout

  • If the timeout is too aggressive for your workload, increase the wait time using the MARK option timeout in BEGIN TRANSACTION ... WITH MARK calls at the application/script level.
  • Review application code or ETL jobs issuing COMMIT TRAN with marks and add retry logic with exponential backoff.

Step 5: Review SQL Server Error Logs and DTC Logs

  • Open SQL Server Error Log (via SSMS > Management > SQL Server Logs) and cross-reference the timestamp of Error 3928 with any DTC-related warnings.
  • Check Windows Event Viewer > Applications and Services Logs > Microsoft > Windows > MSDTC for correlating errors indicating resource manager timeouts.

Alternative or Verification Steps

  • To verify the fix, re-run the marked transaction during a low-traffic window and confirm it commits without delay by checking sys.dm_tran_database_transactions for a clean commit state.
  • If the issue persists, consider disabling distributed transactions for the specific operation (if business logic allows) by using local transactions only, which bypasses MS DTC coordination entirely.

How to fix Error 3926 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3926

Why This Error Happens

Error 3926 occurs when a transaction is interrupted mid-process because another session forcibly committed or aborted it, typically during database restore, mirroring failover, or Always On Availability Group role transitions. This often happens when RESTORE operations run against a database while active transactions are still open in another session, or when a database snapshot/mirroring operation changes the database state unexpectedly. Corrupted transaction log entries or abrupt termination of a session using KILL can also trigger this inconsistency between the session’s transaction context and the actual database state.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Session

  • Open SQL Server Management Studio (SSMS) and run sp_who2 or query sys.dm_exec_sessions to identify sessions interacting with the same database.
  • Check SQL Server Error Logs located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for timestamps correlating with the error.
  • Look specifically for RESTORE DATABASE, ALTER DATABASE SET PARTNER, or mirroring/AG failover events near the error timestamp.

Step 2: Review and Isolate Long-Running Transactions

  • Run DBCC OPENTRAN('YourDatabaseName') to check for any uncommitted long-running transactions holding locks.
  • If a runaway transaction is found, safely terminate it using KILL <session_id> after confirming it is not critical.
  • Ensure application connection pooling is not reusing a session that was already committed/aborted by implementing proper TRY...CATCH and XACT_ABORT ON in your T-SQL scripts.

Step 3: Validate Always On / Mirroring Configuration

  • Open SQL Server Configuration Manager and verify the endpoint status for Always On Availability Groups under SQL Server Network Configuration.
  • In SSMS, navigate to Management > Always On High Availability and check the Dashboard for synchronization health.
  • If using Database Mirroring (legacy), confirm the witness server is reachable and not causing automatic failover mid-transaction.

Step 4: Rebuild the Transaction Log (If Corruption is Suspected)

  • Take a full backup of the database before proceeding: BACKUP DATABASE [YourDB] TO DISK = 'D:\Backups\YourDB.bak'.
  • Run DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS to scan for log corruption.
  • If errors are found, use ALTER DATABASE [YourDB] SET EMERGENCY followed by DBCC CHECKDB repair options only as a last resort, since this can result in data loss.

Alternative or Verification Steps

  • Verify the fix by re-running the original failing transaction/query in a new session and confirming it completes with a COMMIT without triggering Error 3926.
  • If the issue persists, check Windows Event Viewer (Windows Logs > Application) on Windows Server 2025 for correlating MSSQLSERVER service restarts, which may indicate a deeper hardware or storage-level timeout causing the forced abort.

How to fix Error 3925 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3925 – Invalid Transaction Mark Name

Why This Error Happens

This error occurs when a user or application attempts to execute a BEGIN TRANSACTION or COMMIT TRANSACTION statement using a WITH MARK clause where the mark name explicitly begins with the reserved prefix LSN:. SQL Server reserves this specific prefix internally to identify Log Sequence Number references during restore operations, so the engine blocks any user-defined transaction mark that uses it to prevent ambiguity in the transaction log. This is typically caused by a scripting error, a poorly configured ETL job, or a migration script that was copied from a system restore procedure without modification.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Script or Query

  • Check the SQL Server Error Log via SSMS (Object Explorer > Management > SQL Server Logs) or the Windows Event Viewer on Windows Server 2025 to find the exact timestamp of the failure.
  • Correlate the timestamp with recent job executions in the SQL Server Agent job history to pinpoint the specific stored procedure or script causing the conflict.

Step 2: Edit the Transaction Mark Syntax

  • Open the identified script in SQL Server Management Studio (SSMS) or Azure Data Studio.
  • Locate the BEGIN TRAN [transaction_name] WITH MARK 'description' syntax.
  • Rename any mark description starting with LSN: to a neutral identifier, such as Mark_Process_Start or PreUpdate_Backup.
  • Ensure the corrected syntax looks like this: BEGIN TRANSACTION MyTransaction WITH MARK 'Mark_Process_Start';

Step 3: Update Application Connection Strings and ORM Mappings

  • If the error originates from an application (e.g., .NET or Java app) rather than a raw T-SQL script, search the application’s source code or configuration files for hardcoded transaction names.
  • Update the application logic to use a dynamic naming convention (e.g., appending a GUID) that avoids reserved keywords entirely.
  • Redeploy the application or restart the specific Windows Service associated with the application pool to apply the code changes.

Step 4: Restart SQL Server Service (If Required)

  • If the error persists due to a cached execution plan, open Services.msc on the Windows Server 2025 host.
  • Locate SQL Server (MSSQLSERVER) or the specific named instance.
  • Right-click and select Restart to clear the plan cache and ad-hoc query cache.

Alternative or Verification Steps

  • Verification: Re-run the specific transaction or SQL Agent job manually in SSMS. If the transaction commits successfully without throwing Error 3925, the fix has been applied correctly.
  • Alternative: If modifying the source script is not immediately possible, use SQL Server Extended Events to trace the error_reported event filtered by Error Number 3925 to automatically log which specific login or application is violating the naming convention for future auditing.

How to fix Error 3924 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3924

Why This Error Happens

Error 3924 occurs when a session attempts to bind to a new transaction while it is still enlisted in an active user transaction, causing a transaction context conflict. This typically happens due to improperly managed BEGIN DISTRIBUTED TRANSACTION calls, mismatched sp_bindsession usage, or application connection pooling that reuses a connection before the prior transaction was fully committed or rolled back. Corrupted connection state within MSDTC (Microsoft Distributed Transaction Coordinator) on Windows Server 2025 can also trigger this defection error.

Step-by-Step Resolution Guide

Step 1: Audit Transaction Handling in Application Code

  • Check for explicit BEGIN TRAN statements that are not matched with a corresponding COMMIT TRAN or ROLLBACK TRAN.
  • Search application logs for nested transactions that may be binding the same session ID (SPID) to two different transaction contexts.
  • Use DBCC OPENTRAN in SQL Server Management Studio (SSMS) to identify the oldest active transaction currently blocking the session.

Step 2: Restart and Reconfigure MSDTC Service

  • Open Component Services on Windows Server 2025 by running dcomcnfg in the Run dialog.
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator > Local DTC.
  • Right-click Local DTC, select Stop, then Start to clear any hung transaction bindings.
  • Verify that Network DTC Access is enabled under the Security tab if the issue involves linked servers or distributed queries.

Step 3: Reset Connection Pooling Settings

  • In your connection string (ODBC, ADO.NET, or JDBC), verify that Enlist=false is set if distributed transactions are not explicitly required.
  • Navigate to C:\Windows\System32\drivers\etc to confirm no DNS conflicts are causing session re-binding across different physical SQL nodes.
  • For .NET applications, ensure TransactionScope objects are disposed of correctly using a using block to prevent lingering enlistments.

Step 4: Update SQL Server 2025 Cumulative Updates

  • Open SQL Server Configuration Manager and verify the current build number.
  • Navigate to the Microsoft Download Center and apply the latest Cumulative Update (CU) for SQL Server 2025, as early builds have known session-binding bugs in the Tabular Data Stream (TDS) protocol.
  • Restart the SQL Server (MSSQLSERVER) service via services.msc after the update installs.

Alternative or Verification Steps

  • To verify the fix, run a test transaction via SSMS using sp_who2 to confirm the SPID closes cleanly without lingering in a “sleeping” state with an open transaction.
  • If the error persists, use SQL Server Profiler to trace Existing Connection events and identify exactly which application thread is attempting to hijack the session before the first transaction resolves.

How to fix Error 3923 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3923 — Transaction Marks Cannot Be Used with Unbacked Bulk-Logged Operations

Why This Error Happens

This error occurs when a named transaction mark (via WITH MARK) is used inside a transaction that also performs minimally logged (bulk-logged) operations, such as BULK INSERT, SELECT INTO, or index rebuilds, while the database is in BULK_LOGGED recovery model. SQL Server cannot guarantee point-in-time recoverability for marked transactions when bulk-logged extents exist in the transaction log that haven’t yet been captured by a log backup. As a safety mechanism, SQL Server ignores the mark rather than risk an unrecoverable restore sequence, since marked recovery relies on precise log sequence number (LSN) tracking that bulk-logged operations disrupt.

Step-by-Step Resolution Guide

Step 1: Identify the Database Recovery Model

  • Open SQL Server Management Studio (SSMS) and connect to your Microsoft SQL Server 2025 instance.
  • Run the following query to confirm the current recovery model:
  • SELECT name, recovery_model_desc FROM sys.databases WHERE name = 'YourDatabaseName';
  • If the result shows BULK_LOGGED, this confirms the root cause of Error 3923.

Step 2: Take a Transaction Log Backup Before Using Marks

  • Ensure any prior bulk-logged operations are backed up before attempting a marked transaction.
  • Run: BACKUP LOG [YourDatabaseName] TO DISK = 'E:\SQLBackups\YourDatabaseName_Log.trn';
  • This clears the bulk-logged extents from the active log, allowing transaction marks to be honored on subsequent operations.

Step 3: Switch to FULL Recovery Model for Mark-Dependent Workloads

  • If your application relies on WITH MARK for point-in-time restores, switch the database out of BULK_LOGGED mode.
  • Run: ALTER DATABASE [YourDatabaseName] SET RECOVERY FULL;
  • Re-run a full backup afterward to reset the log chain: BACKUP DATABASE [YourDatabaseName] TO DISK = 'E:\SQLBackups\YourDatabaseName_Full.bak';

Step 4: Separate Bulk Operations from Marked Transactions

  • Avoid combining BULK INSERT, SELECT INTO, or CREATE INDEX with BEGIN TRANSACTION ... WITH MARK in the same batch.
  • Schedule bulk-logged maintenance tasks (via SQL Server Agent jobs) outside the window where application-level transaction marks are issued.
  • On Windows Server 2025, verify SQL Server Agent service (SQLSERVERAGENT) is running under Services (services.msc) to confirm scheduled jobs execute as expected.

Step 5: Validate Log Backup Chain Integrity

  • Use RESTORE HEADERONLY against recent .trn files to confirm no gaps exist in the LSN chain.
  • RESTORE HEADERONLY FROM DISK = 'E:\SQLBackups\YourDatabaseName_Log.trn';
  • Confirm FirstLSN and LastLSN values are contiguous across your backup history.

Alternative or Verification Steps

  • After applying fixes, re-run the marked transaction and check the SQL Server Error Log (via EXEC sp_readerrorlog or C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\) to confirm Error 3923 no longer appears.
  • If switching to FULL recovery isn’t feasible for performance reasons, consider using BACKUP LOG immediately after each bulk-logged operation to keep the log chain current and allow marks to succeed on subsequent transactions.

How to fix Error 3921 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3921 in Microsoft SQL Server 2025

Why This Error Happens

Error 3921 occurs when SQL Server attempts to retrieve a transaction token (used for tracking distributed or marked transactions) but no active transaction context exists at that point in execution. This typically happens when a stored procedure, trigger, or application code calls GET TRANSACTION TOKEN or similar transaction-dependent functions outside of an explicit BEGIN TRANSACTION block. It can also surface when autocommit mode silently closes a transaction before a dependent statement executes, often due to an earlier COMMIT, ROLLBACK, or connection-level session setting change.

Step-by-Step Resolution Guide

Step 1: Review the Transaction Scope in Your Code

  • Open the stored procedure, script, or application code that triggered the error.
  • Confirm whether a BEGIN TRANSACTION statement precedes the call to GET TRANSACTION TOKEN or any marked transaction logic.
  • Check for premature COMMIT TRANSACTION or ROLLBACK TRANSACTION statements that may close the transaction too early.

Step 2: Explicitly Start a Transaction Before the Statement

  • Insert BEGIN TRANSACTION [TransactionName] WITH MARK 'description'; immediately before the failing statement.
  • Ensure the transaction name matches what downstream replication or log-reader processes expect (common with transactional replication or Change Data Capture setups).
  • Example:
  BEGIN TRANSACTION MyMarkedTran WITH MARK 'Insert Batch Job';
  GET TRANSACTION TOKEN = @TranToken;

Step 3: Verify Connection and Session Settings

  • Check if IMPLICIT_TRANSACTIONS is set to OFF on the session, which can cause statements to auto-commit unexpectedly.
  • Run the following to inspect current session settings:
  DBCC USEROPTIONS;
  • In Windows Server 2025 / Windows 11 environments, confirm the application’s connection string (ODBC, OLE DB, or SqlClient) isn’t overriding transaction isolation or autocommit behavior.

Step 4: Check for Distributed Transaction Coordinator (MSDTC) Issues

  • Open Component Services (dcomcnfg.exe) on the Windows Server 2025 host.
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator.
  • Confirm the MSDTC service is running and properly configured for network access if the transaction spans linked servers.
  • Restart the service if needed:
  Restart-Service MSDTC -Force

Step 5: Audit Replication or CDC Jobs (If Applicable)

  • If the error originates from a replication agent or Change Data Capture job, open SQL Server Management Studio (SSMS) and inspect the Log Reader Agent job history.
  • Verify the agent job isn’t attempting to mark a transaction after the parent transaction has already committed.
  • Reschedule or reissue the job after confirming the transaction block wraps the entire batch.

Alternative or Verification Steps

  • To verify the fix, re-run the original script or stored procedure and confirm no Error 3921 appears in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • As an alternative, wrap the entire operation in a TRY...CATCH block with explicit BEGIN TRAN / COMMIT TRAN pairs to ensure the transaction token is always requested within an active transaction context.

How to fix Error 3922 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3922 – “Cannot Enlist in the Transaction Because the Transaction Does Not Exist”

Why This Error Happens

This error typically occurs when a distributed transaction has already been committed, rolled back, or has timed out before a secondary session or linked server attempts to enlist in it. It is commonly triggered by MSDTC (Microsoft Distributed Transaction Coordinator) communication failures between Windows Server 2025 and client/linked server nodes, or by a mismatch in transaction timeout settings. Corrupted MSDTC logs or improperly configured network DTC access can also cause the coordinator to lose track of an active transaction context.

Step-by-Step Resolution Guide

Step 1: Verify and Restart the MSDTC Service

  • Open Services.msc on Windows Server 2025 / Windows 11.
  • Locate Distributed Transaction Coordinator, right-click, and select Restart.
  • Confirm the service is set to Automatic startup type to prevent recurrence after reboot.

Step 2: Reconfigure Network DTC Access

  • Open Component Services (dcomcnfg.exe).
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator > Local DTC.
  • Right-click Local DTC, select Properties, and go to the Security tab.
  • Enable Network DTC Access, Allow Inbound, Allow Outbound, and set authentication to Incoming and Outgoing Caller Authentication Required.
  • Apply changes and restart the MSDTC service when prompted.

Step 3: Check Firewall and Port Configuration

  • Ensure Windows Firewall allows traffic on RPC dynamic port range and port 135 for MSDTC communication.
  • Run the following PowerShell command to confirm the rule is enabled:
Get-NetFirewallRule -DisplayGroup "Distributed Transaction Coordinator"
  • If disabled, enable it using:
Enable-NetFirewallRule -DisplayGroup "Distributed Transaction Coordinator"

Step 4: Adjust Transaction Timeout Settings in SQL Server

  • Open SQL Server Management Studio (SSMS).
  • Review application-level SET XACT_ABORT ON and BEGIN DISTRIBUTED TRANSACTION logic to ensure timeouts align with MSDTC settings.
  • Increase the transaction timeout value in the application connection string if transactions are timing out prematurely.

Step 5: Rebuild Corrupted MSDTC Logs (If Issue Persists)

  • Stop the MSDTC service.
  • Navigate to C:\Windows\System32\MSDtc\ and rename the MSDTC folder to MSDTC_old.
  • Restart the server to allow Windows to regenerate the MSDTC log files automatically.

Alternative or Verification Steps

  • Run a test distributed transaction between the two servers using BEGIN DISTRIBUTED TRANSACTION in SSMS and confirm it commits without raising Error 3922.
  • If the issue persists, use the DTCPing tool (compatible with Windows Server 2025) to diagnose connectivity issues between the involved servers at the MSDTC level.

How to fix Error 3920 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3920 occurs because SQL Server only allows a single transaction mark to be written to the transaction log per connection/transaction nesting level. When a BEGIN TRAN WITH MARK statement is issued while another marked transaction is already open (nested transactions), the engine silently ignores the second WITH MARK clause and raises this informational error instead of failing the batch. This is commonly triggered by stored procedures or application code that re-enters a transaction block, or by a database recovery model (Simple) that doesn’t fully support log marking in the way the application expects.

Step-by-Step Resolution Guide

Step 1: Check the Database Recovery Model

  • Open SSMS and connect to the SQL Server 2025 instance.
  • Run the following query to confirm the model:
    SELECT name, recovery_model_desc FROM sys.databases WHERE name = 'YourDB';
  • If the result shows SIMPLE, switch it to FULL or BULK_LOGGED since marked transactions are only fully honored in these models:
    ALTER DATABASE YourDB SET RECOVERY FULL;

Step 2: Audit the Code for Nested BEGIN TRAN WITH MARK Statements

  • Search all stored procedures, triggers, and application connection strings for multiple BEGIN TRAN WITH MARK calls within the same session or call stack.
  • Use this query to locate the mark history and confirm duplicates:
    SELECT * FROM msdb.dbo.logmarkhistory WHERE database_name = 'YourDB' ORDER BY mark_time DESC;
  • Refactor the code so only the outermost transaction in the batch uses the WITH MARK clause; inner transactions should use plain BEGIN TRAN.

Step 3: Verify Transaction Isolation and Connection Reuse

  • Check @@TRANCOUNT before issuing a new BEGIN TRAN WITH MARK to ensure you are not already inside an active transaction:
    IF @@TRANCOUNT = 0 BEGIN TRAN MyMark WITH MARK 'Description';
  • On Windows Server 2025/Windows 11 clients, confirm connection pooling in the application (ODBC/OLE DB driver settings in ODBC Data Source Administrator) isn’t reusing a session that still holds an open marked transaction.

Step 4: Apply the Fix and Restart the Session

  • Close and reopen the SSMS query window or application connection to clear any lingering transaction state.
  • Re-run the corrected script with a single BEGIN TRAN WITH MARK at the top level.

Alternative or Verification Steps

  • Verify the fix by querying msdb.dbo.logmarkhistory after running the corrected transaction — only one mark entry should appear per logical operation, with no Error 3920 raised in the Messages tab.
  • If the issue persists, as an alternative, use explicit named transactions (BEGIN TRAN TranName WITH MARK) combined with SET XACT_ABORT ON to force clean transaction boundaries and prevent accidental nesting.

How to fix Error 3919 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3919 — Cannot Enlist in the Transaction

Why This Error Happens

Error 3919 occurs when a session attempts to enlist in a distributed or local transaction that has already completed (committed or rolled back) due to a timing mismatch between the application thread and the transaction’s lifecycle. This typically happens when connection pooling returns a connection still bound to a stale transaction context, or when MSDTC (Distributed Transaction Coordinator) settings on Windows Server 2025 are misconfigured, causing the transaction to resolve before all enlistments complete. Corrupted or outdated transaction logs, along with network latency between SQL Server 2025 and the client application, can also trigger premature transaction termination.

Step-by-Step Resolution Guide

Step 1: Verify and Restart MSDTC Service

  • Open Component Services (comexp.msc) on Windows Server 2025 / Windows 11.
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator.
  • Right-click Local DTC and select Stop, then Start to clear any stale transaction states.
  • Alternatively, run in an elevated PowerShell prompt:
  Restart-Service -Name MSDTC -Force

Step 2: Check Transaction Timeout and Isolation Settings

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Review the application’s TransactionScope timeout value — default is often too short for long-running queries.
  • Increase the timeout in application code, for example:
  using (var scope = new TransactionScope(TransactionScopeOption.Required,
      new TransactionOptions { Timeout = TimeSpan.FromMinutes(5) }))
  • Confirm REMOTE_PROC_TRANSACTIONS is correctly configured if linked servers are involved:
  EXEC sp_configure 'remote proc trans', 1;
  RECONFIGURE;

Step 3: Disable Connection Pooling Temporarily for Diagnosis

  • Modify the connection string to set Pooling=False temporarily.
  • Test whether the error persists — if resolved, the issue lies in pooled connections retaining stale transaction handles.
  • If confirmed, clear the connection pool via:
  DBCC FREESYSTEMCACHE('ALL');
  • Re-enable pooling once validated and monitor for recurrence.

Step 4: Inspect SQL Server Error Logs and DTC Security Settings

  • Open SQL Server Error Log via SSMS under Management > SQL Server Logs.
  • Cross-reference the timestamp of Error 3919 with any MSDTC-related warnings.
  • In Component Services, right-click Local DTC > Properties > Security and ensure:
  • “Network DTC Access” is enabled.
  • “Allow Inbound/Outbound” transactions are checked.
  • Apply changes and restart the MSDTC service again.

Alternative or Verification Steps

  • Run a test transaction manually in SSMS using BEGIN TRAN, perform an operation, then COMMIT TRAN to confirm no enlistment errors occur under normal load.
  • If the issue persists, consider switching from distributed transactions to local transactions with manual two-phase commit logic in the application layer to bypass MSDTC dependency entirely.

How to fix Error 3918 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3918 — “The Statement or Function Must Be Executed in the Context of a User Transaction”

Why This Error Happens

This error occurs when a Transact-SQL statement that requires transactional context—such as COMMIT TRANSACTION, ROLLBACK TRANSACTION, or certain distributed query operations—is executed outside of an explicitly started user transaction (BEGIN TRANSACTION). It commonly arises in SQL Server 2025 when stored procedures or scripts are written assuming an ambient transaction exists, or when IMPLICIT_TRANSACTIONS session settings have been altered unexpectedly. It can also surface when connection pooling reuses a session where a prior transaction was improperly closed, leaving the session state inconsistent.

Step-by-Step Resolution Guide

Step 1: Verify the Transaction Isolation Settings

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Run DBCC USEROPTIONS; to check if IMPLICIT_TRANSACTIONS is unexpectedly set to ON.
  • Confirm the session-level setting by running SELECT @@OPTIONS; and checking bitmask value 2 (implicit transactions).

Step 2: Explicitly Wrap the Statement in a Transaction

  • Edit the failing script or stored procedure to include an explicit BEGIN TRANSACTION before the problematic COMMIT or ROLLBACK call.
  • Example fix:
  BEGIN TRANSACTION;
  -- your statements here
  COMMIT TRANSACTION;
  • Ensure every COMMIT/ROLLBACK has a matching BEGIN TRANSACTION in the same scope (no orphaned commits).

Step 3: Audit Application Connection Handling

  • Check your application’s data access layer (e.g., ADO.NET, ODBC, or JDBC driver) for leftover transaction objects not being disposed properly.
  • On Windows Server 2025, inspect connection pooling settings in the app’s connection string (e.g., Pooling=true;Max Pool Size=100) to rule out stale, reused connections carrying broken transaction state.
  • Restart the application pool (IIS) or service host to clear any lingering broken sessions.

Step 4: Review SQL Server Configuration for Implicit Transactions

  • Navigate to SSMS → Right-click Server → Properties → Connections.
  • Confirm “No default” is selected rather than forcing implicit transactions at the instance level unless intentionally configured.
  • Alternatively, run:
  SET IMPLICIT_TRANSACTIONS OFF;

at the top of the session or procedure if implicit mode is not required.

Step 5: Apply Latest Cumulative Update

  • Check Windows Update or the Microsoft Update Catalog for the latest SQL Server 2025 Cumulative Update (CU), as transaction-context handling bugs in distributed queries have been patched in early CUs.
  • Install via: Control Panel > Programs > Programs and Features, or run the standalone CU installer with elevated privileges.

Alternative or Verification Steps

  • Re-run the original failing script/procedure after applying the BEGIN TRANSACTION fix and confirm no Error 3918 appears in SSMS or the SQL Server Error Log (Management > SQL Server Logs).
  • As an alternative, wrap the entire operation in a TRY...CATCH block with XACT_STATE() checks to gracefully handle cases where a transaction context may or may not already exist.

How to fix Error 3917 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3917 – Session Bound to Transaction Context Already in Use

Why This Error Happens

Error 3917 occurs when a session attempts to run a new batch or statement while a transaction on that same session is already active and bound to another concurrent operation, typically caused by application code that fails to properly commit, rollback, or close a transaction before issuing new commands. This is commonly seen in multi-threaded applications or ORM frameworks that share a single connection object across threads without proper synchronization, or when MARS (Multiple Active Result Sets) is not enabled but the application attempts concurrent operations on the same connection. Occasionally, this can also result from an abruptly terminated client connection that leaves a “ghost” transaction bound to the session on the SQL Server 2025 engine side.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Session and Transaction

  • Open SQL Server Management Studio (SSMS) and connect to the instance.
  • Run the following query to find sessions with open transactions: SELECT session_id, transaction_id, is_user_transaction FROM sys.dm_tran_session_transactions WHERE is_user_transaction = 1;
  • Cross-reference the session_id with sys.dm_exec_requests to see if the session is blocked or sleeping while holding an open transaction.

Step 2: Enable Multiple Active Result Sets (MARS) if Required

  • If your application architecture requires running multiple batches on a single connection concurrently, navigate to your connection string configuration file (e.g., web.config or appsettings.json).
  • Add or modify the parameter: MultipleActiveResultSets=True;
  • Restart the application pool or service in IIS/Windows Server 2025 to apply the new connection string settings.

Step 3: Audit Application Code for Transaction Scope Leaks

  • Review the application source code for TransactionScope or SqlTransaction objects that are not wrapped in a try-finally or using block.
  • Ensure every BEGIN TRANSACTION has a corresponding COMMIT or ROLLBACK in all code paths, including exception handlers.
  • Check for recursive stored procedure calls that might be opening a second transaction on a connection already committed to a specific task.

Step 4: Terminate the Stuck Session (If Immediate Resolution is Needed)

  • If the session is confirmed to be an orphaned “ghost” connection and not currently processing critical data, you may need to clear it manually.
  • Execute the kill command using the session ID identified in Step 1: KILL <session_id>;
  • Monitor the sys.dm_exec_sessions view to confirm the session has been successfully terminated and resources have been released.

Alternative or Verification Steps

  • Verification: Re-run the original query or batch that triggered the error. If successful, check sys.dm_tran_active_transactions to confirm no orphaned transactions remain active for that specific login.
  • Alternative Fix: If the issue persists across a specific linked server query, verify that SET XACT_ABORT ON is configured at the top of your stored procedures to ensure any error automatically rolls back the entire transaction rather than leaving it “in use.”

How to fix Error 3915 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3915 – ROLLBACK Within INSERT-EXEC Statement

Why This Error Happens

Error 3915 occurs because SQL Server does not allow a ROLLBACK TRANSACTION statement to be executed inside a stored procedure or remote query that is itself being called from within an INSERT...EXEC statement. This restriction exists because the INSERT-EXEC construct relies on an open rowset/result-set pipe to stream data back to the calling INSERT, and an uncontrolled rollback mid-stream would corrupt the transaction context and leave the data pipe in an undefined state. This is a design limitation in the SQL Server transaction engine (applicable through SQL Server 2025) rather than a configuration bug, meaning it must be resolved through code refactoring rather than a server-side patch or setting.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Procedure

  • Open SQL Server Management Studio (SSMS) on your Windows Server 2025 or Windows 11 workstation.
  • Run SELECT * FROM sys.dm_exec_query_stats or check the Activity Monitor to locate the exact stored procedure being called via INSERT INTO ... EXEC.
  • Review the procedure definition using sp_helptext 'YourProcedureName' to find internal BEGIN TRAN / ROLLBACK logic.

Step 2: Refactor the Stored Procedure to Remove Internal Rollback

  • Modify the stored procedure so it does not contain a ROLLBACK statement when called in this context.
  • Replace internal transaction handling with TRY...CATCH blocks that use RAISERROR or THROW to pass errors back to the caller instead of rolling back internally.
  • Example pattern:
  BEGIN TRY
      -- Business logic here
  END TRY
  BEGIN CATCH
      THROW; -- Let the calling batch handle rollback
  END CATCH

Step 3: Move the Transaction Control to the Calling Batch

  • Wrap the INSERT...EXEC statement itself in the parent batch with its own transaction handling, rather than relying on the inner procedure.
  • Use the following structure in the calling script:
  BEGIN TRY
      BEGIN TRANSACTION;
          INSERT INTO #TempTable
          EXEC dbo.YourStoredProcedure;
      COMMIT TRANSACTION;
  END TRY
  BEGIN CATCH
      IF @@TRANCOUNT > 0
          ROLLBACK TRANSACTION;
      THROW;
  END CATCH

Step 4: Use a Table Variable or Temp Table as an Intermediary (If Refactoring is Not Possible)

  • If you cannot modify the source procedure (e.g., it is third-party), avoid using INSERT...EXEC altogether.
  • Switch to OPENROWSET with BULK or OPENQUERY against a loopback linked server to capture the result set without triggering the INSERT-EXEC transactional restriction.
  • Alternatively, configure the procedure to write results directly to a physical or temp table internally, and query that table separately instead of capturing the EXEC output stream.

Step 5: Restart the SQL Server Service to Clear Cached Execution Plans

  • Open Services.msc on Windows Server 2025.
  • Locate SQL Server (MSSQLSERVER) or your named instance.
  • Right-click and select Restart to ensure the old cached execution plan (which may still reference the faulty transaction logic) is cleared.

Alternative or Verification Steps

  • Verify the fix: Re-run the original batch script in SSMS; the INSERT...EXEC call should complete successfully without throwing Error 3915, and check sys.messages to confirm no residual transaction warnings are logged.
  • Alternative workaround: If refactoring is too risky for a production system, use a TRY...CATCH wrapper at the outermost calling script level only, and ensure the inner procedure uses SET XACT_ABORT ON instead of explicit ROLLBACK calls, letting SQL Server handle transaction termination automatically on error.

How to fix Error 3916 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3916 — COMMIT Statement Not Allowed Within INSERT-EXEC Without Explicit Transaction

Why This Error Happens

This error occurs because SQL Server 2025 detects a mismatched transaction nesting level when a stored procedure or dynamic SQL executed inside an INSERT-EXEC statement attempts to issue a COMMIT without a corresponding explicit BEGIN TRANSACTION. SQL Server internally wraps INSERT-EXEC operations in a transaction context to maintain rowset integrity, and any COMMIT inside the called procedure that isn’t balanced by its own BEGIN TRANSACTION breaks this nesting, causing the engine to reject the operation. This is typically a T-SQL coding issue rather than a server misconfiguration, often surfacing after application upgrades, migrations from older SQL Server versions, or when legacy stored procedures assume autocommit behavior.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Stored Procedure or Script

  • Capture the full error text, which includes the procedure name and line number where the COMMIT occurs.
  • Run SELECT * FROM sys.messages WHERE message_id = 3916; in SSMS to confirm the exact error definition for SQL Server 2025.
  • Open the procedure in SSMS using EXEC sp_helptext 'YourProcedureName'; to review its transaction logic.

Step 2: Add Explicit BEGIN TRANSACTION and Matching COMMIT/ROLLBACK

  • Wrap the body of the stored procedure with a properly balanced transaction block:
  • BEGIN TRANSACTION;
  • -- your INSERT/UPDATE/DELETE logic here
  • COMMIT TRANSACTION;
  • Ensure every code path (including error-handling blocks) has a matching COMMIT or ROLLBACK, especially inside TRY...CATCH constructs.
  • Use SET XACT_ABORT ON; at the top of the procedure to ensure transactions are automatically rolled back on error.

Step 3: Refactor INSERT-EXEC Usage

  • Avoid calling procedures with COMMIT statements directly inside an INSERT-EXEC; instead, modify the procedure to return a result set without managing its own transaction when it will be consumed by INSERT-EXEC.
  • If the called procedure must manage its own transactions independently, use OPENROWSET or a table-valued function as an alternative to INSERT-EXEC.
  • Test the modified procedure in isolation using EXEC YourProcedureName; before re-integrating it into the INSERT-EXEC call.

Step 4: Validate Compatibility Level and Configuration

  • Confirm the database compatibility level supports expected transaction behavior by running SELECT compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName';
  • Update to the latest compatibility level for SQL Server 2025 using ALTER DATABASE YourDatabaseName SET COMPATIBILITY_LEVEL = 170;
  • Restart the SQL Server service via services.msc on Windows Server 2025 if compatibility changes require a service refresh.

Alternative or Verification Steps

  • Re-run the original INSERT-EXEC statement in SSMS; if no Error 3916 appears and the expected rows are inserted, the fix is confirmed.
  • As an alternative, replace INSERT-EXEC with a table variable populated via OPENQUERY or a temporary staging table combined with a MERGE statement to bypass nested transaction constraints entirely.

How to fix Error 3914 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3914 occurs when a Transact-SQL statement attempts to assign a transaction name or savepoint name using a data type other than char, varchar, nchar, or nvarchar. This typically happens when a variable declared as int, uniqueidentifier, or another non-character type is passed directly into a BEGIN TRANSACTION, SAVE TRANSACTION, or COMMIT TRANSACTION statement. SQL Server 2025 enforces strict type-checking on these parameters because transaction names are internally stored and matched as character strings, not binary or numeric values.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Variable

  • Open the stored procedure, trigger, or script referenced in the error message within SQL Server Management Studio (SSMS) 21 or Azure Data Studio.
  • Locate the BEGIN TRAN, SAVE TRAN, or COMMIT TRAN statement and check the variable or literal being passed as the name.
  • Run sp_help or check sys.columns if the value originates from a table to confirm its current data type.

Step 2: Explicitly Cast or Redeclare the Variable

  • Modify the variable declaration to use a character-based type, for example:
    DECLARE @TranName VARCHAR(32) = 'MyTransaction';
  • If the value is being generated dynamically (e.g., from a GUID or integer counter), wrap it in a CAST() or CONVERT() function before use:
    SAVE TRANSACTION @TranName;
  • Ensure the length of the varchar/nvarchar field does not exceed 32 characters, as SQL Server silently truncates transaction names beyond this limit.

Step 3: Update Application Code and ORM Mappings

  • If the transaction name is passed from an application layer (C#, Java, Python), verify the parameter binding is not forcing an int or GUID SQL type mapping.
  • For Entity Framework or Dapper users, explicitly define the parameter as DbType.AnsiString or DbType.String in the connection logic.
  • Redeploy the updated stored procedure using ALTER PROCEDURE and recompile to clear any cached invalid execution plans.

Step 4: Clear Cached Execution Plans (If Error Persists)

  • Run DBCC FREEPROCCACHE to remove any stale plans that may still reference the old data type logic.
  • Re-execute the corrected script in a test environment before pushing to production on Windows Server 2025.

Alternative or Verification Steps

  • Execute the corrected transaction block manually in SSMS; a successful run with no Error 3914 confirms the fix. You can also check sys.dm_tran_active_transactions to verify the transaction name registered correctly as a string value.
  • As an alternative, if dynamic naming is required, use sp_executesql with strongly-typed NVARCHAR parameters to avoid implicit conversion issues at runtime.

How to fix Error 3913 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3913 — TDS Reset Connection Protocol Conflict

Why This Error Happens

This error occurs when the TDS (Tabular Data Stream) protocol layer receives a connection reset packet from the client driver with two mutually exclusive flags set simultaneously: ResetConnectionKeepLocalXact and ResetConnectionKeepDTCXact. SQL Server interprets these as conflicting instructions because the first flag indicates a local transaction should persist across connection pooling resets, while the second indicates a distributed (MSDTC-enlisted) transaction should persist — the server cannot honor both contexts at once. This typically stems from an outdated, misconfigured, or buggy client driver (such as an older ODBC, OLE DB, or ADO.NET/Microsoft.Data.SqlClient provider) mishandling connection pooling logic when transactions span enlistment boundaries.

Step-by-Step Resolution Guide

Step 1: Identify and Update the Client Driver

  • Check which driver the connecting application uses (SqlClient, ODBC Driver 17/18, OLE DB Driver for SQL Server, or JDBC).
  • Navigate to Control Panel > Programs and Features on Windows Server 2025 / Windows 11 to confirm the installed driver version.
  • Update to the latest Microsoft.Data.SqlClient NuGet package (version 5.x or later) or the newest Microsoft ODBC Driver 18 for SQL Server from the official Microsoft Download Center.
  • Restart the application pool or service after the driver update completes.

Step 2: Review Connection Pooling and Transaction Enlistment Settings

  • Inspect the application’s connection string for conflicting parameters, especially Enlist=true combined with manual TransactionScope usage alongside local transaction calls (BeginTransaction).
  • In .NET applications, ensure code does not mix System.Transactions.TransactionScope (which enlists in MSDTC) with explicit SqlTransaction objects on the same connection.
  • Set Enlist=false in the connection string if distributed transactions are not required, located typically in web.config, app.config, or the application’s appsettings.json.

Step 3: Validate MSDTC Configuration on the Server

  • Open Component Services (dcomcnfg.exe) on Windows Server 2025.
  • Navigate to Component Services > Computers > My Computer > Distributed Transaction Coordinator > Local DTC.
  • Right-click Local DTC > Properties > Security tab and confirm “Network DTC Access,” “Allow Inbound,” and “Allow Outbound” are correctly enabled only if distributed transactions are genuinely needed.
  • If DTC is not required, disable it in the application logic to prevent the driver from issuing the ResetConnectionKeepDTCXact flag unnecessarily.

Step 4: Apply the Latest SQL Server 2025 Cumulative Update

  • Open SQL Server Configuration Manager or check version via SELECT @@VERSION; in SSMS.
  • Download and install the latest Cumulative Update (CU) for SQL Server 2025 from the Microsoft Update Catalog, as this specific TDS handshake conflict is addressed in protocol-layer patches.
  • Reboot the SQL Server service (net stop MSSQLSERVER then net start MSSQLSERVER) after patching.

Step 5: Capture a Network Trace for Deep Diagnosis

  • If the issue persists, use SQL Server Profiler or Extended Events to capture the RPC:Starting and Existing Connection events around the failure timestamp.
  • Cross-reference with a Wireshark TDS packet capture to confirm which flags the client is sending during the PRELOGIN/reset phase.

Alternative or Verification Steps

  • To verify the fix, run a load test simulating connection pool resets under transactional load and confirm Error 3913 no longer appears in the SQL Server error log (ERRORLOG file, typically located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\).
  • As an alternative workaround, disable connection pooling entirely by setting Pooling=false in the connection string to confirm the driver is the root cause, then re-enable pooling only after the driver/application code fix is deployed.

How to fix Error 3912 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3912 – Cannot Bind Using an XP Token

Why This Error Happens

Error 3912 occurs when SQL Server’s backup or restore operation attempts to use an extended stored procedure (XP) token outside the context of an actual XP call, typically caused by a corrupted or orphaned session state within the Database Engine. This can result from an interrupted BACKUP/RESTORE command, a failing third-party extended stored procedure, or a mismatch between the SQL Server service account’s security token and the current thread context. In most cases, this points to an internal threading inconsistency introduced by abrupt connection termination or improper cleanup of extended procedure handles.

Step-by-Step Resolution Guide

Step 1: Verify the Current Session and Connection State

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance on Windows Server 2025.
  • Run SELECT * FROM sys.dm_exec_sessions WHERE status = 'running' to identify any hung or orphaned sessions tied to the backup/restore task.
  • Check SELECT * FROM sys.dm_exec_requests WHERE command LIKE '%BACKUP%' OR command LIKE '%RESTORE%' to confirm if a stalled XP call is active.
  • If an orphaned session is found, note the session_id for termination in the next step.

Step 2: Terminate the Orphaned Process and Restart the SQL Server Service

  • Execute KILL <session_id> in a new query window to forcibly end the stuck session identified in Step 1.
  • Open Services.msc on Windows Server 2025 / Windows 11, locate “SQL Server (MSSQLSERVER)” or the named instance.
  • Right-click and select Restart to clear any lingering token states in memory.
  • Confirm the SQL Server Agent service also restarts cleanly if backup jobs are scheduled through it.

Step 3: Repair Extended Stored Procedure Dependencies

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\ and verify that sqlservr.exe and related XP DLLs (e.g., xpstar.dll, xplog70.dll) are not flagged as corrupted or blocked by Windows Defender.
  • Run sp_configure 'xp_cmdshell', 0 followed by RECONFIGURE to temporarily disable xp_cmdshell, then re-enable it with sp_configure 'xp_cmdshell', 1; RECONFIGURE; to force a clean reload of the XP subsystem.
  • If using third-party backup agents (e.g., Veeam, CommVault), update them to the latest SQL Server 2025-compatible version, as outdated VSS writers are a common trigger for this error.

Step 4: Rebuild the Backup Job or Script

  • Open SQL Server Agent, navigate to the job causing the error, and delete the existing backup step.
  • Recreate the backup step manually using the native BACKUP DATABASE [YourDB] TO DISK = 'D:\Backups\YourDB.bak' WITH CHECKSUM, INIT; syntax rather than relying on a cached or legacy script.
  • Save and run the job manually once to confirm the XP token binds correctly during execution.

Alternative or Verification Steps

  • Re-run the previously failing backup or restore operation and monitor the SQL Server Error Log (Management > SQL Server Logs in SSMS) to confirm Error 3912 no longer appears.
  • If the issue persists, apply the latest Cumulative Update (CU) for SQL Server 2025 from Microsoft, as this error is sometimes tied to a known threading bug in the extended procedure framework that gets patched in subsequent builds.

How to fix Error 3911 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3911 – Persistent Version Store Full

Why This Error Happens

This error occurs when the Persistent Version Store (PVS), used by SQL Server 2025’s Accelerated Database Recovery (ADR) feature, grows until it consumes all available space within the database’s data files. The root cause is typically a long-running or orphaned transaction that prevents the version store cleanup process from reclaiming stale row versions, causing the version store to grow unbounded. This can also happen if the database has a fixed maximum file size and autogrowth is disabled, leaving no room for the PVS to expand even when active transactions are healthy.

Step-by-Step Resolution Guide

Step 1: Identify Long-Running or Blocking Transactions

  • Run the following query to find sessions preventing version cleanup: SELECT * FROM sys.dm_tran_active_snapshot_database_transactions ORDER BY elapsed_time_seconds DESC;
  • Cross-reference results with sys.dm_exec_sessions and sys.dm_exec_requests to identify the offending session ID (SPID).
  • Look specifically for sessions in a “sleeping” or “rollback” state that have been open for an unusually long time.

Step 2: Terminate the Offending Session

  • Once the problematic SPID is confirmed, terminate it safely using KILL <SPID>;
  • Monitor the rollback progress via SELECT percent_complete FROM sys.dm_exec_requests WHERE session_id = <SPID>;
  • Note that terminating large transactions may take time as SQL Server unwinds the transaction log.

Step 3: Increase Database File Size or Enable Autogrowth

  • Navigate to SQL Server Management Studio (SSMS) and right-click the affected database, then select Properties > Files.
  • Ensure the Autogrowth/Maxsize setting is not capped at a restrictive limit; set it to “Unlimited” or a significantly higher value.
  • Alternatively, run via T-SQL: ALTER DATABASE [YourDB] MODIFY FILE (NAME = YourDB_Data, MAXSIZE = UNLIMITED);

Step 4: Manually Force Version Store Cleanup

  • If automatic cleanup is lagging, execute a manual cleanup task: EXEC sys.sp_persistent_version_cleanup 'YourDB';
  • This forces SQL Server 2025 to scan and remove unnecessary row versions immediately rather than waiting for the background thread.
  • Verify disk space has been reclaimed afterward using sys.dm_tran_persistent_version_store_stats.

Step 5: Review Disk Space on the Host Server

  • On Windows Server 2025, open File Explorer or Disk Management to confirm the physical drive hosting the .mdf/.ndf files has sufficient free space.
  • If the physical disk is full, move secondary data files to a drive with more capacity using ALTER DATABASE ... MODIFY FILE (FILENAME = 'D:\NewPath\file.ndf'); (requires taking the file offline temporarily).

Alternative or Verification Steps

  • Verify the Fix: Query sys.dm_tran_persistent_version_store_stats and confirm that the persistent_version_store_size_kb value is decreasing or stable rather than continuously climbing.
  • Alternative Solution: If the version store continues to fill due to application design (e.g., frequent long transactions), consider disabling ADR temporarily via ALTER DATABASE [YourDB] SET ACCELERATED_DATABASE_RECOVERY = OFF; until the application logic is optimized to use shorter transactions.

How to fix Error 3910 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3910 — “Transaction Context In Use By Another Session”

Why This Error Happens

This error occurs when multiple sessions or connections attempt to use the same transaction context simultaneously, typically caused by improper connection pooling, multi-threaded applications sharing a single SqlConnection object, or distributed transactions that weren’t properly committed or rolled back before a new operation began. It can also surface when linked server queries or MARS (Multiple Active Result Sets) configurations are mismanaged, leaving an orphaned transaction attached to a session that another process then tries to access. Essentially, SQL Server 2025 detects that a transaction is “owned” by a session different from the one currently issuing commands against it.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Session

  • Run DBCC OPENTRAN in SQL Server Management Studio (SSMS) to identify the oldest active transaction and its associated Session ID (SPID).
  • Cross-reference with sys.dm_tran_active_transactions and sys.dm_tran_session_transactions to pinpoint which session owns the stuck transaction.
  • Check application logs around the same timestamp to correlate the error with a specific connection or thread.

Step 2: Review Application Connection Handling

  • Inspect the application code (especially .NET apps using SqlConnection/SqlTransaction) to ensure each thread uses its own connection and transaction object rather than sharing a single instance.
  • Verify that Enlist=false or proper TransactionScope boundaries are set if using distributed transactions, located typically in the connection string configuration file (e.g., web.config or appsettings.json).
  • Confirm MARS is explicitly enabled only where necessary by checking for MultipleActiveResultSets=True in the connection string, as improper MARS use is a common trigger.

Step 3: Terminate the Orphaned Session

  • If a stuck session is confirmed via Step 1, run KILL <SPID> in SSMS to forcibly terminate the orphaned transaction (replace <SPID> with the actual session ID).
  • On Windows Server 2025, open SQL Server Configuration Manager and restart the SQL Server (MSSQLSERVER) service if multiple sessions remain locked system-wide.
  • Clear any hung connections in the application’s connection pool by restarting the application pool via IIS Manager (for web apps) or recycling the service in Services.msc.

Step 4: Patch and Update SQL Server

  • Navigate to Microsoft Update Catalog or use SQL Server Setup to confirm you are running the latest Cumulative Update (CU) for SQL Server 2025, as transaction-context bugs are frequently addressed in CUs.
  • Check installed version via SELECT @@VERSION; and compare against the latest build listed on the official SQL Server release notes page.

Alternative or Verification Steps

  • To verify the fix, re-run the failing application workflow while monitoring DBCC OPENTRAN and sys.dm_exec_requests to confirm no transaction remains orphaned across sessions.
  • If the error persists, consider isolating the problematic stored procedure or application module and wrapping all transaction logic in explicit BEGIN TRAN/COMMIT/ROLLBACK blocks with proper TRY...CATCH error handling to eliminate ambiguous transaction ownership.

How to fix Error 3908 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3908 — “Could Not Run BEGIN TRANSACTION” in SQL Server 2025

Why This Error Happens

This error occurs when the SQL Server database engine flags a database as being in Emergency Mode or detects it as structurally damaged, preventing any transactional activity from starting. This typically results from a corrupted transaction log, an incomplete recovery process after an unexpected shutdown, or physical corruption of the primary data file (.mdf). Because the database cannot guarantee ACID compliance in this state, SQL Server blocks all BEGIN TRANSACTION calls until the database is repaired and brought back online.

Step-by-Step Resolution Guide

Step 1: Verify the Current Database State

  • Open SQL Server Management Studio (SSMS) or a query window and run the following to check the status:
  SELECT name, state_desc FROM sys.databases WHERE name = 'YourDatabaseName';
  • Look specifically for EMERGENCY or SUSPECT in the state_desc column.
  • Check the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for specific corruption messages (e.g., Error 823 or 824) that triggered the Emergency Mode flag.

Step 2: Attempt Database Repair via Emergency Mode

  • If the database is already in Emergency Mode, set it to SINGLE_USER to isolate it for repair:
  ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Run the DBCC CHECKDB command with the repair option to attempt automatic fixes. Note that this may result in data loss for corrupted pages:
  DBCC CHECKDB (YourDatabaseName, REPAIR_ALLOW_DATA_LOSS);
  • Allow the process to run completely, as it may take significant time depending on database size.

Step 3: Restart the SQL Server Service (Windows Server 2025)

  • Open the Services console by running services.msc in the Windows 11/Server 2025 Run dialog.
  • Locate SQL Server (MSSQLSERVER) or the specific named instance.
  • Right-click and select Restart to clear any stale locks or session handles the engine may have retained during the corruption event.
  • If the service fails to restart, check the Windows System Event Viewer (eventvwr.msc) under Windows Logs > Application for specific startup failures related to the Database Engine.

Step 4: Take the Database Back Online

  • Once the repair command has successfully executed, revert the database to multi-user access:
  ALTER DATABASE YourDatabaseName SET MULTI_USER;
  • Attempt to run a standard BEGIN TRANSACTION command again to confirm the lock has been lifted.

Alternative or Verification Steps

  • Verification: Run DBCC CHECKDB (YourDatabaseName) WITH NO_INFOMSGS; again after the fix to ensure the integrity check returns zero allocation or consistency errors.
  • Alternative Solution: If REPAIR_ALLOW_DATA_LOSS fails to bring the database out of Emergency Mode, restore the database from the last known good backup using RESTORE DATABASE YourDatabaseName FROM DISK = 'BackupPath.bak' WITH RECOVERY; to ensure data integrity.

How to fix Error 3909 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3909 – Session Binding Token Is Invalid

Why This Error Happens

Error 3909 in Microsoft SQL Server 2025 typically occurs when the session binding token—used to validate and maintain a secure link between a client connection and its authenticated session—becomes corrupted, expired, or mismatched. This often results from a disrupted Transport Layer Security (TLS) handshake, a desynchronized system clock between the client and server, or stale cached credentials that no longer match the current session context. In some cases, incomplete updates to SQL Server’s authentication subsystem after a patch or cumulative update can leave binding token validation in an inconsistent state.

Step-by-Step Resolution Guide

Step 1: Verify System Time Synchronization

  • Session binding tokens are time-sensitive; a clock skew greater than 5 minutes between the client and SQL Server host can invalidate tokens immediately.
  • On Windows Server 2025, open PowerShell as Administrator and run w32tm /query /status to check sync status.
  • If drift is detected, force resynchronization with w32tm /resync /force.

Step 2: Clear Cached Authentication Tokens

  • Stale tokens stored in the local credential cache can conflict with newly issued session tokens.
  • Open Credential Manager (Control Panel > User Accounts > Credential Manager) and remove any entries related to SQL Server or MSSQLSERVER.
  • Alternatively, run klist purge in Command Prompt to clear Kerberos tickets if using Windows Authentication.

Step 3: Restart the SQL Server Service and Validate Certificates

  • Expired or mismatched TLS certificates on the SQL Server instance frequently trigger invalid binding tokens.
  • Open SQL Server Configuration Manager, navigate to SQL Server Network Configuration > Protocols, and confirm the certificate under the Certificate tab is valid and not expired.
  • Restart the SQL Server (MSSQLSERVER) service via Restart-Service MSSQLSERVER -Force in an elevated PowerShell session.

Step 4: Apply the Latest Cumulative Update

  • Known issues with session token validation have been addressed in recent SQL Server 2025 cumulative updates (CUs).
  • Download and install the latest CU from the Microsoft Update Catalog, then verify the build version using SELECT @@VERSION; in SQL Server Management Studio (SSMS).

Alternative or Verification Steps

  • To verify the fix, establish a new client connection via SSMS or sqlcmd and confirm the session persists without triggering Error 3909 in the SQL Server error log (Log > SQL Server Logs in SSMS).
  • If the issue persists, enable Extended Events tracing on the session_recoverable_state event to capture detailed binding token diagnostics for further root-cause analysis.

How to fix Error 3907 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3907 – Persistent Version Store Row Version Not Found

Why This Error Happens

This error occurs when SQL Server 2025’s Accelerated Database Recovery (ADR) feature cannot locate a required row version in the Persistent Version Store (PVS) because it has been prematurely cleaned up or the PVS has run out of allocated space. This typically happens due to long-running transactions holding open snapshots while aggressive version cleanup occurs, or because the database file growth settings cannot keep pace with the version store’s storage demands. In some cases, this is also triggered by a corrupted or inconsistent PVS internal table structure following an unexpected shutdown.

Step-by-Step Resolution Guide

Step 1: Check Persistent Version Store Space Usage

  • Open SQL Server Management Studio (SSMS) and run the following query to inspect PVS consumption:
  SELECT * FROM sys.dm_tran_persistent_version_store_stats;
  • Check the persistent_version_store_size_kb column against available database free space.
  • Verify database autogrowth settings via Database Properties > Files in SSMS are not set to a restrictive fixed growth increment.

Step 2: Identify and Kill Long-Running Transactions

  • Run the following to find blocking or long-running sessions preventing PVS cleanup:
  SELECT * FROM sys.dm_tran_active_snapshot_database_transactions;
  • Cross-reference the transaction_sequence_num with active sessions using sys.dm_exec_sessions.
  • Terminate problematic sessions using KILL <session_id>; once confirmed safe to do so.

Step 3: Increase Database File Space and Autogrowth Limits

  • Navigate to Databases > [Your DB] > Properties > Files in SSMS.
  • Manually expand the primary data file or add a secondary data file on a drive with sufficient free space (minimum 20% headroom recommended).
  • Update autogrowth to a fixed MB value (e.g., 512MB) rather than a percentage to avoid unpredictable growth spikes.

Step 4: Disable and Re-enable Accelerated Database Recovery

  • Run the following T-SQL command to disable ADR temporarily:
  ALTER DATABASE [YourDatabaseName] SET ACCELERATED_DATABASE_RECOVERY = OFF;
  • Wait for the PVS cleanup background thread to fully purge, then re-enable it:
  ALTER DATABASE [YourDatabaseName] SET ACCELERATED_DATABASE_RECOVERY = ON;
  • This forces a rebuild of the version store metadata, resolving any internal corruption pointers.

Step 5: Review SQL Server Error Logs for Disk I/O Conflicts

  • Open C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG (adjust version path as needed for SQL Server 2025).
  • Search for associated I/O warnings or “stalled” write messages near the timestamp of the 3907 error.
  • Confirm the underlying storage (especially on Windows Server 2025 with ReFS volumes) is not experiencing latency or fragmentation issues.

Alternative or Verification Steps

  • Verify the fix by re-running the original query/transaction that triggered Error 3907 and confirming it completes without aborting.
  • If the issue persists, run DBCC CHECKDB on the affected database to rule out underlying corruption, and consider restoring from the last known good backup if PVS metadata remains inconsistent.

How to fix Error 3906 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3906 – Database Is Read-Only

Why This Error Happens

This error occurs because the target database has its READ_ONLY property explicitly set, either manually by an administrator or automatically following operations like restoring from a read-only source, attaching a database from read-only media, or after certain Always On Availability Group failover scenarios. SQL Server 2025 also enforces this state when the database is part of a Log Shipping secondary role or when disk-level permissions on the underlying .mdf/.ndf files are restricted to read-only at the Windows file system level. Until the database state or file permissions are reverted, any INSERT, UPDATE, DELETE, or schema-altering transaction will be rejected with Error 3906.

Step-by-Step Resolution Guide

Step 1: Verify Current Database State

  • Open SQL Server Management Studio (SSMS) or a query window and run:
  SELECT name, state_desc, is_read_only 
  FROM sys.databases 
  WHERE name = 'YourDatabaseName';
  • Confirm whether is_read_only returns 1, confirming the database-level flag is the cause.

Step 2: Change the Database to Read-Write Mode

  • Ensure no active connections are using the database before altering its state.
  • Run the following T-SQL command with sufficient privileges (sysadmin or db_owner):
  ALTER DATABASE YourDatabaseName SET READ_WRITE WITH ROLLBACK IMMEDIATE;
  • The WITH ROLLBACK IMMEDIATE clause forcibly disconnects other users and rolls back open transactions to apply the change instantly.

Step 3: Check Windows File System Permissions

  • Navigate to the physical location of your database files (commonly C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).
  • Right-click the .mdf and .ldf files, go to Properties > Security, and ensure the NT SERVICE\MSSQLSERVER (or your custom SQL service account) has Full Control or at least Modify permissions.
  • Remove any inherited “Read-only” attribute checkbox under the General tab if it is checked.

Step 4: Review Log Shipping or Availability Group Configuration

  • If the database is a secondary replica in an Always On Availability Group, confirm this is expected behavior (secondaries are read-only by design) and redirect write operations to the Primary replica instead.
  • If using Log Shipping, verify this instance is not configured as a Secondary role recipient unintentionally.

Alternative or Verification Steps

  • Re-run the write operation (INSERT/UPDATE) that originally triggered Error 3906 to confirm the database now accepts transactions.
  • If the ALTER DATABASE command hangs due to active sessions, use sp_who2 to identify blocking SPIDs, or restart the SQL Server service via services.msc to clear locks before retrying the state change.

How to fix Error 3905 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3905 — Nested Transaction Limit Exceeded in SQL Server 2025

Why This Error Happens

Error 3905 occurs when a session’s @@TRANCOUNT value reaches its upper boundary because BEGIN TRANSACTION statements are being issued repeatedly without corresponding COMMIT or ROLLBACK calls. This is almost always caused by application-level connection pooling reusing a session that never properly closed an open transaction, or by poorly structured loops/recursive stored procedures that increment the transaction count on every iteration. In rare cases, ORM frameworks (like Entity Framework or Hibernate) mismanaging transaction scopes can silently stack nested BEGIN TRAN calls until the counter overflows.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Session and Query

  • Run DBCC OPENTRAN in SQL Server Management Studio (SSMS) to identify long-running or orphaned transactions.
  • Query sys.dm_tran_active_transactions joined with sys.dm_tran_session_transactions to find the exact session_id with an abnormally high @@TRANCOUNT.
  • Cross-reference the session_id with sys.dm_exec_requests to capture the sql_handle and extract the exact query text causing the issue.

Step 2: Audit and Correct Application/Procedure Code

  • Open the stored procedure or application source code (e.g., C#, Java) identified in Step 1.
  • Ensure every BEGIN TRANSACTION has a matching COMMIT TRANSACTION or ROLLBACK TRANSACTION, specifically checking TRY...CATCH blocks where a ROLLBACK might be missing after an exception.
  • If using nested procedures, replace manual BEGIN TRAN calls with a check: IF @@TRANCOUNT = 0 BEGIN TRAN.
  • For connection pooling issues on Windows Server 2025, verify the application’s connection string includes Enlist=false if distributed transactions are not explicitly required.

Step 3: Terminate the Stuck Session and Reset the Pool

  • If the transaction count is already maxed out and blocking production traffic, execute KILL [session_id] in SSMS to forcibly terminate the connection and roll back the stack.
  • Restart the SQL Server (MSSQLSERVER) service via the Services console (services.msc) on Windows Server 2025 if KILL does not release the session within 30 seconds.
  • Clear the application-side connection pool (e.g., restarting the IIS Application Pool on Windows 11/Server 2025) to ensure a fresh, zero-trancount connection is established on the next request.

Step 4: Implement Trancount Safeguards

  • Add a SET XACT_ABORT ON statement at the beginning of critical stored procedures to ensure automatic rollback on error, preventing the transaction count from climbing due to unhandled exceptions.
  • Deploy a scheduled SQL Agent Job that runs the sys.dm_tran_session_transactions query hourly to alert administrators via Database Mail if any session’s trancount exceeds a safe threshold (e.g., 50).

Alternative or Verification Steps

  • Verification: After deploying the code fix, run SELECT @@TRANCOUNT immediately after executing the specific stored procedure in a test environment; the result should return to 0 after the transaction logic completes.
  • Alternative: If the root cause remains elusive, enable a server-side trace or Extended Events session filtering on the sqlserver.error_reported event where error_number = 3905 to capture the exact T-SQL batch text in real-time for deeper analysis.

How to fix Error 3904 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3904 — “Cannot unsplit logical page %S_PGID in object”

Why This Error Happens

Error 3904 occurs when SQL Server’s recovery process attempts to merge (unsplit) a page that was split during a logical operation, but the page chain metadata is inconsistent or corrupted. This typically happens due to physical database corruption caused by faulty storage hardware, improper shutdowns, or a bug in page-split logging during a transaction rollback. It frequently surfaces during database recovery, DBCC CHECKDB operations, or when restoring from a backup that was taken while the page structure was in an inconsistent state.

Step-by-Step Resolution Guide

Step 1: Run DBCC CHECKDB to Assess the Damage

  • Open SQL Server Management Studio (SSMS) or sqlcmd on your Windows Server 2025 / Windows 11 instance.
  • Execute: DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for the specific page ID and object ID referenced in the error (%S_PGID and object name).
  • Note whether the error is isolated to one index/table or widespread across the database.

Step 2: Check Underlying Storage and Event Logs

  • Open Event Viewer (eventvwr.msc) and inspect the System and Application logs for disk, controller, or I/O subsystem errors around the time the corruption occurred.
  • Run chkdsk C:\ /f /r (adjust drive letter to your SQL data volume) during a maintenance window to rule out underlying disk corruption.
  • Verify storage drivers and firmware are up to date, especially on Windows Server 2025 with newer NVMe/SAN controllers.

Step 3: Restore from a Known Good Backup

  • Navigate to your backup directory, typically C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\.
  • Restore the last clean full backup, followed by applicable differential/log backups:
  • RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Backups\YourDatabaseName.bak' WITH NORECOVERY;
  • RESTORE LOG YourDatabaseName FROM DISK = 'C:\Backups\YourDatabaseName_log.trn' WITH RECOVERY;
  • Confirm the restored database no longer throws Error 3904 on the affected page.

Step 4: Repair with DBCC CHECKDB (If No Clean Backup Exists)

  • Put the database in single-user mode: ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Run the repair option: DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
  • Note that this option can result in data loss for the affected pages, so only use it as a last resort.
  • Set the database back to multi-user mode: ALTER DATABASE YourDatabaseName SET MULTI_USER;

Step 5: Rebuild Affected Indexes

  • Once the page-level corruption is resolved, rebuild indexes on the affected object to ensure structural integrity:
  • ALTER INDEX ALL ON YourTableName REBUILD;
  • This prevents recurrence of page-split issues tied to fragmented or stale index structures.

Alternative or Verification Steps

  • Re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; after remediation to confirm zero allocation or consistency errors are returned.
  • If corruption recurs frequently, consider engaging Microsoft Customer Support Services (CSS) for root-cause hardware diagnostics, and implement redundant storage (RAID) or move the database files to a more reliable disk subsystem.

How to fix Error 3902 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3902 — “The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION”

Why This Error Happens

This error occurs when a COMMIT TRANSACTION statement is executed but SQL Server’s internal transaction count (@@TRANCOUNT) is already at zero, meaning there is no open transaction to commit. It is typically caused by mismatched BEGIN TRANSACTION/COMMIT/ROLLBACK pairs in nested stored procedures, a prior ROLLBACK that already closed the transaction while subsequent code still attempts to commit it, or client-side connection pooling issues where leftover session state from a previous batch interferes with the current execution. In some cases, a corrupted or improperly deployed T-SQL script with asymmetric transaction blocks introduced during a deployment on Windows Server 2025 can also trigger this.

Step-by-Step Resolution Guide

Step 1: Audit the Transaction Block Logic

  • Open the stored procedure, script, or application code that triggered Error 3902 in SQL Server Management Studio (SSMS).
  • Check for every BEGIN TRANSACTION and confirm there is a matching COMMIT or ROLLBACK.
  • Pay special attention to nested procedures — a ROLLBACK inside an inner procedure reduces @@TRANCOUNT to 0, causing the outer COMMIT to fail.
  • Run the following to check active transaction state during debugging:
SELECT @@TRANCOUNT AS CurrentTransactionCount;

Step 2: Insert Transaction Count Validation Checks

  • Wrap commit logic in a conditional check to prevent orphaned commits:
IF @@TRANCOUNT > 0
BEGIN
    COMMIT TRANSACTION;
END
  • For nested procedures, use SAVE TRANSACTION savepoints instead of multiple BEGIN TRANSACTION calls.
  • Ensure TRY...CATCH blocks explicitly check XACT_STATE() before issuing a COMMIT or ROLLBACK.

Step 3: Review Application/Driver-Level Connection Handling

  • On Windows Server 2025 or Windows 11 clients, open ODBC Data Source Administrator (odbcad32.exe) and verify the SQL Server driver version is up to date (SQL Server Native Client 11.0 or the Microsoft OLE DB Driver 19+).
  • Check application connection pooling settings — a reused pooled connection may carry over an unexpected transaction state from a previous session.
  • Disable MARS (Multiple Active Result Sets) temporarily if your application logic relies on sequential transaction commands, as MARS can sometimes desynchronize transaction scopes.

Step 4: Enable Trace Flags for Deeper Diagnosis

  • Use Trace Flag 3609 only in isolated test environments to observe transaction state behavior without halting commits.
  • Enable extended events to capture sqlserver.error_reported filtered on Error 3902:
CREATE EVENT SESSION TrackError3902 ON SERVER
ADD EVENT sqlserver.error_reported
(WHERE sqlserver.error_reported.error_number = 3902)
ADD TARGET package0.event_file(SET filename = 'Error3902Trace.xel');
GO
ALTER EVENT SESSION TrackError3902 ON SERVER STATE = START;
  • Review the captured .xel file in SSMS under Management > Extended Events to pinpoint the exact query batch causing the mismatch.

Alternative or Verification Steps

  • Re-run the affected stored procedure or transaction batch in SSMS and confirm @@TRANCOUNT returns to 0 after execution without errors.
  • If the issue persists after code review, roll back to the last known working version of the script/deployment package and redeploy using SQL Server Data Tools (SSDT) to avoid manual script execution errors.

How to fix Error 3903 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3903 — “The ROLLBACK TRANSACTION Request Has No Corresponding BEGIN TRANSACTION”

Why This Error Happens

This error occurs when a ROLLBACK TRANSACTION statement executes without a matching active transaction (@@TRANCOUNT = 0) in the current session scope. It is typically caused by mismatched BEGIN...COMMIT...ROLLBACK logic in stored procedures, nested transactions that were already committed or rolled back earlier, or a TRY...CATCH block attempting to roll back after a transaction was auto-terminated by a prior error (e.g., with XACT_ABORT ON). In Microsoft SQL Server 2025, this can also surface due to connection pooling reusing a session where transaction state wasn’t properly reset by the client application.

Step-by-Step Resolution Guide

Step 1: Audit the Transaction Block Logic in the Failing Script/Procedure

  • Open the stored procedure or T-SQL script in SQL Server Management Studio (SSMS) 21 or Azure Data Studio.
  • Search for every BEGIN TRANSACTION, COMMIT, and ROLLBACK keyword and manually trace the logical flow to find unbalanced pairs.
  • Pay close attention to early RETURN statements inside IF blocks that might skip a COMMIT but leave a ROLLBACK reachable later.

Step 2: Check @@TRANCOUNT Before Rolling Back

  • Modify the CATCH block to verify an active transaction exists before issuing the rollback.
  • Use the following conditional pattern:
  IF @@TRANCOUNT > 0
      ROLLBACK TRANSACTION;
  • Deploy this change via sqlcmd -S localhost -d YourDB -i FixedProcedure.sql or redeploy the project via SSDT.

Step 3: Verify XACTABORT and XACTSTATE Settings

  • Add SET XACT_ABORT ON; at the top of the procedure to ensure SQL Server automatically terminates and rolls back a transaction on a runtime error, preventing orphaned “doomed” transactions.
  • Inside the CATCH block, check XACT_STATE() to distinguish between an active transaction (1), a doomed transaction (-1), and no transaction (0).
  • Example check: IF (XACT_STATE()) = -1 ROLLBACK TRANSACTION;

Step 4: Restart the SQL Server Service to Clear Session State

  • If the error persists due to a corrupted connection pool state on Windows Server 2025, open Services.msc.
  • Locate SQL Server (MSSQLSERVER) or your specific named instance.
  • Right-click and select Restart to clear all active session variables and orphaned connections.

Alternative or Verification Steps

  • Verify the Fix: Run the updated stored procedure in a new query window and force an error mid-transaction to confirm the CATCH block exits gracefully without throwing Error 3903.
  • Alternative Check: If the error originates from an application (e.g., .NET or Python), ensure the connection string does not have Enlist=true combined with conflicting TransactionScope objects in the C# code, as this can cause the client to send a rollback for a transaction the server already closed.

How to fix Error 3901 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3901 — “The transaction name must be specified when it is used with the mark option”

Why This Error Happens

This error occurs when a BEGIN TRANSACTION statement includes the WITH MARK option but omits the required transaction name. SQL Server mandates a named transaction when using WITH MARK because the name is stored in the msdb log history and is required for point-in-time recovery operations. This is typically caused by a malformed Transact-SQL script, a legacy application template, or a copy-paste error in a stored procedure or migration script.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Script or Procedure

  • Review the SQL Server error log or SSMS output pane to locate the exact batch that triggered Error 3901.
  • Check recently deployed stored procedures, SSIS packages, or scheduled Agent jobs for BEGIN TRANSACTION ... WITH MARK syntax.
  • Use sp_helptext on suspect stored procedures to inspect the raw transaction syntax.

Step 2: Correct the Transaction Syntax

  • Edit the script to include a quoted transaction name immediately before the WITH MARK clause.
  • Example of the corrected syntax:
  BEGIN TRANSACTION MyNamedTransaction WITH MARK 'Description of transaction purpose';
  • Ensure the transaction name does not exceed 32 characters, as SQL Server truncates or rejects longer names in some contexts.
  • Avoid using reserved keywords or special characters in the transaction name.

Step 3: Validate Dependent Jobs and Automation Scripts

  • Search SQL Server Agent job steps under SQL Server Agent > Jobs in SSMS for any legacy scripts using WITH MARK.
  • Check PowerShell or sqlcmd-based deployment scripts stored in C:\Scripts\ or your CI/CD pipeline repository for the same syntax issue.
  • Update version-controlled .sql files in source control (e.g., Git, Azure DevOps) to prevent the error from reappearing on next deployment.

Step 4: Redeploy and Test in a Non-Production Environment

  • Apply the corrected script to a test instance of SQL Server 2025 running on Windows Server 2025 or Windows 11 first.
  • Execute the transaction manually in SSMS to confirm no syntax errors are returned.
  • Promote the fix to production only after successful validation.

Alternative or Verification Steps

  • Run SELECT * FROM msdb.dbo.logmarkhistory WHERE name = 'MyNamedTransaction'; to confirm the named mark was successfully logged after the fix.
  • If the error persists, remove the WITH MARK clause entirely (if point-in-time marking isn’t strictly required) and use a standard BEGIN TRANSACTION MyNamedTransaction; statement as a quick workaround.

How to fix Error 3879 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3879 — Tiered Memory for Buffer Pool Started with Memory-Optimized Metadata

Why This Error Happens

This informational error occurs when SQL Server 2025 initializes the buffer pool using tiered memory (PMEM/Storage Class Memory combined with DRAM) while memory-optimized metadata is also enabled for system tables. The conflict typically arises because the tiered memory feature and memory-optimized tempdb metadata were both configured without validating hardware compatibility or NUMA node alignment. In most cases, this is triggered by a misconfigured -pmem startup parameter or outdated storage drivers that don’t correctly report persistent memory capacity to the Database Engine.

Step-by-Step Resolution Guide

Step 1: Verify Persistent Memory Hardware and Driver Configuration

  • Open PowerShell as Administrator and run Get-PmemDisk to confirm the persistent memory devices are recognized by Windows Server 2025.
  • Check Device Manager for outdated or missing NVDIMM/PMEM drivers and update them via Windows Update or OEM vendor packages.
  • Confirm BIOS/UEFI settings have App Direct Mode enabled for persistent memory rather than Memory Mode.

Step 2: Review SQL Server Startup Parameters

  • Open SQL Server Configuration Manager and navigate to SQL Server Services > right-click your instance > Properties > Startup Parameters.
  • Check for the presence of -pmem and ensure the path points to a valid, mounted persistent memory volume (e.g., -pmem=R:\PMemStore).
  • Remove or correct any invalid tiered memory path and restart the SQL Server service.

Step 3: Disable Conflicting Memory-Optimized Metadata Temporarily

  • Run the following T-SQL to check current configuration:
SELECT * FROM sys.dm_os_memory_cache_counters WHERE type = 'MEMORYCLERK_TIERED_MEMORY';
  • If tiered memory is incompatible with current metadata settings, disable memory-optimized tempdb metadata:
ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA = OFF;
  • Restart the SQL Server service for changes to take effect.

Step 4: Rebuild Tiered Memory Buffer Pool Extension

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\.
  • Delete or rename any orphaned .bpe (Buffer Pool Extension) files that may reference stale tiered memory paths.
  • Reconfigure the buffer pool extension using:
ALTER SERVER CONFIGURATION SET BUFFER POOL EXTENSION ON (FILENAME = 'R:\PMemStore\BPE.bpe', SIZE = 50GB);

Step 5: Apply Latest Cumulative Update

  • Download and install the latest SQL Server 2025 Cumulative Update (CU) from the Microsoft Update Catalog.
  • Run the installer with elevated privileges and select Repair if prompted for an existing instance.
  • Reboot Windows Server 2025 to finalize kernel-level memory driver changes.

Alternative or Verification Steps

  • After restarting the SQL Server service, check the SQL Server Error Log (ERRORLOG in the MSSQL\LOG directory) to confirm Error 3879 no longer appears during startup.
  • If the issue persists, run DBCC CHECKDB and sys.dm_os_sys_info to verify memory allocation is stable, or consider disabling tiered memory entirely via -pmem removal as a fallback until hardware compatibility is fully validated.

How to fix Error 3878 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3878 – Tiered Memory Memory-Optimized Configuration Change Requires Restart

Why This Error Happens

This informational error occurs because SQL Server 2025’s tiered memory feature for memory-optimized tables requires a server-level restart to apply changes to how memory-optimized data is distributed between DRAM and persistent memory (PMem) or secondary tiers. The configuration change is written to the registry or configuration metadata immediately, but the Storage Engine’s memory-optimized filegroup bindings are only re-initialized during SQL Server startup. Until the restart occurs, SQL Server continues operating under the previous tiered memory setting, which can cause confusion if administrators expect the change to be live immediately.

Step-by-Step Resolution Guide

Step 1: Confirm the Configuration Change Was Applied

  • Run EXEC sp_configure 'tiered memory optimization'; in SQL Server Management Studio (SSMS) to verify the new value is staged.
  • Check the SQL Server Error Log for the exact text of Error 3878 confirming the setting that was captured (%S_MSG will show either “enabled” or “disabled”).
  • Note the timestamp to ensure no conflicting configuration changes were made afterward.

Step 2: Schedule and Perform a Controlled Restart

  • On Windows Server 2025/Windows 11, open Services.msc and locate SQL Server (MSSQLSERVER) or the named instance.
  • Right-click and select Restart, or use PowerShell: Restart-Service -Name 'MSSQLSERVER' -Force.
  • Ensure any active transactions or Always On Availability Group failovers are accounted for before restarting in production.

Step 3: Validate Tiered Memory and PMem/Storage Tier Binding

  • After restart, confirm the physical storage path for the tiered memory-optimized filegroup is accessible (check sys.database_files and the PMem-aware NTFS/DAX volume mount points).
  • Verify Windows Server 2025 has the storage class memory driver (SCMBus/PMem driver) loaded correctly via Device Manager.
  • Confirm the SQL Server service account has read/write NTFS permissions on the tiered storage mount path (e.g., E:\SQLData\TieredMem).

Step 4: Re-check Server-Level Configuration Post-Restart

  • Run EXEC sp_configure 'tiered memory optimization'; again and confirm the run_value now matches the config_value.
  • Review the SQL Server Error Log to confirm no Error 3878 messages reappear on subsequent startups, indicating the setting is now stable.

Alternative or Verification Steps

  • Run SELECT * FROM sys.dm_db_xtp_memory_consumers; to confirm memory-optimized objects are now using the expected tiered memory allocation.
  • If the setting reverts after restart, verify no other process (such as a secondary DBA script, Group Policy, or Always On synchronization) is overwriting sp_configure values, and consider applying the change via a Policy-Based Management script to enforce consistency across replicas.

How to fix Error 3875 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3875 – Internal Resource Pool Cannot Be Used for tempdb

Why This Error Happens

Error 3875 occurs when the SQL Server Resource Governor attempts to associate tempdb with a classifier function or workload group that routes it to a user-defined resource pool instead of the mandatory internal pool. Since tempdb is a shared system database used by all sessions and internal engine operations, SQL Server 2025 enforces that it can only operate under the internal resource pool to guarantee unrestricted access to memory and CPU scheduling. This conflict typically arises from a misconfigured classifier function, a corrupted Resource Governor configuration, or an improperly applied workload group policy pushed through a recent Group Policy or SQL Server configuration script on Windows Server 2025.

Step-by-Step Resolution Guide

Step 1: Verify Current Resource Governor Configuration

  • Open SQL Server Management Studio (SSMS) and connect via the Dedicated Admin Connection (DAC) using ADMIN:ServerName.
  • Run the following query to inspect pool assignments:
  SELECT * FROM sys.resource_governor_resource_pools;
  SELECT * FROM sys.resource_governor_workload_groups;
  • Confirm whether tempdb-related sessions are being misclassified into a non-internal pool.

Step 2: Disable or Correct the Classifier Function

  • Locate the custom classifier function under Databases > master > Programmability > Functions.
  • Temporarily disable it to isolate the issue:
  ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = NULL);
  ALTER RESOURCE GOVERNOR RECONFIGURE;
  • If a custom function is required, edit it to explicitly exclude system sessions (session_id <= 50) from being routed away from the internal pool.

Step 3: Reset Resource Governor to Default State

  • If corruption is suspected, fully disable Resource Governor:
  ALTER RESOURCE GOVERNOR DISABLE;
  • Restart the SQL Server service via services.msc or PowerShell:
  Restart-Service -Name 'MSSQLSERVER' -Force
  • Re-enable Resource Governor only after confirming tempdb initializes correctly under the internal pool.

Step 4: Check tempdb File Configuration and Permissions

  • Navigate to the tempdb data file path (commonly C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).
  • Ensure the SQL Server service account has Full Control permissions on this directory.
  • Validate there are no orphaned or corrupted .mdf/.ldf files causing initialization conflicts with resource pool binding.

Alternative or Verification Steps

  • After applying fixes, run SELECT DB_NAME(database_id), * FROM sys.dm_exec_requests WHERE database_id = 2; to confirm tempdb sessions are now scheduled under the internal resource pool without errors.
  • If the error persists, perform a tempdb rebuild using SQL Server Configuration Manager by relocating the tempdb files to a new path and restarting the service, which forces a clean re-initialization of internal resource bindings.

How to fix Error 3876 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3876 occurs because Microsoft SQL Server 2025 enforces a hard architectural restriction: tempdb cannot be assigned to any Resource Governor pool other than the built-in internal pool. This happens because tempdb is a shared, instance-wide system resource used simultaneously by every session, background task, and internal engine operation, so isolating it to a single workload-specific pool would create resource contention and unpredictable behavior across the instance. The error is typically triggered when an administrator manually runs ALTER DATABASE tempdb MODIFY ... WITH (RESOURCE_POOL = 'poolname') or applies a classifier function that attempts to route tempdb-related connections into a custom pool.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Command or Script

  • Review the T-SQL script, deployment pipeline, or third-party tool that issued the ALTER DATABASE or ALTER RESOURCE GOVERNOR statement.
  • Run the following to check recent errors in the log:
  EXEC sp_readerrorlog 0, 1, 'Resource pool';
  • Confirm the exact statement attempting to bind tempdb to a non-internal pool.

Step 2: Remove the Invalid Resource Pool Assignment

  • Do not attempt to force tempdb into a custom pool — this is unsupported by design.
  • If using a classifier function for Resource Governor, inspect it and ensure tempdb-related logins/sessions are excluded:
  SELECT * FROM sys.dm_resource_governor_resource_pools;
  • Edit or drop the classifier function if it misroutes system sessions:
  ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = NULL);
  ALTER RESOURCE GOVERNOR RECONFIGURE;

Step 3: Correctly Configure tempdb Resource Settings

  • Instead of assigning a resource pool, manage tempdb performance via its own configuration options in SSMS:
  • Right-click the instance → Properties → Database Settings tab → adjust tempdb data/log file counts and autogrowth.
  • For file-level tuning, use:
  ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, SIZE = 512MB, FILEGROWTH = 128MB);
  • Leave the resource pool association untouched; SQL Server will automatically keep tempdb on internal.

Step 4: Reconfigure Resource Governor Properly

  • If multiple workloads need isolation, create resource pools for user workloads only — never for tempdb:
  CREATE RESOURCE POOL AppPool WITH (MAX_CPU_PERCENT = 50);
  ALTER RESOURCE GOVERNOR RECONFIGURE;
  • Validate pool assignments apply only to user sessions, not system databases.

Alternative or Verification Steps

  • Run SELECT name, is_system FROM sys.databases WHERE name = 'tempdb'; alongside sys.dm_resource_governor_resource_pools to confirm tempdb remains tied to the internal pool with no errors on restart.
  • If the error persists after script changes, restart the SQL Server service and re-check the error log (sp_readerrorlog) to ensure no startup script or Agent job is re-applying the invalid pool assignment.

How to fix Error 3874 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3874 – Resource Pool Does Not Exist

Why This Error Happens

This error occurs when a SQL Server session, workload group, or classifier function references a Resource Governor resource pool that has either been dropped or not yet applied via ALTER RESOURCE GOVERNOR RECONFIGURE. It commonly happens after a DBA creates or modifies a resource pool configuration but forgets to reconfigure the Resource Governor, leaving the in-memory metadata out of sync with the system catalog. It can also occur if a workload group is left pointing to a pool name that was renamed or removed during a maintenance script execution.

Step-by-Step Resolution Guide

Step 1: Verify the Resource Pool Exists in the Catalog

  • Open SQL Server Management Studio (SSMS) or Azure Data Studio connected to your SQL Server 2025 instance.
  • Run the following query to check existing pools:
  SELECT * FROM sys.resource_governor_resource_pools;
  • Confirm the pool name referenced in the error message actually exists in this output.

Step 2: Reconfigure the Resource Governor

  • If the pool exists but SQL Server is still throwing the error, the in-memory configuration is likely stale.
  • Run the reconfiguration command to apply pending changes:
  ALTER RESOURCE GOVERNOR RECONFIGURE;
  • This forces SQL Server 2025 to sync the active configuration with the pending changes in sys.resource_governor_configuration.

Step 3: Recreate the Missing Resource Pool

  • If the pool genuinely does not exist (was dropped or never created), recreate it manually:
  CREATE RESOURCE POOL [YourPoolName]
  WITH (MIN_CPU_PERCENT = 0, MAX_CPU_PERCENT = 100);
  GO
  ALTER RESOURCE GOVERNOR RECONFIGURE;
  GO
  • Ensure the workload group mapping is also updated to point to the correct pool name:
  ALTER WORKLOAD GROUP [YourWorkloadGroup] USING [YourPoolName];
  ALTER RESOURCE GOVERNOR RECONFIGURE;

Step 4: Check Classifier Function Logic

  • Open the classifier user-defined function (UDF) assigned to Resource Governor.
  • Confirm it does not hardcode a resource pool/workload group name that was deleted or renamed.
  • Update the function logic and redeploy if a stale reference is found:
  ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = dbo.YourClassifierFunction);
  ALTER RESOURCE GOVERNOR RECONFIGURE;

Step 5: Restart the SQL Server Service (If Necessary)

  • On Windows Server 2025 / Windows 11, open Services.msc.
  • Locate SQL Server (MSSQLSERVER) or your named instance.
  • Right-click and select Restart to fully clear any cached Resource Governor metadata if reconfiguration alone does not resolve it.

Alternative or Verification Steps

  • Run SELECT * FROM sys.dm_resource_governor_resource_pools; to confirm the pool is now active in the live Resource Governor state and matches your catalog configuration.
  • If the error persists after recreating the pool and reconfiguring, disable Resource Governor temporarily with ALTER RESOURCE GOVERNOR DISABLE;, then re-enable it after validating all pool/workload group definitions are consistent.

How to fix Error 3873 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3873 is typically raised when SQL Server 2025 initializes the Hybrid Buffer Pool feature on a database that contains memory-optimized filegroups or metadata-only memory-optimized objects. This occurs because the MEMORY_OPTIMIZED_DATA filegroup exists but the engine detects that persisted memory-optimized tables are limited to schema-only or metadata structures, triggering a hybrid paging state instead of a fully resident in-memory OLTP configuration. It is often accompanied by misconfigured hybrid_buffer_pool database-scoped configurations or insufficient buffer pool memory allocation on the host.

Step-by-Step Resolution Guide

Step 1: Verify Hybrid Buffer Pool Configuration State

  • Open SQL Server Management Studio (SSMS) or Azure Data Studio connected to the SQL Server 2025 instance.
  • Run the following query to check the current scoped configuration:
  SELECT name, value, value_for_secondary 
  FROM sys.database_scoped_configurations 
  WHERE name = 'HYBRID_BUFFER_POOL';
  • Confirm whether the value is set to 1 (ON) unintentionally for a database with minimal memory-optimized workload.

Step 2: Adjust Database-Scoped Configuration

  • If hybrid buffer pooling is not required for your workload, disable it explicitly at the database level:
  ALTER DATABASE SCOPED CONFIGURATION SET HYBRID_BUFFER_POOL = OFF;
  • Apply the change and restart the specific user database context (not the full instance) using:
  ALTER DATABASE [YourDatabaseName] SET OFFLINE;
  ALTER DATABASE [YourDatabaseName] SET ONLINE;

Step 3: Validate Memory-Optimized Filegroup Paths

  • Navigate to the physical file path defined for the MEMORY_OPTIMIZED_DATA filegroup (commonly under C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).
  • Ensure the folder is not pointing to a network share or a drive with restricted I/O, as this can force the engine into a hybrid fallback state.
  • Confirm the Windows Server 2025 service account (NT Service\MSSQLSERVER or custom domain account) has Full Control permissions on this directory via File Explorer > Properties > Security.

Step 4: Restart the SQL Server Service

  • Open Services.msc on Windows Server 2025 or Windows 11.
  • Locate SQL Server (MSSQLSERVER), right-click, and select Restart.
  • Monitor the SQL Server Error Log immediately after restart to confirm Error 3873 does not recur during database recovery.

Alternative or Verification Steps

  • To verify the fix, re-run the sys.database_scoped_configurations query from Step 1 and confirm HYBRID_BUFFER_POOL reflects the intended value (OFF or ON as required) with no corresponding entry in the SQL Server Error Log upon the next database startup.
  • If the message persists despite configuration changes, treat it as informational rather than a failure state—Error 3873 is often logged as a benign status notification confirming hybrid memory handling is active, and can be safely filtered out of Event Viewer alerts if the hybrid buffer pool behavior is intentional for your workload.

How to fix Error 3872 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3872 – Hybrid Buffer Pool Memory-Optimized Configuration Change

Why This Error Happens

This message appears when a database administrator (or an automated script) changes the HYBRID_BUFFER_POOL server configuration setting using sp_configure or ALTER SERVER CONFIGURATION. SQL Server 2025 requires this specific setting to be loaded during the initial boot sequence because it directly affects how the Buffer Pool Extension (BPE) interacts with Persistent Memory (PMEM) or standard storage media. Since this is a static, instance-level configuration, SQL Server cannot “hot-swap” the memory architecture while the engine is online, resulting in Error 3872 as a notification that a restart is mandatory.

Step-by-Step Resolution Guide

Step 1: Verify the Current Configuration State

  • Open SQL Server Management Studio (SSMS) or Azure Data Studio connected to your instance.
  • Run the following query to check the pending vs. running value:
  SELECT name, value, value_in_use 
  FROM sys.configurations 
  WHERE name = 'hybrid_buffer_pool';
  • Confirm that value (pending) does not match value_in_use (active), which validates that a restart is required.

Step 2: Check Hardware and OS Compatibility

  • Ensure the underlying Windows Server 2025 or Windows 11 host actually has Persistent Memory (PMEM) modules installed and configured in App Direct Mode if you are enabling this feature.
  • If PMEM hardware is absent, verify you intended to enable Hybrid Buffer Pool for standard NVMe/SSD storage, as the behavior and memory ceiling differ between hardware types.
  • Check the SQL Server Error Log for any conflicting memory allocation warnings that occurred prior to the change.

Step 3: Restart the SQL Server Service

  • Open the Services console (services.msc) on the Windows Server 2025 host.
  • Locate the specific instance (e.g., SQL Server (MSSQLSERVER) or a named instance).
  • Right-click and select Restart.
  • Note: For production environments, ensure you have scheduled a maintenance window, as this will interrupt active connections.
  • Alternatively, use PowerShell for a scripted restart:
  Restart-Service -Name 'MSSQLSERVER' -Force

Step 4: Validate Post-Restart Memory Allocation

  • Once the service is back online, check the SQL Server Error Log immediately following startup.
  • Look for a confirmation message indicating that Hybrid Buffer Pool has been successfully enabled or disabled for the specific memory-optimized filegroups.

Alternative or Verification Steps

  • Verification: Re-run the sys.configurations query from Step 1. If the fix was successful, the value and value_in_use columns should now be identical (matching your desired setting).
  • Alternative: If the setting fails to persist after a restart, check for Group Policy or Windows Server power-saving settings that might be interfering with PMEM memory mapping, and ensure the SQL Server service account has the necessary “Lock Pages in Memory” permission via the Local Security Policy editor (secpol.msc).

How to fix Error 3871 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3871 is logged when SQL Server 2025 initializes tempdb using the Memory-Optimized TempDB Metadata feature, which moves system metadata tables (like DMVs tracking session and transaction info) into lock-free, latch-free memory-optimized structures. This typically occurs because trace flag 49993 is enabled globally, or because the MEMORY_OPTIMIZED = ON configuration was explicitly set via ALTER SERVER CONFIGURATION. While this message is often informational and indicates improved performance under high concurrency, it can surface as an unexpected error if the feature was enabled unintentionally, or if downstream monitoring scripts/third-party tools aren’t compatible with the altered system catalog behavior.

Step-by-Step Resolution Guide

Step 1: Confirm the Current TempDB Configuration State

  • Open SQL Server Management Studio (SSMS) and connect to the instance.
  • Run the following query to check if the feature is active:
  SELECT SERVERPROPERTY('IsTempdbMetadataMemoryOptimized') AS IsMemoryOptimized;
  • A return value of 1 confirms the feature is enabled and is the direct cause of Event 3871.

Step 2: Review Trace Flags and Startup Parameters

  • Check SQL Server Configuration Manager (via Windows Server 2025 or Windows 11) under SQL Server Services > Properties > Startup Parameters.
  • Look for -T49993 listed as an active trace flag.
  • If present and unintended, remove the trace flag entry from the startup parameters list.

Step 3: Disable Memory-Optimized Metadata (If Unwanted)

  • If the feature was enabled deliberately via T-SQL rather than a trace flag, disable it with:
  ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA = OFF;
  • Note: This change requires a full restart of the SQL Server service to take effect, as tempdb is rebuilt at every startup.
  • Restart via PowerShell: Restart-Service -Name 'MSSQLSERVER'

Step 4: Validate File Paths and Permissions for TempDB

  • Navigate to the default tempdb path (e.g., C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA).
  • Ensure the SQL Server Service Account has Full Control (Read/Write/Modify) permissions on this directory to prevent corruption during the memory-optimized filegroup creation process.
  • If permissions were recently changed by Group Policy on Windows Server 2025, re-apply the local security policy for the SQL service account.

Alternative or Verification Steps

  • Verify the Fix: After restarting the service, re-run SELECT SERVERPROPERTY('IsTempdbMetadataMemoryOptimized');. If you disabled the feature in Step 3, this should now return 0, and Event ID 3871 should no longer appear in the SQL Server Error Log upon restart.
  • Alternative Solution: If the error persists despite disabling the server configuration, check for a lingering model database corruption issue, as tempdb inherits its initial structure from model. Running DBCC CHECKDB on the model database can rule out underlying corruption forcing the fallback behavior.

How to fix Error 3869 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3869 is typically a benign informational message generated during SQL Server startup when the Memory-Optimized Data Filegroup configuration is validated against the resource pool settings. This message appears when SQL Server 2025 checks the Hekaton (In-Memory OLTP) engine state and confirms that the existing checkpoint file pairs (CFPs) and container bindings already match the expected configuration, meaning no schema or storage changes are required. While not a true error, it can repeatedly populate the SQL Server Error Log if verbose logging is enabled, causing confusion during audits or monitoring scans on Windows Server 2025.

Step-by-Step Resolution Guide

Step 1: Confirm the Message Severity in SQL Server Logs

  • Open SQL Server Management Studio (SSMS) and navigate to Management > SQL Server Logs.
  • Filter for Event ID 3869 and confirm the severity level is 10 (informational), not 16 or higher.
  • Run EXEC sp_readerrorlog 0, 1, 'memory-optimized'; to isolate the exact log entries.

Step 2: Validate the Memory-Optimized Filegroup Configuration

  • Execute the following query to check the current state of your memory-optimized filegroups:
  • SELECT name, type_desc FROM sys.filegroups WHERE type = 'FX';
  • Ensure the container path exists on disk (e.g., C:\SQLData\MemoryOptimized\) and that the Windows Server 2025 service account has Full Control permissions on that directory.

Step 3: Suppress Redundant Logging (If Message is Recurring)

  • Open SQL Server Configuration Manager and locate the SQL Server (MSSQLSERVER) service properties.
  • Under the Startup Parameters tab, verify trace flag -T3459 (if present) is not causing excessive Hekaton validation logging.
  • Remove unnecessary trace flags related to In-Memory OLTP diagnostics and restart the SQL Server service via net stop MSSQLSERVER && net start MSSQLSERVER.

Step 4: Rebuild the Resource Pool Bindings (If Configuration Drift is Suspected)

  • Run ALTER RESOURCE POOL [default] WITH (MIN_MEMORY_PERCENT = 0, MAX_MEMORY_PERCENT = 100); followed by ALTER RESOURCE GOVERNOR RECONFIGURE;
  • This forces SQL Server to re-evaluate and rebind the memory-optimized filegroup to the correct resource pool, clearing any stale configuration flags.

Alternative or Verification Steps

  • Verify the fix by restarting the SQL Server instance and checking the Error Log again for Event ID 3869 — it should either not reappear or appear only once at startup without any follow-up errors (e.g., 41342 or 41316).
  • If the message persists excessively, use Windows Event Viewer (Applications and Services Logs > MSSQLSERVER) to cross-reference whether a third-party backup or monitoring agent is repeatedly triggering a filegroup validation check.

How to fix Error 3870 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3870 – TempDB Metadata Memory-Optimized Configuration Change Pending

Why This Error Happens

This message appears when an administrator enables or disables the tempdb metadata memory-optimized feature using ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA, but the change requires a full SQL Server service restart to take effect. The setting is stored in a pending state within the server configuration metadata and SQL Server cannot dynamically re-initialize the tempdb system catalogs or memory-optimized filegroup structures while the instance is online. Until a restart occurs, SQL Server continues operating under the old tempdb configuration, which can cause confusion if administrators expect the change to be immediate.

Step-by-Step Resolution Guide

Step 1: Confirm the Pending Configuration Change

  • Run the following query to check the current and pending state:
  • SELECT SERVERPROPERTY('IsTempdbMetadataMemoryOptimized');
  • Also check sys.configurations or the error log for confirmation that the change was staged correctly.
  • Ensure no typos or incorrect values were passed in the original ALTER SERVER CONFIGURATION statement.

Step 2: Schedule and Perform a SQL Server Service Restart

  • On Windows Server 2025 / Windows 11, open SQL Server Configuration Manager.
  • Navigate to SQL Server Services, right-click your instance (e.g., SQL Server (MSSQLSERVER)), and select Restart.
  • Alternatively, use PowerShell with elevated privileges:
  • Restart-Service -Name 'MSSQLSERVER' -Force
  • If using a named instance, replace MSSQLSERVER with MSSQL$<InstanceName>.

Step 3: Validate TempDB Initialization Post-Restart

  • After the service restarts, confirm SQL Server successfully initializes tempdb metadata in memory-optimized mode.
  • Check the SQL Server Error Log (via SSMS or C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for confirmation messages indicating tempdb started correctly.
  • Look for any additional errors (e.g., insufficient memory grant pool or XTP filegroup misconfiguration) that may block memory-optimized tempdb activation.

Step 4: Re-Verify Server Configuration Setting

  • Re-run the SERVERPROPERTY('IsTempdbMetadataMemoryOptimized') query to ensure the value now reflects 1 (enabled) or 0 (disabled) as intended.
  • If the setting still shows a pending state, confirm there isn’t a cluster failover or Always On Availability Group delaying propagation on all replicas.

Alternative or Verification Steps

  • Verify success by querying sys.dm_db_file_space_usage and sys.database_files to ensure tempdb memory-optimized metadata objects are correctly created and accessible.
  • If the restart doesn’t resolve the issue, check for conflicting Group Policy restart delays or pending Windows Updates on Windows Server 2025 that may prevent the SQL Server service from fully reinitializing.

How to fix Error 3868 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3868 – Failed to Start tempdb Metadata Memory-Optimized Mode

Why This Error Happens

This error occurs when SQL Server 2025 attempts to initialize tempdb in memory-optimized metadata mode but fails due to insufficient memory allocation, a corrupted or locked model/tempdb system file, or inadequate permissions on the SQL Server service account to access the configured data directories. It can also happen if the server was abruptly restarted or crashed during a previous attempt to enable this feature, leaving the configuration in a partially applied state. SQL Server gracefully falls back to standard SQL-based tempdb startup to keep the instance available, but the memory-optimized configuration must be manually re-applied.

Step-by-Step Resolution Guide

Step 1: Verify SQL Server Service Account Permissions

  • Open Services.msc on Windows Server 2025 / Windows 11 and confirm the account running the “SQL Server (MSSQLSERVER)” service.
  • Ensure this account has Full Control on the tempdb data/log file directories (typically C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA).
  • Right-click the folder, go to Properties > Security, and add the service account if missing.

Step 2: Check Available System Memory and Resource Governor Settings

  • Memory-optimized tempdb metadata requires sufficient free memory at startup; confirm the server has adequate RAM headroom (at least 2–4 GB free beyond SQL Server’s max memory cap).
  • Run the following query to check current memory configuration:
EXEC sp_configure 'max server memory';
  • If memory is constrained, lower max server memory (MB) via sp_configure and restart the SQL Server service to free up room for tempdb initialization.

Step 3: Re-run the ALTER SERVER CONFIGURATION Command

  • Open a new query window in SQL Server Management Studio (SSMS) connected via a Dedicated Admin Connection (DAC) if the instance is unstable.
  • Execute the command again exactly as prompted:
ALTER SERVER CONFIGURATION SET TEMPDB METADATA = MEMORY_OPTIMIZED;
  • Restart the SQL Server service through SQL Server Configuration Manager (not just via Services.msc) to ensure startup parameters reload correctly.

Step 4: Inspect the SQL Server Error Log for Underlying Failures

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Search for entries immediately preceding Error 3868, such as “Could not allocate space” or “Access is denied,” which indicate the specific blocking cause.
  • Resolve any referenced file-lock or disk-space issues (ensure at least 10% free space on the tempdb volume) before retrying Step 3.

Step 5: Rebuild tempdb Configuration via Startup Parameters (If Repeated Failures Persist)

  • Open SQL Server Configuration Manager > SQL Server Services, right-click the instance, and select Properties > Startup Parameters.
  • Temporarily remove any custom trace flags related to tempdb (e.g., -T174 or similar) that may conflict with memory-optimized initialization.
  • Restart the service and re-attempt the ALTER SERVER CONFIGURATION command from Step 3.

Alternative or Verification Steps

  • Verify success by running SELECT SERVERPROPERTY('IsTempdbMetadataMemoryOptimized'); — a return value of 1 confirms the feature is active.
  • If the issue persists after multiple attempts, disable the feature entirely with ALTER SERVER CONFIGURATION SET TEMPDB METADATA = NON_MEMORY_OPTIMIZED; and restart, then re-enable it only after confirming memory and disk prerequisites are fully met.

How to fix Error 3867 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3867 – FileTable System Defined Constraints Cannot Be Modified

Why This Error Happens

This error occurs because SQL Server automatically creates system-defined constraints (such as unique constraints on stream_id, path_locator, and name) when the FILETABLE_NAMESPACE option is enabled on a FileTable. These system constraints are locked and cannot be dropped, altered, or recreated while the table is actively functioning as a FileTable, since doing so would compromise the integrity of the Windows-compatible directory and file namespace that SQL Server maintains internally. Attempting to run an ALTER TABLE statement that touches these constraints—even indirectly through a script that rebuilds all constraints—triggers Error 3867 because only user-defined constraints are permitted to be modified in this state.

Step-by-Step Resolution Guide

Step 1: Identify the Constraint Causing the Conflict

  • Run the following query to list all constraints on the FileTable and determine which ones are system-generated:
SELECT name, type_desc, is_system_named 
FROM sys.objects 
WHERE parent_object_id = OBJECT_ID('YourFileTableName') 
AND type IN ('UQ','PK','C');
  • Confirm whether the constraint you are trying to modify is user-defined or system-defined (system-defined names typically start with FileTableUniqueConstraint or FileTablePrimaryKeyConstraint).

Step 2: Temporarily Disable the FILETABLE_NAMESPACE Option

  • Open SQL Server Management Studio (SSMS) and connect to your Windows Server 2025 instance.
  • Execute the following command to disable the namespace, which unlocks the system constraints for modification:
ALTER TABLE YourFileTableName SET (FILETABLE_NAMESPACE = OFF);
  • Verify no active file handles are open via Windows Explorer or the FileTable share path (e.g., \\ServerName\MSSQLSERVER\YourFileTableName) before proceeding, as open handles will block this operation.

Step 3: Apply Your Schema Changes

  • With the namespace disabled, make your required modifications strictly to user-defined constraints only (do not attempt to alter the system constraints even now, as this will corrupt the FileTable structure).
  • If your original intent was to modify system behavior (e.g., path length or collation), note that this requires dropping and recreating the FileTable entirely rather than altering constraints.

Step 4: Re-enable the FILETABLE_NAMESPACE Option

  • Once your changes are complete, restore full FileTable functionality by running:
ALTER TABLE YourFileTableName SET (FILETABLE_NAMESPACE = ON);
  • Check the SQL Server Error Log (via SSMS or C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) to confirm the namespace re-enabled successfully without secondary errors.

Alternative or Verification Steps

  • Verification: Query sys.filetables and confirm the is_enabled column returns 1, then test file upload/retrieval via the FileTable’s UNC share path to ensure Windows API access is fully restored.
  • Alternative: If constraints need permanent structural changes (not just toggling), export the file data, drop the FileTable entirely using DROP TABLE, and recreate it with the corrected schema definition from scratch, then re-import the files.

How to fix Error 3866 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3866 — FileTable System Object Trace Flag Warning

Why This Error Happens

This informational message appears when a trace flag (typically 1448 or related FileTable diagnostic flags) has been enabled on the SQL Server instance, allowing operations on FileTable system-defined objects that would otherwise be blocked. This usually occurs after a DBA enables trace flags for maintenance, migration, or troubleshooting purposes on FileTable-enabled databases and forgets to disable them afterward. While not a critical failure, it indicates that normal FileTable integrity checks are being bypassed, which can lead to unexpected behavior if left unmanaged in a production environment.

Step-by-Step Resolution Guide

Step 1: Identify Active Trace Flags on the Instance

  • Open SQL Server Management Studio (SSMS) and connect to the SQL Server 2025 instance.
  • Run the following query to check globally enabled trace flags:
DBCC TRACESTATUS(-1);
  • Look specifically for trace flag 1448 (bypasses FileTable system object checks) in the result set.

Step 2: Disable the Trace Flag at the Session or Global Level

  • If the trace flag was enabled via startup parameters, navigate to SQL Server Configuration Manager on Windows Server 2025.
  • Go to SQL Server Services > [Your Instance] > Properties > Startup Parameters and remove any entry like -T1448.
  • If enabled dynamically, turn it off immediately using:
DBCC TRACEOFF (1448, -1);
  • Restart the SQL Server service for the change to take full effect if it was a startup parameter.

Step 3: Audit the SQL Server Error Log for Repeated Instances

  • Navigate to the default log path: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Search for repeated occurrences of “Error: 3866” to determine if this is a recurring scripted event or a one-time manual override.
  • If a maintenance script is triggering this intentionally (e.g., bulk import of files into FileTable), ensure the script explicitly toggles the trace flag off after execution completes.

Step 4: Validate FileTable Health and Permissions

  • Run a consistency check on the specific FileTable-enabled database to ensure no underlying corruption triggered the need for the trace flag initially:
DBCC CHECKTABLE('YourFileTableName');
  • Verify that the Windows service account running SQL Server has the correct NTFS permissions on the FileTable data directory, as misconfigured permissions sometimes force administrators to use trace flags as a workaround.

Alternative or Verification Steps

  • Verification: Re-run DBCC TRACESTATUS(-1); after a server restart. If the list returns empty (specifically for flag 1448), the global override has been successfully cleared, and Error 3866 should cease appearing in the logs.
  • Alternative: If the application logic specifically requires this trace flag to function (e.g., third-party backup tools), suppress the logging noise by using trace flag 3625 alongside it to limit informational logging verbosity, rather than leaving the system in a fully permissive state.

How to fix Error 3864 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3864 — Index Entry Not Found (Possible Schema Corruption)

Why This Error Happens

Error 3864 occurs when the SQL Server Storage Engine attempts to locate a non-clustered index entry that maps to a row in the base table, but the entry is missing or mismatched in the internal system metadata. This is typically caused by physical page-level corruption resulting from faulty I/O subsystems, abrupt power loss, or disk controller errors that silently wrote incomplete data pages. In rarer cases, it stems from a software bug or an improperly terminated transaction during an index rebuild operation, leaving the index B-tree structure out of sync with the underlying heap or clustered index.

Step-by-Step Resolution Guide

Step 1: Isolate the Database and Check Current State

  • Open SQL Server Management Studio (SSMS) or Azure Data Studio connected to the SQL Server 2025 instance.
  • Run ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; to prevent further writes during diagnosis.
  • Check the SQL Server Error Log (via EXEC sp_readerrorlog; or C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for related I/O warnings (Error 823/824) that may have preceded this event.

Step 2: Run DBCC CHECKDB for Full Diagnosis

  • Execute DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS, DATA_PURITY; to get a complete corruption report.
  • Pay close attention to the specific Object ID and Index ID referenced in the original Error 3864 message to confirm which table is affected.
  • Note whether the output recommends a REPAIR_ALLOW_DATA_LOSS or if the issue is isolated purely to a non-clustered index (which is safer to fix).

Step 3: Rebuild the Affected Non-Clustered Index

  • If the corruption is isolated to a non-clustered index (not the clustered index or heap), the fastest fix is simply to rebuild it rather than running a full repair.
  • Identify the index name using the Object ID/Index ID from the error via SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('TableName') AND index_id = <ID>;.
  • Run ALTER INDEX [IndexName] ON [dbo].[TableName] REBUILD WITH (ONLINE = OFF); to force SQL Server to drop and completely regenerate the index structure from scratch.

Step 4: Execute Repair Only if Rebuild Fails

  • If rebuilding the specific index does not resolve the DBCC errors, you may need to force a repair.
  • Set the database to single-user mode (if not already done in Step 1).
  • Run DBCC CHECKDB ('YourDB', REPAIR_REBUILD); first, as this is non-destructive and primarily targets index structures.
  • Only use REPAIR_ALLOW_DATA_LOSS as a last resort, as this command may deallocate corrupt pages and result in permanent loss of the specific rows involved.

Step 5: Restore Multi-User Access and Monitor Hardware

  • Run ALTER DATABASE [YourDB] SET MULTI_USER; to return the database to normal operational status.
  • Check Windows Server 2025 Event Viewer (System Logs) for underlying Disk or NTFS errors that might explain the root cause of the corruption.

Alternative or Verification Steps

  • Verification: Re-run DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS; after the rebuild/repair. If the command returns “0 allocation errors and 0 consistency errors,” the fix was successful.
  • Alternative: If corruption persists or spans multiple indexes/tables, the safest alternative is to restore the database from the last known good backup taken prior to the error, followed by applying transaction log backups to minimize data loss.

How to fix Error 3865 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3865 – FileTable System Object Modification Blocked

Why This Error Happens

This error occurs because SQL Server’s FileTable feature automatically generates and manages certain system-defined objects, such as the root directory structure and internal triggers, which are reserved exclusively for internal use. When a user, application, or script attempts to directly insert, update, or delete these protected system rows (rather than using the standard file/directory operations SQL Server expects), the engine blocks the action to preserve FileTable integrity. This commonly happens when custom T-SQL scripts, migration tools, or third-party applications try to manipulate FileTable metadata directly instead of treating it as a special-purpose table.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Query or Process

  • Check SQL Server error logs located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for the exact timestamp and session ID tied to Error 3865.
  • Run the following query to find the active session causing the issue:
  SELECT session_id, text 
  FROM sys.dm_exec_requests 
  CROSS APPLY sys.dm_exec_sql_text(sql_handle)
  WHERE session_id = <SPID>;
  • Confirm whether the query is attempting a direct INSERT, UPDATE, or DELETE on the FileTable’s root or system-generated rows.

Step 2: Correct the Application Logic or Script

  • Modify the script or application code to interact with FileTable data through standard file system operations (e.g., via the UNC path exposed by FileTable) instead of raw T-SQL DML statements on system columns.
  • Avoid directly modifying system-reserved columns such as path_locator, parent_path_locator, or the root directory entry (is_directory = 1 with a NULL parent).
  • If using an ORM or ETL tool (e.g., SSIS, Azure Data Factory), update the mapping to exclude FileTable system columns from write operations.

Step 3: Validate FileTable Configuration

  • Open SQL Server Management Studio (SSMS) and run:
  EXEC sp_configure 'filestream access level';
  • Ensure the value is set to 2 (full access). If not, reconfigure it:
  EXEC sp_configure 'filestream access level', 2;
  RECONFIGURE;
  • Restart the SQL Server service via services.msc or PowerShell:
  Restart-Service -Name 'MSSQLSERVER'

Step 4: Rebuild or Recreate the FileTable (If Corruption Is Suspected)

  • If the error persists despite correcting application logic, check for underlying corruption using:
  DBCC CHECKTABLE ('YourFileTableName') WITH ALL_ERRORMSGS;
  • If corruption is confirmed, export existing file data, drop the FileTable using DROP TABLE, and recreate it with the AS FILETABLE clause, then re-import the data through proper file system calls.

Alternative or Verification Steps

  • After applying fixes, test by performing a standard file copy/drag-and-drop operation into the FileTable’s shared folder path (\\<ServerName>\<InstanceShareName>\<FileTableName>) to confirm no errors occur.
  • If the issue persists, enable Extended Events tracing on error_reported filtered to error number 3865 to capture the exact query pattern for deeper driver or application-level debugging.

How to fix Error 3862 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3862 — CLR Type Disabled Due to On-Disk Format Change

Why This Error Happens

This error occurs when a CQRS/CLR user-defined type (UDT) was serialized to disk using an older version of its assembly, and a subsequent assembly update (via ALTER ASSEMBLY) changed the binary serialization format, rendering existing on-disk data incompatible. SQL Server disables the type to prevent data corruption or misinterpretation of the stored binary representation. This commonly happens after a CLR assembly redeployment, a Windows Server 2025 cumulative update, or an in-place upgrade where the underlying .NET CLR integration libraries were modified without first exporting dependent data.

Step-by-Step Resolution Guide

Step 1: Identify the Disabled Type and Dependent Objects

  • Run the following query to locate affected types:
  SELECT name, is_binary_format_disabled 
  FROM sys.types 
  WHERE is_binary_format_disabled = 1;
  • Check sys.assembly_types and sys.columns to find every table/column referencing this CLR type.
  • Note the schema and type name exactly as reported in Error 3862 (case-sensitive).

Step 2: Export Data Before Making Changes

  • Before dropping anything, export all affected column data to a staging table or flat file using BCP or SELECT INTO:
  SELECT * INTO dbo.Staging_CLRBackup FROM YourTable;
  • Verify row counts match the source table to confirm a complete backup.
  • Store the export on a separate volume (e.g., D:\SQLBackups\CLRExport\) in case rollback is needed.

Step 3: Drop and Recreate the Disabled Type

  • Remove all dependent columns/objects referencing the disabled type first.
  • Drop the type using:
  DROP TYPE dbo.YourCLRType;
  • Reload the correct assembly version using CREATE ASSEMBLY with WITH PERMISSION_SET = SAFE (or UNSAFE if required) from the validated .dll path, e.g., C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\.
  • Recreate the type with CREATE TYPE dbo.YourCLRType EXTERNAL NAME YourAssembly.[YourClass];.

Step 4: Restore Data and Rebuild Dependencies

  • Re-import the staged data from Step 2 into the newly created columns using the restored CLR type.
  • Recreate any indexes, constraints, or stored procedures that referenced the original type.
  • Run DBCC CHECKDB on the affected database to confirm structural integrity post-migration.

Alternative or Verification Steps

  • Verify the fix by re-running the sys.types query from Step 1 — the is_binary_format_disabled column should now return 0 for the type.
  • If data loss is unacceptable and the original assembly binary is unavailable, restore the database from a pre-upgrade backup taken before the ALTER ASSEMBLY operation, then reapply schema changes in a staged (non-production) environment first.

How to fix Error 3860 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3860 – “Cannot upgrade database ID 32767”

Why This Error Happens

Database ID 32767 is hard-reserved internally by the SQL Server engine for system snapshot operations (such as those used during DBCC CHECKDB) and is never meant to be assigned to a user database. This error typically surfaces during a version upgrade (e.g., migrating to SQL Server 2025) when the upgrade process detects a database, a snapshot, or orphaned metadata entry that has been incorrectly mapped to this reserved ID — often due to an improperly closed internal snapshot from a previous DBCC operation, a corrupted system catalog, or a failed prior upgrade attempt. Because the engine refuses to overwrite or reassign this protected ID, the upgrade process halts to prevent further catalog corruption.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Database or Snapshot

  • Connect to the instance using SQLCMD or SSMS in single-user mode if necessary: sqlcmd -S . -E -N
  • Run SELECT name, database_id, source_database_id FROM sys.databases WHERE database_id = 32767; to check for an orphaned entry.
  • Check for leftover internal snapshots using SELECT * FROM sys.databases WHERE source_database_id IS NOT NULL;

Step 2: Clear Orphaned Internal Snapshots

  • If a stale DBCC CHECKDB internal snapshot is found, it generally indicates a previous CHECKDB operation terminated abnormally (e.g., Windows Server 2025 crash or forced service restart).
  • Restart the SQL Server service cleanly via PowerShell: Restart-Service -Name MSSQLSERVER -Force
  • Re-run DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; on the affected database to force SQL Server to clean up any dangling internal snapshot handles.

Step 3: Repair System Catalog Corruption

  • If the orphaned ID persists after a clean restart, boot the instance into single-user mode using NET START MSSQLSERVER /m"SQLCMD".
  • Run DBCC CHECKDB('master') WITH NO_INFOMSGS, ALL_ERRORMSGS; to validate the master database catalog itself isn’t corrupted.
  • If corruption is confirmed in master, restore master from a known-good backup taken before the issue began, located typically at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\.

Step 4: Retry the Upgrade Process

  • Exit single-user mode and restart the SQL Server 2025 setup wizard or run the command-line upgrade: Setup.exe /ACTION=Upgrade /INSTANCENAME=MSSQLSERVER /IACCEPTSQLSERVERLICENSETERMS
  • Monitor the Summary log file in %ProgramFiles%\Microsoft SQL Server\160\Setup Bootstrap\Log\ for Error 3860 recurrence.

Alternative or Verification Steps

  • Verify the fix by querying sys.databases post-upgrade to confirm no entries exist with database_id = 32767 and that the upgraded database’s compatibility level matches SQL Server 2025 (160).
  • If the error persists after catalog repair, detach the affected user database, rename its physical .mdf/.ldf files, and re-attach it to a fresh instance using CREATE DATABASE ... FOR ATTACH to force SQL Server to regenerate a clean, non-conflicting database ID.

How to fix Error 3859 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3859 — “System Catalog Updated Directly”

Why This Error Happens

This warning occurs when a direct modification was made to SQL Server’s system catalog tables rather than through supported DDL commands or system stored procedures. It typically results from running sp_configure 'allow updates' set to 1 (a deprecated legacy practice), executing unsupported direct INSERT/UPDATE/DELETE statements against system base tables, or a third-party/custom maintenance script bypassing normal metadata APIs. In rare cases, it can also surface after an abrupt server shutdown during a system catalog write, suggesting potential internal metadata inconsistency.

Step-by-Step Resolution Guide

Step 1: Verify and Disable Direct System Table Updates

  • Open SQL Server Management Studio (SSMS) or a query window connected via sqlcmd.
  • Run EXEC sp_configure 'allow updates'; to check if the value is set to 1.
  • If enabled, disable it immediately: EXEC sp_configure 'allow updates', 0; RECONFIGURE WITH OVERRIDE;
  • Restart the SQL Server service via services.msc or Restart-Service MSSQLSERVER in PowerShell (run as Administrator).

Step 2: Audit Recent Scripts and Maintenance Jobs

  • Check SQL Server Agent Job History (Object Explorer > SQL Server Agent > Jobs) for any custom scripts executed around the time the warning appeared.
  • Search for scripts referencing system tables directly, such as sys.sysobjects, sys.syscolumns, or similar legacy catalog views.
  • Review any third-party backup, replication, or schema-migration tools installed on Windows Server 2025 for known compatibility issues with SQL Server 2025.
  • Disable or quarantine any identified job using EXEC msdb.dbo.sp_update_job @job_name = 'JobName', @enabled = 0;

Step 3: Run Database Consistency Checks

  • Open a new query window and run: DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review output for catalog corruption flags (e.g., Msg 2534, Msg 8992).
  • If corruption is found, run DBCC CHECKDB ('YourDatabaseName') WITH DATA_PURITY; for deeper validation.
  • Document the Database ID (%d) referenced in the original error and cross-check it against SELECT name, database_id FROM sys.databases;

Step 4: Restore From a Clean Backup (If Corruption Confirmed)

  • Navigate to your backup directory, typically C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\.
  • Restore the affected database using: RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Path\To\Backup.bak' WITH REPLACE;
  • Confirm the restored database no longer reflects unauthorized catalog edits by re-running DBCC CHECKDB.

Alternative or Verification Steps

  • Verify the fix by checking SQL Server Error Logs (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) to confirm Error 3859 no longer appears after subsequent catalog operations.
  • If the warning persists despite disabling allow updates, consider engaging Microsoft Support with a fresh DBCC CHECKDB output, as this may indicate deeper metadata corruption requiring a repair option like REPAIR_ALLOW_DATA_LOSS as a last resort.

How to fix Error 3857 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3857

Why This Error Happens

Error 3857 occurs when SQL Server’s catalog metadata validation detects that a required attribute is missing for a specific row in a system catalog view (sys.*). This typically indicates corruption in the system catalog metadata, often caused by an interrupted upgrade process, abrupt server shutdown during a schema change, or disk-level corruption affecting the system database pages. It can also surface after a failed in-place upgrade to SQL Server 2025 where catalog version mismatches leave incomplete metadata entries behind.

Step-by-Step Resolution Guide

Step 1: Run DBCC CHECKDB on the Affected Database

  • Open SQL Server Management Studio (SSMS) or sqlcmd and connect to the instance.
  • Execute DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review output for catalog corruption references tied to the specific sys.% view named in the error message.
  • Note the exact row and attribute identifiers reported for further investigation.

Step 2: Validate System Database Integrity

  • Run DBCC CHECKDB ('master') WITH NO_INFOMSGS, ALL_ERRORMSGS; since many sys.* views draw from master metadata.
  • Check the SQL Server Error Log at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for related corruption warnings logged before Error 3857 appeared.
  • Cross-reference Windows Event Viewer (Application log) for disk I/O warnings (Event ID 153 or 157) that may correlate with the timing of corruption.

Step 3: Restore from a Known-Good Backup

  • If corruption is confirmed and isolated to a single database, restore the most recent clean full backup using RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE;
  • If the corruption resides in system catalogs (master database), plan to rebuild system databases using setup.exe /ACTION=REBUILDDATABASE from the SQL Server 2025 installation media, followed by reapplying service packs/cumulative updates.
  • Reattach or restore user databases after the rebuild completes.

Step 4: Re-run the Upgrade or Repair Installation

  • If the error appeared immediately after upgrading to SQL Server 2025, launch Setup from the installation media and choose “Repair” under Maintenance options.
  • Allow the repair process to revalidate and rewrite catalog version metadata.
  • Reboot the Windows Server 2025 / Windows 11 host after repair completes to clear any locked file handles.

Step 5: Apply the Latest Cumulative Update

  • Download and install the latest Cumulative Update (CU) for SQL Server 2025 from the Microsoft Update Catalog.
  • CUs often contain catalog schema fixes for known metadata inconsistencies introduced in earlier builds.
  • Verify version compliance by running SELECT @@VERSION; post-installation.

Alternative or Verification Steps

  • After applying fixes, re-run DBCC CHECKDB and the original query that triggered Error 3857 to confirm the sys.% view returns results without error.
  • If the issue persists, open a Microsoft Support case and provide the DBCC CHECKDB output along with the ERRORLOG snippet, as this may indicate a deeper engine-level catalog bug requiring a hotfix.

How to fix Error 3858 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3858 – Invalid Attribute Value in System Catalog

Why This Error Happens

Error 3858 occurs when SQL Server’s database engine detects that a system catalog view (such as sys.tables, sys.indexes, or sys.columns) contains a row with a value that falls outside the expected valid range for that attribute. This is typically a symptom of metadata corruption caused by abrupt shutdowns, storage-level I/O failures, or incomplete transaction rollbacks during a DDL operation. In rarer cases, it can result from a failed in-place upgrade to SQL Server 2025 where catalog schema versions were left in an inconsistent state.

Step-by-Step Resolution Guide

Step 1: Identify the Scope of Corruption

  • Run DBCC CHECKDB (YourDatabaseName) WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm whether the corruption is isolated to system catalogs or extends to user data.
  • Check the SQL Server Error Log (default path: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for the exact table and row ID referenced alongside Error 3858.
  • Cross-reference the Windows Event Viewer (Application Log) for correlating Disk or NTFS warnings around the same timestamp.

Step 2: Restore from a Known Good Backup

  • Since system catalog corruption is rarely repairable via DBCC CHECKDB repair options (as it does not support REPAIR_ALLOW_DATA_LOSS for catalog views), the primary fix is restoration.
  • Take the corrupted database offline: ALTER DATABASE YourDatabaseName SET OFFLINE WITH ROLLBACK IMMEDIATE;
  • Restore the most recent clean full backup: RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE, RECOVERY;

Step 3: Validate Underlying Storage Health

  • Since metadata corruption often stems from hardware-level issues, run chkdsk D: /f /r on the volume hosting the .mdf and .ldf files (requires a reboot if it’s the system/data volume).
  • Verify that Windows Server 2025 Storage Spaces or the virtual disk controller (if running on Hyper-V) is not reporting any write-cache failures in Device Manager.

Step 4: Rebuild the System Databases (If Master DB is Affected)

  • If the error references sys.master_files or other master-level objects, use the SQL Server 2025 setup media: run setup.exe /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=YourAdminAccount from an elevated Command Prompt.
  • Reapply the latest Cumulative Update for SQL Server 2025 immediately after the rebuild to realign catalog schema versions.

Alternative or Verification Steps

  • After restoration, re-run DBCC CHECKDB (YourDatabaseName) WITH NO_INFOMSGS, ALL_ERRORMSGS; and confirm it returns 0 allocation errors and 0 consistency errors.
  • If the error persists only on specific queries against sys.* views, try querying the same object using sys.sysobjects (legacy compatibility view) to isolate whether it’s a view-rendering bug versus true underlying corruption—if so, open a support case with Microsoft CSS, as this may indicate a bug in the SQL Server 2025 release rather than physical corruption.

How to fix Error 3856 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3856

Why This Error Happens

Error 3856 occurs when SQL Server’s consistency checker (DBCC CHECKDB/CHECKCATALOG) detects that a metadata row in a system catalog view (sys.*) contains an attribute that should not exist for that row’s current state. This typically results from catalog corruption caused by an abrupt shutdown during a DDL operation, a failed in-place upgrade, disk-level corruption, or third-party tools directly manipulating system tables. It can also surface after a botched migration to SQL Server 2025 where metadata attributes from a deprecated or renamed feature were not cleanly removed during the upgrade process.

Step-by-Step Resolution Guide

Step 1: Identify the Scope and Isolate the Database

  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm Error 3856 is isolated to catalog metadata and not broader page-level corruption.
  • Note the exact row identifier and the specific sys.* view mentioned in the error output (e.g., sys.columns, sys.objects, sys.indexes).
  • Check the SQL Server Error Log at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for correlating timestamps with recent DDL changes or upgrade events.

Step 2: Restore From a Known Good Backup (Preferred Fix)

  • Since catalog corruption is rarely fixable without data loss, restore the affected database from the most recent clean backup taken before the corruption appeared.
  • Use SSMS or run: RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE, RECOVERY;
  • Validate backup integrity first with RESTORE VERIFYONLY FROM DISK = 'D:\Backups\YourDatabaseName.bak'; before committing to the restore.

Step 3: Run Targeted Repair if No Backup Is Available

  • Set the database to single-user mode: ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Execute DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL_ERRORMSGS; — understand this may remove the offending metadata row entirely.
  • Revert to multi-user mode afterward: ALTER DATABASE YourDatabaseName SET MULTI_USER;

Step 4: Re-apply the Latest Cumulative Update

  • Open Settings > Windows Update on Windows Server 2025/Windows 11, or manually download the latest SQL Server 2025 Cumulative Update (CU) from the Microsoft Update Catalog.
  • Reinstalling or patching to the latest CU resolves known catalog-metadata bugs that Microsoft has fixed post-RTM for specific upgrade scenarios.
  • Reboot the server and re-run the setup wizard’s repair option via Control Panel > Programs > Microsoft SQL Server 2025 > Uninstall/Change > Repair.

Step 5: Rebuild the Affected System Object (If Isolated to One Table)

  • If the corruption is confined to a single user table’s metadata, script out the table definition, data, indexes, and constraints using the Generate Scripts wizard in SSMS.
  • Drop and recreate the table under a new name, re-import the data, then rename it back to the original table name.
  • Drop the old corrupted table definition once data integrity is confirmed.

Alternative or Verification Steps

  • After remediation, re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; and confirm Error 3856 no longer appears in the output.
  • As an alternative, if the error persists intermittently, open a Microsoft Support ticket referencing Event ID 3856 and attach the ERRORLOG along with CHECKDB output, since this can indicate a deeper engine-level catalog bug requiring an engineering hotfix.

How to fix Error 3855 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3855 – Attribute Exists Without a Row in sys Catalog View

Why This Error Happens

Error 3855 indicates that DBCC CHECKDB has detected metadata corruption in the system catalog, specifically where an extended attribute entry exists in a system table but its corresponding base row is missing. This typically occurs due to incomplete transactions during a crash or improper shutdown, disk-level corruption affecting system pages, or interrupted DDL operations (such as a failed ALTER TABLE or CREATE INDEX) that left orphaned metadata behind. In some cases, this can also surface after a corrupted database restore or an interrupted in-place upgrade to SQL Server 2025 on Windows Server 2025.

Step-by-Step Resolution Guide

Step 1: Run a Full Consistency Check to Confirm Scope

  • Open SQL Server Management Studio (SSMS) or sqlcmd and connect to the affected instance.
  • Execute DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to capture the full list of affected objects.
  • Note the specific sys.%ls table referenced in the error output (commonly sys.sysidxstats, sys.syscolpars, or sys.sysschobjs).
  • Check the SQL Server Error Log at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for correlating I/O or stack dump messages.

Step 2: Restore from a Known Good Backup (Preferred Fix)

  • Identify the most recent clean backup taken before the corruption timestamp using RESTORE HEADERONLY FROM DISK = 'BackupPath.bak';.
  • Perform the restore in a side-by-side instance first to validate integrity: RESTORE DATABASE YourDatabaseName_Test FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE;.
  • Run DBCC CHECKDB against the restored copy to confirm the error 3855 does not reappear before promoting it to production.

Step 3: Isolate and Repair Using Emergency Mode (If No Backup Exists)

  • Set the database to single-user mode: ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;.
  • Place the database in EMERGENCY mode for direct catalog access: ALTER DATABASE YourDatabaseName SET EMERGENCY;.
  • Run DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS; — note this may remove the orphaned metadata attribute entirely, so this should only be used as a last resort.
  • Return the database to multi-user mode afterward: ALTER DATABASE YourDatabaseName SET MULTI_USER;.

Step 4: Validate Underlying Storage Health

  • On Windows Server 2025 or Windows 11, open Event Viewer and check Windows Logs > System for Disk or Ntfs warning events (Event ID 7 or 153) that coincide with the SQL error timestamp.
  • Run chkdsk D: /f /r (replacing D: with the volume hosting your .mdf/.ldf files) during a maintenance window to rule out physical disk corruption as the root cause.

Alternative or Verification Steps

  • After remediation, re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; and confirm the output reads “0 allocation errors and 0 consistency errors.”
  • If error 3855 persists after a repair attempt, consider exporting the schema and data via the Generate Scripts wizard in SSMS into a fresh database rather than continuing to repair the corrupted system catalog in place.

How to fix Error 3854 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3854

Why This Error Happens

Error 3854 occurs when SQL Server’s consistency checker (DBCC CHECKDB) detects a referential integrity violation between system catalog views, meaning a row in one system table references a matching row in another system table that is invalid or missing. This is typically caused by metadata corruption resulting from abrupt shutdowns, storage-level failures, or disk I/O errors that occurred while system catalog pages were being written. In rare cases, it can also surface after an incomplete or interrupted upgrade process when migrating database metadata to SQL Server 2025’s updated catalog schema.

Step-by-Step Resolution Guide

Step 1: Confirm the Scope of Corruption

  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; in SQL Server Management Studio (SSMS) to capture the full list of affected objects.
  • Note the exact table names and row identifiers referenced in the error (the %ls placeholders) so you know which catalog views are impacted.
  • Check the SQL Server Error Log (default path: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for correlating I/O or storage warnings around the same timestamp.

Step 2: Rule Out Storage and Hardware Issues

  • Open Windows Event Viewer (eventvwr.msc) and inspect the System log under Windows Logs for Disk, NTFS, or Storport errors on Windows Server 2025 / Windows 11.
  • Run chkdsk C: /f /r (adjust the drive letter to match your SQL data file volume) and schedule a restart if prompted, since the volume cannot be locked while SQL Server is running.
  • Verify your storage controller drivers and firmware are current, as outdated RAID/SAN drivers are a common trigger for torn metadata writes.

Step 3: Restore from a Known-Good Backup

  • Take a current backup of the damaged database first (even if corrupt) using BACKUP DATABASE YourDatabaseName TO DISK = 'D:\Backups\PreRepair.bak'; for forensic purposes.
  • Restore the most recent clean full backup plus subsequent transaction log backups using SSMS or RESTORE DATABASE ... WITH RECOVERY to roll forward to the latest consistent point before corruption.
  • If no clean backup exists, proceed to Step 4 as a last resort.

Step 4: Run Targeted Repair (Last Resort)

  • Set the database to single-user mode: ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Execute DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS; understanding this may delete inconsistent metadata rows to restore structural integrity.
  • Return the database to multi-user mode: ALTER DATABASE YourDatabaseName SET MULTI_USER;

Alternative or Verification Steps

  • Re-run DBCC CHECKDB after remediation to confirm it completes with zero allocation and consistency errors before returning the database to production use.
  • If error 3854 recurs immediately after repair, engage Microsoft Customer Support Services (CSS) with the CHECKDB output and ERRORLOG, as recurring catalog corruption often indicates an underlying hardware fault requiring deeper diagnostics.

How to fix Error 3853 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3853 — Metadata Consistency Failure in SQL Server 2025

Why This Error Happens

Error 3853 occurs when SQL Server’s internal metadata (system catalog views) becomes inconsistent, meaning a row in one system table references a related row in another system table that no longer exists or has been altered improperly. This is typically caused by database corruption resulting from unexpected shutdowns, storage subsystem failures, or disk-level I/O errors that interrupted a write operation to the system catalog. It can also surface after a failed in-place upgrade or a botched manual edit to system metadata via undocumented commands.

Step-by-Step Resolution Guide

Step 1: Run DBCC CHECKDB to Confirm Catalog Corruption

  • Open SQL Server Management Studio (SSMS) or a sqlcmd session connected to the affected instance.
  • Execute the following to get a full diagnostic report:
  DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Look for additional errors (such as 2501, 2520, or 8992) alongside 3853, as these confirm catalog-level corruption rather than a transient issue.

Step 2: Check the SQL Server Error Log and Windows Event Viewer

  • On Windows Server 2025 / Windows 11, navigate to Event Viewer > Windows Logs > Application and filter by Source: MSSQLSERVER.
  • Cross-reference timestamps with the SQL Server error log located at:
    C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG
  • Identify whether the corruption coincides with a disk failure, forced shutdown, or storage driver update, which narrows down the root cause.

Step 3: Restore from a Known Good Backup

  • Since metadata corruption is rarely repairable in a live state, restore the database from the most recent clean full backup:
  RESTORE DATABASE YourDatabaseName 
  FROM DISK = 'D:\Backups\YourDatabaseName_Full.bak' 
  WITH REPLACE, RECOVERY;
  • If differential or transaction log backups exist, apply them sequentially with NORECOVERY until the final log restore to minimize data loss.

Step 4: Attempt Repair as a Last Resort (If No Backup Exists)

  • If no valid backup is available, run:
  DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
  • Understand that this option can discard corrupted rows/pages permanently, so only use it when data loss is acceptable and no other recovery path exists.

Alternative or Verification Steps

  • After restoring or repairing, re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS; and confirm it returns 0 allocation errors and 0 consistency errors.
  • As a preventive measure, verify the underlying storage integrity using Get-PhysicalDisk | Get-StorageReliabilityCounter in PowerShell to rule out failing hardware as the root cause of recurring corruption.

How to fix Error 3851 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3851 – Invalid Row Found in System Table

Why This Error Happens

Error 3851 occurs when the SQL Server storage engine detects internal corruption or an inconsistency within a system catalog table (sys.*), meaning a row no longer conforms to the expected schema or structure. This is typically caused by unexpected shutdowns, disk-level corruption, faulty storage hardware, or bugs triggered during metadata operations (such as DDL changes) that leave the system catalog in an inconsistent state. Because system tables underpin all database object definitions, even a single malformed row can prevent SQL Server from reading metadata correctly, leading to cascading failures across the affected database.

Step-by-Step Resolution Guide

Step 1: Isolate the Affected Database and Stop Further Damage

  • Identify which database is throwing Error 3851 by checking the full error message and the SQL Server ERRORLOG (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG).
  • Immediately set the database to single-user mode to prevent additional writes:
    ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Take a full backup of the current (even if corrupt) database state for forensic purposes before attempting repairs.

Step 2: Run DBCC CHECKDB to Assess Corruption Scope

  • Execute a full consistency check to determine the extent of the damage:
    DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for additional allocation or consistency errors beyond 3851, which will indicate whether this is isolated metadata corruption or broader page-level corruption.
  • Check Windows Event Viewer (Application and System logs) for underlying disk I/O errors (Event ID 7, 9, or 51) that may have triggered the corruption.

Step 3: Attempt Repair Using DBCC CHECKDB with Repair Options

  • If CHECKDB confirms system table corruption, run the repair option (note this may result in data loss for affected rows):
    DBCC CHECKDB ('YourDB', REPAIR_ALLOW_DATA_LOSS);
  • Ensure the database is still in single-user mode before running this command.
  • If repair fails or system tables remain inaccessible, this indicates the corruption is too severe for automated repair, requiring restoration from backup instead.

Step 4: Restore from a Known-Good Backup (If Repair Fails)

  • Identify the last verified clean full backup and any subsequent transaction log backups.
  • Restore the database using:
    RESTORE DATABASE [YourDB] FROM DISK = 'D:\Backups\YourDB_Full.bak' WITH NORECOVERY;
    followed by applying log backups with WITH RECOVERY on the final one.
  • Validate backup integrity beforehand using RESTORE VERIFYONLY to avoid restoring another corrupted copy.

Step 5: Set Database Back to Multi-User and Monitor

  • Once repair or restore is complete, return the database to normal operation:
    ALTER DATABASE [YourDB] SET MULTI_USER;
  • Schedule more frequent DBCC CHECKDB jobs and enable Windows Server disk health monitoring (via Storage Spaces Direct or hardware RAID utilities) to catch early signs of disk degradation.

Alternative or Verification Steps

  • Re-run DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS; after remediation to confirm zero allocation or consistency errors remain.
  • If corruption recurs frequently, run hardware diagnostics (chkdsk /f /r on the volume, and vendor-specific disk health tools) to rule out failing physical storage as the root cause.

How to fix Error 3852 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3852

Why This Error Happens

Error 3852 indicates metadata corruption within the system catalog views, typically occurring when a row in one system table (such as sys.objects or sys.columns) lacks a corresponding matching row in a related system table (such as sys.sysschobjs or sys.syscolpars). This usually results from an interrupted DDL operation, an improperly terminated transaction during a schema change, a corrupted database page in the catalog storage, or issues introduced during an in-place upgrade to SQL Server 2025. In rare cases, this can also stem from manual edits to system tables or bugs in third-party tools that directly manipulate metadata.

Step-by-Step Resolution Guide

Step 1: Run a Full Consistency Check

  • Open SQL Server Management Studio (SSMS) or use sqlcmd on Windows Server 2025/Windows 11.
  • Execute DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for specific object IDs and catalog tables referenced in the mismatch (e.g., sys.objects vs sys.syscolpars).
  • Note the exact error numbers and row identifiers reported alongside Error 3852 for targeted repair.

Step 2: Isolate the Database and Attempt Repair

  • Place the affected database in single-user mode: ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Run DBCC CHECKDB ('YourDatabaseName', REPAIR_REBUILD); first, as this is non-destructive.
  • If REPAIR_REBUILD does not resolve the catalog mismatch, use DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS); as a last resort, understanding this may remove inconsistent rows.
  • Return the database to multi-user mode: ALTER DATABASE YourDatabaseName SET MULTI_USER;

Step 3: Restore from a Known Good Backup

  • If repair commands fail or data loss is unacceptable, restore the database from the most recent verified backup taken before the corruption occurred.
  • Use RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Backups\YourDatabaseName.bak' WITH REPLACE, RECOVERY;
  • Validate backup integrity beforehand with RESTORE VERIFYONLY FROM DISK = 'C:\Backups\YourDatabaseName.bak';

Step 4: Check for Underlying Hardware or Upgrade Issues

  • Review the Windows Event Viewer (Windows Logs > System and Application) for disk I/O errors or storage driver faults around the time of corruption.
  • If the issue surfaced after upgrading to SQL Server 2025, verify the upgrade logs located at C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\ for schema migration warnings.
  • Run chkdsk C: /f /r (or the relevant data drive) during a maintenance window to rule out underlying disk corruption.

Alternative or Verification Steps

  • Re-run DBCC CHECKDB after remediation to confirm zero allocation and consistency errors are returned.
  • If the error recurs on the same objects, consider scripting out the affected schema/table, dropping it, and recreating it from a clean definition rather than relying on further repair operations.

How to fix Error 3830 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3830 – Metadata Cache Coherency Check

Why This Error Happens

Error 3830 is actually an informational message, not a true failure condition — it is logged when SQL Server’s internal DBCC metadata validation process runs successfully and confirms that the metadata cache for the specified database ID is coherent with no inconsistencies found. This message typically surfaces after a DBCC CHECKDB, a database state transition (such as recovery, ONLINE/OFFLINE toggling, or a failover), or an internal background validation task on Windows Server 2025 / Windows 11 hosts. It is most often seen when trace flags like 2567 or 3604 are enabled, verbose logging is turned on, or when the server performs routine consistency verification after a crash recovery, restore operation, or plan cache invalidation event.

Step-by-Step Resolution Guide

Step 1: Confirm the Message Is Informational, Not an Error

  • Check the SQL Server Error Log via SSMS (Management > SQL Server Logs) or run:
  EXEC sp_readerrorlog 0, 1, 'Metadata cache coherency';
  • Verify the message severity level — Error 3830 is logged at an informational severity (10) and does not indicate corruption.
  • Cross-reference the Windows Event Viewer (Event Viewer > Applications and Services Logs > MSSQLSERVER) to confirm no accompanying critical Event IDs (like 824 or 825) appear alongside it.

Step 2: Review Trace Flags and Diagnostic Settings

  • Check if diagnostic trace flags are enabled unintentionally using:
  DBCC TRACESTATUS(-1);
  • Disable verbose metadata tracing if it was turned on for a prior troubleshooting session:
  DBCC TRACEOFF(3604, 2567, -1);
  • Confirm SQL Server startup parameters in SQL Server Configuration Manager (-T flags under Startup Parameters tab) do not include unnecessary trace flags that trigger verbose coherency logging.

Step 3: Run a Full Consistency Check to Rule Out Underlying Corruption

  • Execute a full integrity check on the referenced database ID:
  DBCC CHECKDB (N'YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Confirm the output reports 0 allocation errors and 0 consistency errors.
  • If using Windows Server 2025 storage features (ReFS or Storage Spaces Direct), validate underlying disk health using:
  Get-PhysicalDisk | Get-StorageReliabilityCounter

Step 4: Suppress Repetitive Logging (Optional)

  • If the message is cluttering logs during routine operations (e.g., AlwaysOn failovers), adjust the logging verbosity level in the SQL Server error log configuration.
  • Use SQL Server Configuration Manager > Advanced > Startup Parameters to ensure -T3614 or similar excessive logging flags aren’t active unless required for active debugging.

Alternative or Verification Steps

  • Re-run DBCC CHECKDB after a server restart and confirm the database ID in question returns clean results with no Error 3830 recurrence tied to real corruption.
  • If the message persists frequently without any correlating 824/825 errors, treat it as benign background validation noise and monitor via Extended Events rather than the error log.

How to fix Error 3827 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3827 – Unavailable Table with Persisted Computed Column

Why This Error Happens

This error occurs when a persisted computed column’s underlying function or schema-bound dependency has been altered, dropped, or marked unreliable, causing SQL Server to flag the entire table as unavailable rather than risk returning stale or incorrect data. It commonly happens after a CLR assembly update, a change in a user-defined function’s determinism properties, or a collation/schema change that invalidates the persisted value’s reliability. SQL Server 2025’s stricter dependency validation engine is more aggressive about catching these inconsistencies than previous versions, so changes that previously went unnoticed now trigger this block.

Step-by-Step Resolution Guide

Step 1: Identify the Dependent Object Causing the Conflict

  • Run SELECT * FROM sys.computed_columns WHERE object_id = OBJECT_ID('YourTableName') to locate the problematic persisted column.
  • Cross-reference the column’s definition with sys.sql_expression_dependencies to find the exact function or object referenced (%.*ls in the error message).
  • Check SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for the full expanded error, which names the dependent function.

Step 2: Rebuild or Refresh the Computed Column Definition

  • Execute sp_refreshsqlmodule 'FunctionOrViewName' to force SQL Server to recompile the dependent object’s metadata.
  • If the underlying function was altered, temporarily drop the persisted constraint using ALTER TABLE YourTableName ALTER COLUMN ComputedColumnName DROP PERSISTED (verify no indexes depend on it first).
  • Re-add persistence with ALTER TABLE YourTableName ALTER COLUMN ComputedColumnName ADD PERSISTED once the dependency is stable.

Step 3: Validate Schema-Binding and Determinism Settings

  • Confirm the function used in the computed column is still marked SCHEMABINDING and deterministic using OBJECTPROPERTYEX(OBJECT_ID('FunctionName'), 'IsDeterministic').
  • If a CLR assembly changed, redeploy it with ALTER ASSEMBLY and ensure PERMISSION_SET matches prior configuration (SAFE, EXTERNAL_ACCESS, or UNSAFE).
  • Restart the SQL Server service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER to clear cached execution plans referencing the broken dependency.

Step 4: Rebuild Indexes on the Affected Table

  • Run ALTER INDEX ALL ON YourTableName REBUILD to ensure persisted values are recalculated cleanly post-fix.
  • Monitor for additional warnings during rebuild, as corrupted index pages can co-occur with this error.

Alternative or Verification Steps

  • Run DBCC CHECKTABLE('YourTableName') WITH ALL_ERRORMSGS to confirm the table is no longer flagged as unavailable and no corruption remains.
  • If the error persists, drop and fully recreate the computed column with ALTER TABLE ... DROP COLUMN followed by ALTER TABLE ... ADD ComputedColumnName AS (...) PERSISTED, then re-run DBCC CHECKTABLE to confirm resolution.

How to fix Error 3823 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3823 — Object Could Not Be Bound During Upgrade

Why This Error Happens

Error 3823 occurs during a SQL Server version upgrade (e.g., migrating to SQL Server 2025) when the upgrade process attempts to recompile and validate views, functions, or stored procedures, but the underlying objects they reference no longer exist or have changed structure. This is typically caused by schema drift—where a table column was dropped, renamed, or had its data type altered after the dependent object was created—without the dependent object being updated accordingly (a side effect of not using WITH SCHEMABINDING). Because the SQL Server Database Engine Tuning upgrade script cannot resolve the binding, it logs the object as “ignored” rather than failing the entire upgrade, leaving it in a broken state post-migration.

Step-by-Step Resolution Guide

Step 1: Identify the Broken Object from Upgrade Logs

  • Navigate to the SQL Server Setup Bootstrap log folder, typically located at C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\<timestamp>\.
  • Open Detail.txt or the Summary log and search for “Error 3823” to extract the exact schema and object name (e.g., dbo.vw_SalesSummary).
  • Cross-reference this with SQL Server Management Studio (SSMS) by running SELECT * FROM sys.sysutility_ucp_health_policy_execution_history or checking the SQL Server Error Log via EXEC sp_readerrorlog 0, 1, 'could not be bound'.

Step 2: Manually Validate and Repair the Object Definition

  • Open a New Query window in SSMS connected to the affected database on the upgraded instance.
  • Run sp_helptext 'dbo.vw_SalesSummary' to view the object’s original T-SQL definition.
  • Use SELECT * FROM sys.dm_sql_referenced_entities('dbo.vw_SalesSummary', 'OBJECT') to pinpoint exactly which underlying column or table is missing or mismatched.
  • Edit the CREATE VIEW or CREATE FUNCTION script to remove the deprecated column reference or correct the renamed table/column mapping.

Step 3: Drop and Recreate the Object

  • Execute a DROP VIEW dbo.vw_SalesSummary; (or DROP FUNCTION/DROP PROCEDURE depending on the object type) to clear the orphaned metadata.
  • Run the corrected CREATE script generated in Step 2 to rebuild the object with valid bindings.
  • If the object utilized SCHEMABINDING, ensure all referenced columns explicitly exist with matching data types before re-applying the WITH SCHEMABINDING clause.

Step 4: Refresh Metadata for Remaining Dependencies

  • Run EXEC sp_refreshview 'dbo.vw_SalesSummary'; for any views stacked on top of the repaired object to ensure cascading dependencies are also updated.
  • For stored procedures, run EXEC sp_refreshsqlmodule 'dbo.usp_ProcedureName'; to force SQL Server to recompile the execution plan against the new schema.

Alternative or Verification Steps

  • Verify the Fix: Run SELECT * FROM sys.sql_expression_dependencies WHERE referencing_id = OBJECT_ID('dbo.vw_SalesSummary') AND is_ambiguous = 1; to confirm zero ambiguous dependencies remain.
  • Alternative Solution: If the object is legacy/unused, simply leave it dropped (do not recreate) and update any client applications relying on it to prevent future “Invalid object name” runtime errors.

How to fix Error 3822 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3822 – Persisted Computed Columns with Geometry/Geography Methods

Why This Error Happens

This warning occurs when a table contains a persisted computed column that relies on a geometry or geography method marked as non-deterministic or imprecise (such as STDistance, STIntersects, or other spatial calculations). SQL Server 2025 cannot guarantee that the persisted value stored on disk accurately reflects the current result of the method, especially after a binary upgrade, service pack, or cumulative update changes the underlying spatial library (Microsoft.SqlServer.Types). As a result, the engine flags the heap to warn administrators that the cached computed values may be stale and require manual recalculation.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Table and Column

  • Run the following query to locate the specific heap and persisted computed column referenced in Error 3822:
  SELECT t.name AS TableName, c.name AS ColumnName, c.definition
  FROM sys.computed_columns c
  JOIN sys.tables t ON c.object_id = t.object_id
  WHERE c.is_persisted = 1;
  • Cross-reference the schema and table name from the error message (%.*ls.%.*ls) with the query output.

Step 2: Force a Recalculation of the Computed Column

  • Since you cannot simply “update” a persisted computed column directly, drop and re-add the column to force SQL Server to recompute all values using the current spatial library:
  ALTER TABLE dbo.YourTable DROP COLUMN YourComputedColumn;
  ALTER TABLE dbo.YourTable ADD YourComputedColumn AS (geometry_col.STArea()) PERSISTED;
  • Alternatively, if dropping the column is not feasible due to dependencies (indexes, constraints), disable persistence temporarily:
  ALTER TABLE dbo.YourTable ALTER COLUMN YourComputedColumn DROP PERSISTED;
  ALTER TABLE dbo.YourTable ALTER COLUMN YourComputedColumn ADD PERSISTED;

Step 3: Update Spatial Library Assemblies

  • Ensure Windows Server 2025 / Windows 11 has the latest Visual C++ Redistributable and SQL Server spatial assemblies installed, as mismatched DLL versions (SqlServerSpatial170.dll) are a common root cause.
  • Verify the installed version path at:
    C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\
  • Apply the latest Cumulative Update (CU) for SQL Server 2025 via SQL Server Setup or Microsoft Update Catalog.

Step 4: Rebuild Indexes on the Affected Heap

  • Since the table is a heap (no clustered index), create a temporary clustered index and drop it to force a physical data reorganization, ensuring the computed values are rewritten:
  CREATE CLUSTERED INDEX IX_Temp ON dbo.YourTable (YourPrimaryKeyColumn);
  DROP INDEX IX_Temp ON dbo.YourTable;
  • This step clears internal flags SQL Server uses to track “dirty” persisted values after a spatial library version change.

Alternative or Verification Steps

  • Verify the Fix: Re-run DBCC CHECKTABLE('YourTable') WITH DATA_PURITY and check the SQL Server Error Log for the absence of Error 3822 on the next scheduled consistency check or table scan.
  • Alternative Approach: If dropping the column is restricted by production uptime requirements, create a non-persisted computed column alongside the old one, validate the data output matches expectations, and then swap the schema during the next maintenance window.

How to fix Error 3819 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3819 – Check Constraint Disabled Due to Implementation Change

Why This Error Happens

Error 3819 occurs when SQL Server 2025 detects that a check constraint relies on a user-defined function (UDF), a system function, or a CLR assembly whose underlying implementation has changed since the constraint was originally created and trusted. Because the engine can no longer guarantee that existing data satisfies the (now modified) logic, it automatically disables the constraint and marks it as “not trusted” to prevent silent data integrity violations. This commonly happens after applying a Cumulative Update, changing database compatibility level, altering a scalar UDF, or modifying collation/locale settings that affect deterministic function behavior.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Constraint and Dependent Object

  • Run the following query to pinpoint the disabled, untrusted constraint:
  • SELECT name, is_disabled, is_not_trusted, definition FROM sys.check_constraints WHERE is_not_trusted = 1;
  • Cross-reference the function or object named in the error message (the %.*ls placeholders) using sys.sql_modules or sys.objects to determine what changed (e.g., a UDF recompiled with new logic).

Step 2: Validate Existing Data Against the New Logic

  • Before re-enabling anything, confirm current data actually satisfies the updated constraint logic to avoid masking real violations.
  • Run a manual SELECT using the constraint’s WITH CHECK expression against the table to find any rows that would fail:
  • SELECT * FROM YourTable WHERE NOT (constraint_expression);
  • If rows are returned, clean or update that data first.

Step 3: Re-Enable and Re-Trust the Constraint

  • Once data is validated, re-enable the constraint using WITH CHECK so SQL Server re-scans and re-trusts it:
  • ALTER TABLE YourSchema.YourTable WITH CHECK CHECK CONSTRAINT YourConstraintName;
  • On Windows Server 2025 hosts, ensure this is run with sysadmin or db_ddladmin rights via SQL Server Management Studio (SSMS) or sqlcmd, as insufficient permissions will silently fail the ALTER TABLE operation.

Step 4: Audit the Function/Assembly Change

  • If the root cause is a modified scalar UDF or CLR assembly, check sys.assembly_modules or the UDF’s CREATE/ALTER FUNCTION history in source control.
  • If the function was intentionally altered, consider marking it SCHEMABINDING and DETERMINISTIC (where applicable) to prevent future silent drift.

Step 5: Apply Patch Consistency Across the Cluster

  • If this occurred after a Cumulative Update (CU) on one node of an Always On Availability Group, verify all replicas on Windows Server 2025 are running the identical SQL Server 2025 build via:
  • SELECT @@VERSION;
  • Mismatched CU levels across nodes is a frequent cause of function implementation drift triggering Error 3819.

Alternative or Verification Steps

  • Verify the fix: Re-run SELECT name, is_disabled, is_not_trusted FROM sys.check_constraints; — both flags should now return 0 for the repaired constraint.
  • Alternative: If the constraint logic is genuinely obsolete due to an intentional function redesign, drop and recreate the constraint entirely with ALTER TABLE ... DROP CONSTRAINT followed by a fresh ADD CONSTRAINT ... CHECK (...) statement instead of attempting to re-trust the old definition.

How to fix Error 3821 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3821 occurs when SQL Server detects that a foreign key constraint relies on an underlying function, computed column definition, or schema-bound object whose implementation has changed since the constraint was originally created. This typically happens after applying a Cumulative Update (CU) or Servicing Pack that modifies internal system function behavior, or when a user alters a deterministic function that a computed column (referenced by the FK) depends on. Because SQL Server cannot guarantee the referential integrity logic is still valid, it automatically disables the constraint rather than risk silent data corruption.

Step-by-Step Resolution Guide

Step 1: Identify the Disabled Constraint and Dependent Object

  • Run the following query to locate all disabled foreign keys in the affected database:
SELECT name, OBJECT_NAME(parent_object_id) AS TableName, is_disabled 
FROM sys.foreign_keys 
WHERE is_disabled = 1;
  • Cross-reference the table/column mentioned in the error message with sys.computed_columns to check if a computed column is involved.
  • Note the exact schema, table, and constraint name from the Event Viewer log (Path: Applications and Services Logs > SQL Server).

Step 2: Validate the Underlying Function or Computed Column

  • Check if a user-defined function (UDF) referenced in a computed column was recently altered (e.g., changed from SCHEMABINDING deterministic to non-deterministic).
  • If a UDF is the cause, script out the current function definition using SSMS (Right-click Function > Script Function as > CREATE To).
  • Verify compatibility level hasn’t shifted unexpectedly:
SELECT compatibility_level FROM sys.databases WHERE name = 'YourDBName';

Step 3: Manually Re-Enable and Validate the Constraint

  • Do not simply re-enable the constraint blindly, as this skips validation. Instead, force SQL Server to re-check existing data integrity using WITH CHECK:
ALTER TABLE [Schema].[TableName] 
WITH CHECK CHECK CONSTRAINT [FK_ConstraintName];
  • If the command fails, it confirms orphaned data exists that violates the relationship; you must clean this data before the constraint can be trusted again.
  • If the underlying function changed intentionally (e.g., via a CU), you may need to drop and recreate the Foreign Key constraint entirely to force SQL Server to re-link the dependency metadata:
ALTER TABLE [Schema].[TableName] DROP CONSTRAINT [FK_ConstraintName];
ALTER TABLE [Schema].[TableName] ADD CONSTRAINT [FK_ConstraintName] 
FOREIGN KEY (ColumnName) REFERENCES [RefTable](RefColumn);

Step 4: Apply the Latest Cumulative Update

  • Navigate to Windows Update or the Microsoft Download Center to ensure SQL Server 2025 is patched to the latest build, as this specific bug is often tied to a regression in computed column handling found in early CU releases.
  • Restart the SQL Server (MSSQLSERVER) service via services.msc after patching.

Alternative or Verification Steps

  • Verification: Re-run the sys.foreign_keys query from Step 1; the is_disabled column should now read 0 for the specific constraint, and the SQL Server Error Log should no longer show Error 3821 on subsequent data modification attempts.
  • Alternative: If the constraint continually fails to validate due to a complex computed column dependency, consider converting the computed column to a persisted column (PERSISTED keyword) to stabilize the physical storage and prevent the dependency check from triggering on every schema change.

How to fix Error 3817 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3817 – Index Disabled Due to Changed Implementation

Why This Error Happens

Error 3817 occurs when SQL Server detects that a computed column or function-based index relies on a function (such as a CLR function, scalar UDF, or built-in function) whose implementation has changed since the index was created. This typically happens after a Cumulative Update, Service Pack, or collation/algorithm change alters the deterministic output of a function, causing SQL Server to proactively disable the index to prevent data corruption or incorrect query results. It can also occur when CLR assemblies are redeployed or modified without rebuilding dependent indexes.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Index and Dependent Object

  • Run the following query to find disabled indexes flagged by this warning:
  • SELECT name, object_id, is_disabled FROM sys.indexes WHERE is_disabled = 1;
  • Cross-reference the object schema and table name from the error message to confirm which computed column or function is involved.
  • Check SQL Server Error Log (via EXEC sp_readerrorlog; or Event Viewer under Applications and Services Logs > MSSQLSERVER) for the full context of the warning.

Step 2: Validate the Function or CLR Assembly Change

  • Determine if a recent Cumulative Update (CU) or Windows Server 2025 patch altered a built-in function’s behavior (common with ROUND, CONVERT, or locale-sensitive string functions).
  • If using CLR integration, verify assembly versions with:
  • SELECT * FROM sys.assemblies;
  • Confirm whether the assembly was redeployed using ALTER ASSEMBLY with a new DLL that changed output determinism.

Step 3: Rebuild the Disabled Index

  • Since SQL Server disables rather than drops the index, you must manually rebuild it:
  • ALTER INDEX [IndexName] ON [Schema].[TableName] REBUILD;
  • If the index was built on a computed column, first validate the column definition still compiles correctly:
  • SELECT * FROM sys.computed_columns WHERE object_id = OBJECT_ID('Schema.TableName');
  • If rebuild fails due to determinism errors, drop and recreate the index explicitly:
  • DROP INDEX [IndexName] ON [Schema].[TableName];
  • CREATE INDEX [IndexName] ON [Schema].[TableName] ([ColumnName]);

Step 4: Update Statistics and Validate Data Integrity

  • After rebuilding, update statistics to ensure the query optimizer uses correct cardinality estimates:
  • UPDATE STATISTICS [Schema].[TableName];
  • Run DBCC CHECKTABLE('TableName') to confirm no corruption occurred during the function implementation change window.

Alternative or Verification Steps

  • Verify the fix by querying sys.indexes again to confirm is_disabled = 0 for the affected index, and run a test query that uses the index via SET STATISTICS XML ON to confirm an index seek/scan appears in the execution plan.
  • If the index continues to disable after rebuild, mark the underlying function as non-deterministic is not advised for production, instead replace it with a persisted computed column workaround using PERSISTED keyword, which bypasses dependency on runtime function evaluation at query time.

How to fix Error 3816 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3816 – Login Password Hash Invalid During SQL Server Upgrade

Why This Error Happens

This error occurs when SQL Server attempts to upgrade a login and discovers that the stored password hash does not conform to the expected cryptographic format, typically because the login was created or migrated from a very old SQL Server version (pre-2012) using legacy hashing algorithms. It can also occur if the sys.sql_logins system table has corrupted or manually altered password hash data. SQL Server 2025 enforces stricter validation on login credentials during the upgrade process, causing logins with malformed or outdated hashes to fail rather than silently upgrading them.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Login

  • Before upgrading, run the following query on the source instance to detect problematic logins:
  • SELECT name, type_desc, LEN(password_hash) AS hash_length FROM sys.sql_logins;
  • Look for logins with NULL, empty, or unusually short/long password_hash values compared to other standard logins.
  • Cross-reference the login name reported in the error message (%.*ls) with this result set.

Step 2: Reset the Password for the Affected Login

  • Connect to the SQL Server instance using SQL Server Management Studio (SSMS) or sqlcmd with an account that has ALTER ANY LOGIN permission.
  • Run the following T-SQL command to force a password reset and regenerate a valid hash:
  • ALTER LOGIN [LoginName] WITH PASSWORD = 'NewStrongP@ssw0rd123';
  • If the login is disabled or orphaned, first enable it using ALTER LOGIN [LoginName] ENABLE; before resetting the password.

Step 3: Validate Password Policy Compliance

  • Ensure the new password meets Windows Server 2025 security baseline policies by checking Local Security Policy (secpol.msc) under Account Policies > Password Policy.
  • If the login must retain SQL Server 2000/2005 compatibility hashing temporarily, avoid using the CHECK_POLICY = OFF flag long-term, as this will cause the same error on the next upgrade attempt.
  • Re-run the hash length query from Step 1 to confirm the password_hash column now returns a standard 2008-bit (or later) formatted hash.

Step 4: Re-Run the SQL Server Upgrade Process

  • Launch SQL Server Setup (setup.exe) again from the installation media or mounted ISO on your Windows Server 2025 host.
  • Select Upgrade and proceed through the wizard; the setup will re-validate all logins in the master database.
  • Monitor the detailed upgrade log located at %ProgramFiles%\Microsoft SQL Server\160\Setup Bootstrap\Log\Summary.txt for confirmation that Error 3816 no longer appears.

Alternative or Verification Steps

  • Verify the Fix: After the upgrade completes, log in using the affected credentials via SSMS or sqlcmd -S servername -U LoginName -P NewPassword to confirm authentication succeeds without errors.
  • Alternative Solution: If resetting the password is not feasible (e.g., third-party application dependencies), drop and recreate the login entirely using CREATE LOGIN [LoginName] WITH PASSWORD = 'P@ssw0rd', SID = <original_sid>; to preserve object ownership mappings while generating a compliant hash.

How to fix Error 3815 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3815 — Invalid Linked Login Mapping

Why This Error Happens

This error occurs when a local SQL Server login is mapped to a linked server login that no longer resolves correctly, often due to a SID mismatch, a dropped remote login, or corrupted metadata in sys.linked_logins. During a Microsoft SQL Server 2025 upgrade, the setup process validates all linked server login mappings, and any orphaned or inconsistent mapping (where the remote login referenced does not match what’s stored in the system catalog) will halt the upgrade with Error 3815. This is common after restoring databases across instances, renaming logins, or when a linked server’s remote login was manually altered without updating the mapping.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Linked Server and Login Mapping

  • Open SQL Server Management Studio (SSMS) and connect to the instance reporting the error.
  • Run the following query to list all linked logins and their mappings:
  SELECT ll.name AS local_login, s.name AS linked_server, ll.remote_name
  FROM sys.linked_logins ll
  JOIN sys.servers s ON ll.server_id = s.server_id;
  • Cross-reference the local_login and linked_server names mentioned in the Error 3815 message with this output.

Step 2: Drop the Invalid Linked Login Mapping

  • Use sp_droplinkedsrvlogin to remove the broken mapping before attempting any recreation:
  EXEC sp_droplinkedsrvlogin 
      @rmtsrvname = N'YourLinkedServerName', 
      @locallogin = N'YourLocalLoginName';
  • If the local login value was NULL (mapped generically), pass NULL explicitly for @locallogin.
  • Confirm removal by re-running the query from Step 1 — the row should no longer appear.

Step 3: Recreate the Linked Login with Valid Credentials

  • Re-establish the mapping using sp_addlinkedsrvlogin, ensuring the remote login and password are current and valid on the target server:
  EXEC sp_addlinkedsrvlogin 
      @rmtsrvname = N'YourLinkedServerName', 
      @useself = N'FALSE', 
      @locallogin = N'YourLocalLoginName', 
      @rmtuser = N'ValidRemoteUser', 
      @rmtpassword = N'ValidRemotePassword';
  • Verify the remote login actually exists and is enabled on the linked instance (check sys.server_principals on the target server).

Step 4: Re-run the SQL Server 2025 Upgrade/Setup

  • Navigate to the SQL Server 2025 setup media or C:\SQLServer2025Media\setup.exe.
  • Launch the upgrade wizard again and allow the “Rule Check” phase to re-validate linked server logins.
  • Confirm the Error 3815 rule no longer flags a failure before proceeding to the “Ready to Install” step.

Alternative or Verification Steps

  • Verify the fix: After recreating the mapping, run EXEC sp_helplinkedsrvlogin; (or query sys.linked_logins again) to confirm the local-to-remote login pairing is intact, then re-test connectivity using EXEC sp_testlinkedserver 'YourLinkedServerName';.
  • Alternative fix: If the linked server itself is obsolete or no longer needed, instead of recreating the login, simply drop the entire linked server object with EXEC sp_dropserver 'YourLinkedServerName', 'droplogins'; — this removes both the server and its associated login mappings in one step, clearing the upgrade blocker.

How to fix Error 3813 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3813 occurs during a SQL Server login upgrade (typically during migration, restore, or version upgrade to SQL Server 2025) when the Security Identifier (SID) or login name being migrated already exists in the sys.server_principals table on the destination instance. This is common when a Windows login or SQL login was previously created manually on the target server, or when the same domain account maps to a cached SID left over from a prior uninstall. The SQL Server Database Engine enforces unique SID and name constraints at the server level, so it rejects the upgrade to prevent principal collisions that would break ownership chains and permission mappings.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Login or Role

  • Open SQL Server Management Studio (SSMS) and connect to the target instance.
  • Run the following query to locate duplicate names or SIDs:
SELECT name, sid, type_desc 
FROM sys.server_principals 
WHERE name = 'ConflictingLoginName' OR sid = 0x...;
  • Note whether the conflict is with a login or a server role, as this changes the remediation path.

Step 2: Resolve the Name or SID Collision

  • If the existing login is obsolete or unused, drop it first:
DROP LOGIN [ConflictingLoginName];
  • If the login is a renamed duplicate (same SID, different name), rename the existing object instead of dropping it:
ALTER LOGIN [OldName] WITH NAME = [NewUniqueName];
  • For orphaned Windows logins with stale SIDs (common after domain rejoin on Windows Server 2025), remove the orphaned entry using sp_dropserver or DROP LOGIN, then re-run the upgrade/import process.

Step 3: Re-run the Login Migration or Upgrade Script

  • If using sp_help_revlogin or the Database Migration Assistant, re-execute the generated script after cleanup.
  • If this occurred during an in-place upgrade to SQL Server 2025, restart the Setup.exe /Action=Upgrade process after confirming no duplicate SIDs remain.
  • Check the SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for confirmation that the login was created successfully.

Step 4: Validate Server Role Membership

  • If the conflict involved a custom server role rather than a login, verify role membership mapping:
SELECT * FROM sys.server_role_members;
  • Reassign any broken role memberships using ALTER SERVER ROLE [RoleName] ADD MEMBER [LoginName];

Alternative or Verification Steps

  • Confirm the fix by querying sys.server_principals again to ensure only one entry exists per name/SID pair, then attempt a test login via SSMS or sqlcmd -S servername -U username.
  • If the error persists after cleanup, use sp_change_users_login 'Report' at the database level to detect any lingering orphaned user mappings tied to the old SID, then re-link them with ALTER USER [UserName] WITH LOGIN = [CorrectLoginName].

How to fix Error 3814 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3814

Why This Error Happens

Error 3814 occurs when SQL Server’s system catalog contains a remote login mapping (sys.remote_logins) that points to a local login which no longer exists or has become mismatched, typically due to a login being dropped and recreated without updating the corresponding linked server/remote login mapping. This commonly surfaces during an upgrade to SQL Server 2025 because the upgrade process validates all remote login mappings before proceeding, and it will halt if it finds orphaned or inconsistent entries. The root cause is almost always metadata corruption or drift between sys.server_principals and sys.remote_logins left over from a prior server migration, restore, or manual login management.

Step-by-Step Resolution Guide

Step 1: Identify the Broken Remote Login Mapping

  • Connect to the SQL Server instance using SQL Server Management Studio (SSMS) or sqlcmd with administrative credentials.
  • Run the following query to locate the problematic mapping:
  SELECT rl.remote_name, rl.local_principal_id, sp.name AS local_login_name, s.name AS server_name
  FROM sys.remote_logins rl
  LEFT JOIN sys.server_principals sp ON rl.local_principal_id = sp.principal_id
  JOIN sys.servers s ON rl.server_id = s.server_id;
  • Note any rows where local_login_name returns NULL — this indicates the orphaned mapping causing Error 3814.

Step 2: Drop the Invalid Remote Login

  • Using the remote_name and server_name values identified in Step 1, drop the broken mapping:
  EXEC sp_droplogin 'remote_name';

or, if it is tied to a linked server, use:

  EXEC sp_dropremotelogin @remoteserver = 'server_name', @loginame = 'remote_name';
  • If the command fails due to dependency locks, restart the SQL Server service via services.msc on Windows Server 2025 and retry.

Step 3: Recreate the Remote Login Correctly

  • Create a fresh local login first (if it does not already exist):
  CREATE LOGIN [remote_name] WITH PASSWORD = 'StrongPassword123!';
  • Re-map it to the remote server using:
  EXEC sp_addremotelogin @remoteserver = 'server_name', @loginame = 'remote_name', @remotename = 'remote_name';
  • Confirm the mapping was created cleanly by re-running the diagnostic query from Step 1.

Step 4: Re-run the SQL Server 2025 Upgrade

  • Launch SQL Server Setup (setup.exe) from the installation media or the Microsoft SQL Server Installation Center.
  • Select Upgrade and proceed through the wizard; the pre-upgrade validation check should now pass without triggering Error 3814.
  • Monitor the setup log located at C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\Log\ for confirmation that the remote login check succeeded.

Alternative or Verification Steps

  • After the upgrade completes, run SELECT * FROM sys.remote_logins; again to confirm no orphaned entries remain and that all local_principal_id values resolve to valid logins in sys.server_principals.
  • If the error persists, use sp_helpremotelogin to audit all remote login mappings server-wide, and consider scripting out and dropping/recreating the entire linked server object via sp_dropserver and sp_addlinkedserver as a full reset.

How to fix Error 3812 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3812 – Event Notification Dropped

Why This Error Happens

Error 3812 occurs when SQL Server automatically drops an event notification because the object it was bound to (such as a queue, service, or database) has been dropped, altered, or is no longer valid. This typically happens due to a mismatch between the Service Broker queue/service definition and the event notification’s target, or because the underlying database was dropped, detached, or restored without properly reconfiguring Service Broker dependencies. It can also occur when permissions on the target queue or service are insufficient, preventing SQL Server from maintaining the notification binding.

Step-by-Step Resolution Guide

Step 1: Verify the Service Broker Configuration

  • Open SQL Server Management Studio (SSMS) and connect to the instance reporting the error.
  • Run SELECT * FROM sys.service_queues WHERE name = 'YourQueueName'; to confirm the queue still exists.
  • Check SELECT * FROM sys.services; to ensure the associated Service Broker service has not been dropped or renamed.
  • If the queue or service is missing, recreate it using the original CREATE QUEUE and CREATE SERVICE statements from your deployment scripts.

Step 2: Recheck Event Notification Bindings

  • Query SELECT * FROM sys.event_notifications WHERE name = 'YourNotificationName'; to see if the notification metadata still exists.
  • Compare the event_notification definition against the live object (e.g., database, trigger, or queue) it targets using sys.events and sys.objects.
  • If the target object was altered or dropped, re-create the event notification using:
  CREATE EVENT NOTIFICATION YourNotificationName
  ON SERVER
  FOR DDL_DATABASE_LEVEL_EVENTS
  TO SERVICE 'YourServiceName', 'current database';
  • Ensure the GUID or broker instance identifier matches the current database (important after restores or attach/detach operations).

Step 3: Validate Permissions on the Queue and Service

  • Open a PowerShell or Command Prompt window as Administrator on Windows Server 2025 / Windows 11.
  • Run sqlcmd -S YourServerName -E -Q "SELECT grantee_principal_id, permission_name FROM sys.database_permissions WHERE major_id = OBJECT_ID('YourQueueName');" to confirm the service account has RECEIVE and SEND permissions.
  • Grant missing permissions with:
  GRANT RECEIVE ON YourQueueName TO [YourServiceAccount];
  GRANT SEND ON SERVICE::YourServiceName TO [YourServiceAccount];
  • Restart the SQL Server service via services.msc or Restart-Service -Name 'MSSQLSERVER' to apply the permission changes.

Step 4: Check for Database Restore or Mirroring Side Effects

  • If the database was recently restored, mirrored, or part of an Always On Availability Group failover, run ALTER DATABASE YourDB SET NEW_BROKER; only if Service Broker GUIDs are mismatched (use with caution in production).
  • Confirm the broker is enabled with SELECT is_broker_enabled FROM sys.databases WHERE name = 'YourDB';.
  • If disabled, enable it using ALTER DATABASE YourDB SET ENABLE_BROKER;.

Alternative or Verification Steps

  • To verify the fix, trigger the DDL or event that originally invoked the notification and confirm no Error 3812 appears in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • If the issue persists, drop and fully recreate the event notification along with its associated queue and service in a maintenance window, ensuring all GUIDs and broker instances align with the current database state.

How to fix Error 3811 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3811 – Event Notification Dropped as Broker Instance Is Not Specified

Why This Error Happens

This error occurs when an event notification attempts to deliver a message to a service queue, but the target service broker instance GUID is missing, mismatched, or unresolved in the routing information. This typically happens after a database restore, attach, or mirroring/Availability Group failover where the service_broker_guid changes but dependent event notification objects or routes were not updated accordingly. It can also occur if Service Broker is disabled on the database or if the message routing table contains stale or incomplete broker instance data.

Step-by-Step Resolution Guide

Step 1: Verify Service Broker Is Enabled on the Database

  • Open SQL Server Management Studio (SSMS) and connect to the SQL Server 2025 instance.
  • Run the following query to check broker status:
  SELECT name, is_broker_enabled, service_broker_guid 
  FROM sys.databases 
  WHERE name = 'YourDatabaseName';
  • If is_broker_enabled returns 0, enable it using:
  ALTER DATABASE YourDatabaseName SET ENABLE_BROKER;
  • Note: If the database is part of an Availability Group, run this step on the primary replica only.

Step 2: Check and Repair the Service Broker GUID Mismatch

  • A common cause is a GUID mismatch after restoring a database. Confirm the current GUID matches what routes/notifications expect:
  SELECT service_broker_guid FROM sys.databases WHERE name = 'YourDatabaseName';
  • If the database was restored from another server, reset the broker ID to force regeneration:
  ALTER DATABASE YourDatabaseName SET NEW_BROKER;

(Use NEW_BROKER only if old conversations do not need to be preserved — this clears all existing conversations.)

Step 3: Recreate the Event Notification and Associated Route

  • Drop and recreate the event notification object bound to the service queue:
  DROP EVENT NOTIFICATION YourNotificationName ON SERVER;

  CREATE EVENT NOTIFICATION YourNotificationName 
  ON SERVER 
  FOR DDL_DATABASE_LEVEL_EVENTS 
  TO SERVICE 'YourServiceName', 'current database';
  • Ensure the route definition in sys.routes includes the correct BROKER_INSTANCE value:
  CREATE ROUTE YourRouteName 
  WITH SERVICE_NAME = 'YourServiceName',
  BROKER_INSTANCE = 'correct-broker-guid-here',
  ADDRESS = 'LOCAL';

Step 4: Restart the SQL Server Service (Windows Server 2025 / Windows 11)

  • Open Services.msc (Win + R → services.msc).
  • Locate SQL Server (MSSQLSERVER) or your named instance.
  • Right-click and select Restart to reinitialize the Service Broker task and flush any stale internal routing cache.
  • Alternatively, use PowerShell as Administrator:
  Restart-Service -Name 'MSSQLSERVER' -Force

Step 5: Review SQL Server Error Log for Residual Broker Errors

  • Check the error log location (default: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG).
  • Search for repeated instances of Error 3811 or related Broker errors (9675, 9676) to confirm the issue is resolved post-restart.

Alternative or Verification Steps

  • Verify the fix by triggering a test DDL event (e.g., CREATE TABLE TestTable (ID INT);) and confirming the event notification message successfully lands in the target service queue using SELECT * FROM YourServiceQueue;.
  • If the error persists, as an alternative, drop and fully recreate the Service Broker service, queue, and contract objects from scratch rather than repairing existing ones — this resolves cases of deep metadata corruption that NEW_BROKER alone cannot fix.

How to fix Error 3810 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3810 occurs when a CLR assembly is dropped or altered while an active event notification still depends on it, causing SQL Server to forcibly remove the notification to prevent an orphaned reference. This typically happens because the assembly was recompiled, redeployed, or removed without first disabling or dropping the dependent event notification. It can also occur if the assembly’s permission set (SAFE, EXTERNAL_ACCESS, UNSAFE) was changed in a way that invalidates the existing CLR trigger binding used by Service Broker event notifications.

Step-by-Step Resolution Guide

Step 1: Identify the Dependent Event Notification

  • Run the following query to find notifications tied to the assembly: SELECT name, type_desc, event_type_desc FROM sys.server_event_notifications UNION ALL SELECT name, type_desc, event_type_desc FROM sys.event_notifications;
  • Cross-reference the assembly name reported in the error message with SELECT * FROM sys.assemblies WHERE name = '<AssemblyName>';
  • Note the exact notification name and its scope (server-level or database-level) before proceeding.

Step 2: Drop and Recreate the Event Notification Safely

  • Execute DROP EVENT NOTIFICATION <NotificationName> ON SERVER; or ON DATABASE depending on scope.
  • Re-deploy the updated assembly using ALTER ASSEMBLY <AssemblyName> FROM 'C:\SQLAssemblies\<AssemblyName>.dll' WITH PERMISSION_SET = SAFE;
  • Recreate the event notification using CREATE EVENT NOTIFICATION <NotificationName> ON SERVER FOR <EventType> TO SERVICE '<ServiceName>', '<BrokerInstanceID>';

Step 3: Validate Assembly and Service Broker Configuration

  • Confirm Service Broker is enabled on the target database using SELECT is_broker_enabled FROM sys.databases WHERE name = '<DBName>'; and enable it with ALTER DATABASE <DBName> SET ENABLE_BROKER; if needed.
  • Check SQL Server error logs at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for related CLR load failures.
  • Restart the SQL Server service via services.msc or Restart-Service MSSQLSERVER in PowerShell (run as Administrator) to clear any cached CLR assembly state.

Step 4: Re-grant CLR and Assembly Permissions

  • Verify clr strict security and clr enabled configuration options using sp_configure 'clr enabled'; and sp_configure 'clr strict security';
  • If using UNSAFE or EXTERNAL_ACCESS assemblies, ensure the assembly is signed and the login has UNSAFE ASSEMBLY permission granted via GRANT UNSAFE ASSEMBLY TO [<Login>];
  • Reapply the assembly owner mapping with ALTER AUTHORIZATION ON ASSEMBLY::<AssemblyName> TO <SchemaOwner>;

Alternative or Verification Steps

  • Verify the fix by querying sys.event_notifications and sys.server_event_notifications again to confirm the notification is active and no longer flagged as dropped, then trigger a test event to confirm message delivery to the Service Broker queue.
  • If the error persists, consider fully uninstalling and reinstalling the assembly (DROP ASSEMBLY then CREATE ASSEMBLY) rather than using ALTER ASSEMBLY, as this forces SQL Server to rebuild all internal metadata links and dependency trees from scratch.

How to fix Error 3809 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3809 – Duplicate Index Name During Database Upgrade

Why This Error Happens

Error 3809 occurs when SQL Server attempts to upgrade a database and discovers that two indexes on the same table share an identical name, which violates the naming uniqueness constraint enforced in newer catalog versions. This typically results from metadata corruption, a botched manual edit of system catalog views, or inconsistent replication/restore operations that left duplicate index entries behind. Because SQL Server 2025’s upgrade process performs stricter schema validation than prior versions, inconsistencies that were previously tolerated now block the upgrade outright.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Indexes

  • Connect to the database using SQL Server Management Studio (SSMS) or sqlcmd before attempting the upgrade again.
  • Run the following query against the affected database to locate duplicate index names on the same object:
SELECT object_id, name, COUNT(*) AS DuplicateCount
FROM sys.indexes
WHERE object_id = <object_id_from_error>
GROUP BY object_id, name
HAVING COUNT(*) > 1;
  • Note the index_id values returned, as you will need them to distinguish the duplicates in the next step.

Step 2: Rename or Drop the Duplicate Index

  • Use sys.indexes and sys.objects to confirm which table and object ID correspond to the error message (%d in the error text).
  • Rename one of the conflicting indexes using sp_rename:
EXEC sp_rename 'SchemaName.TableName.OldIndexName', 'NewUniqueIndexName', 'INDEX';
  • If the duplicate index is redundant (e.g., an orphaned leftover from a failed index rebuild), drop it instead:
DROP INDEX OldIndexName ON SchemaName.TableName;
  • Ensure you take a full backup of the database before executing any DROP or ALTER statements.

Step 3: Run DBCC CHECKDB to Validate Catalog Consistency

  • Execute DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm there is no deeper metadata corruption beyond the naming conflict.
  • Review the output for any additional allocation or consistency errors (Msg 8900-series) that may require REPAIR_REBUILD or REPAIR_ALLOW_DATA_LOSS.
  • Address any additional corruption found before proceeding to re-run the upgrade.

Step 4: Re-Attempt the Database Upgrade

  • On Windows Server 2025 or Windows 11, re-trigger the upgrade via SSMS (right-click database → Tasks → Detach/Attach) or by restarting the SQL Server 2025 instance if the upgrade is automatic on service start.
  • Monitor the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for confirmation that the upgrade phase completes without Error 3809 recurring.

Alternative or Verification Steps

  • Verify the fix by querying sys.indexes again for the previously affected object_id and confirming no duplicate names exist, then check the database compatibility level with SELECT compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName'; to confirm it matches the expected SQL Server 2025 level.
  • If renaming/dropping indexes is not feasible due to application dependencies, restore the database from a pre-corruption backup taken before the duplicate index was introduced, then reapply transaction logs up to the desired recovery point before retrying the upgrade.

How to fix Error 3807 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 3807 occurs when SQL Server’s internal identifier counter (used to assign unique IDs to objects, columns, or databases) reaches its maximum allowable value and cannot allocate a new one for the object being created. This is most commonly triggered by applications that rapidly create and drop temporary tables, table-valued parameters, or local tables in tempdb without proper cleanup, exhausting the available 16-bit or 32-bit identifier space depending on the object type. In rarer cases, it stems from a corrupted or bloated system catalog (sys.sysschobjs) that prevents the ID allocator from recycling freed identifiers correctly.

Step-by-Step Resolution Guide

Step 1: Identify the Source of Rapid Object Creation

  • Run SELECT COUNT(*) FROM tempdb.sys.objects WHERE type = 'U'; to check for an abnormal number of user tables in tempdb.
  • Review application code or stored procedures for loops that create local/global temp tables (#temp, ##temp) without a corresponding DROP TABLE.
  • Check Extended Events or Profiler traces for repeated CREATE TABLE/DROP TABLE patterns within a single session.

Step 2: Restart the SQL Server Service to Reset tempdb

  • Open Services.msc on Windows Server 2025 / Windows 11 and restart the SQL Server (MSSQLSERVER) service (or the named instance service).
  • Alternatively, run from an elevated PowerShell prompt:
  Restart-Service -Name 'MSSQL$<InstanceName>' -Force
  • This forces tempdb to be rebuilt from scratch, clearing the exhausted identifier pool since tempdb is recreated on every service start.

Step 3: Patch and Validate SQL Server Build

  • Confirm you are on the latest Cumulative Update for SQL Server 2025 via SELECT @@VERSION;.
  • Download and apply the latest CU from the Microsoft Update Catalog if the build is outdated, as early releases may have known identifier-allocation bugs in the metadata engine.
  • Reboot Windows Server 2025 after patching to ensure all SQL Server binaries and background services reload cleanly.

Step 4: Run Consistency Checks on the Affected Database

  • Execute DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to rule out catalog corruption.
  • If corruption is found in system tables, restore from the last known good backup rather than attempting repair options that can cause data loss.

Step 5: Increase tempdb File Allocation and Isolate Workloads

  • Add additional tempdb data files evenly sized across separate volumes to reduce per-file contention:
  ALTER DATABASE tempdb ADD FILE (NAME = tempdev2, FILENAME = 'D:\SQLData\tempdb2.ndf', SIZE = 512MB, FILEGROWTH = 256MB);
  • Move heavy temp-table-creating workloads to a dedicated session or application pool to prevent one process from exhausting shared identifiers.

Alternative or Verification Steps

  • After applying the fix, rerun the failing CREATE TABLE/CREATE DATABASE statement and confirm it completes without Error 3807; also monitor tempdb.sys.objects counts over 24 hours to ensure they stay stable.
  • If the error persists after a service restart and patching, open a Microsoft Support case referencing Error 3807 along with the output of DBCC CHECKDB and the current build number, as it may indicate a deeper identifier-allocation defect requiring a hotfix.

How to fix Error 3808 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3808 – Index Disabled Due to IGNOREDUPKEY on Indexed View

Why This Error Happens

This error occurs because SQL Server does not support the IGNORE_DUP_KEY option on unique indexes that are created on views. When the Query Optimizer or Database Engine detects this invalid combination during an operation (such as a database upgrade, restore, or index rebuild), it automatically disables the index rather than allowing it to violate internal consistency rules. This is commonly seen after migrating databases from older versions of SQL Server to SQL Server 2025, where legacy index options are no longer silently ignored but actively flagged and disabled.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Index and View

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Run the following query to locate disabled indexes:
  SELECT 
      i.name AS IndexName, 
      OBJECT_NAME(i.object_id) AS ViewName, 
      i.is_disabled, 
      i.ignore_dup_key
  FROM sys.indexes i
  WHERE i.ignore_dup_key = 1 
  AND OBJECTPROPERTY(i.object_id, 'IsView') = 1;
  • Note down the exact index name and the schema/view combination reported in Error 3808.

Step 2: Drop the Disabled Index

  • Execute a DROP INDEX statement using the exact names captured in Step 1.
  • Syntax example:
  DROP INDEX [IndexName] ON [SchemaName].[ViewName];
  • Ensure you have ALTER permissions on the schema; if not, run the command as a member of the db_ddladmin role or sysadmin.

Step 3: Recreate the Index Without IGNOREDUPKEY

  • Since IGNORE_DUP_KEY is invalid for indexed views, recreate the unique clustered index omitting this option entirely.
  • Use the following syntax:
  CREATE UNIQUE CLUSTERED INDEX [IndexName] 
  ON [SchemaName].[ViewName] (ColumnName);
  • Do not append WITH (IGNORE_DUP_KEY = ON) as this will trigger the same 3808 warning again upon the next schema validation check.

Step 4: Validate Server and Compatibility Level Settings

  • Check the database compatibility level to ensure it aligns with SQL Server 2025 standards (Level 170).
  • Run:
  SELECT compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName';
  • If the database was recently migrated, update statistics and rebuild remaining indexes using sp_updatestats to prevent cascading index corruption flags.

Alternative or Verification Steps

  • Verify the Fix: Re-run the SELECT query from Step 1; the is_disabled column for the specific index should now return 0, and the index should no longer appear in the sys.messages log for Event ID 3808.
  • Alternative Fix: If dropping the index is not immediately possible due to application dependencies, temporarily disable the automated index maintenance job in SQL Server Agent to stop the warning from flooding the error logs until a maintenance window is scheduled.

How to fix Error 3806 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3806 – Non-Deterministic Date Conversion in Indexed View

Why This Error Happens

This warning occurs because the indexed view contains an implicit or ambiguous conversion from a string literal to a date/datetime data type, and SQL Server cannot guarantee the result is deterministic across different language settings or session configurations. Indexed views require all computations, including date conversions, to be 100% deterministic because the result set is physically materialized and stored on disk like a table. When SQL Server 2025 detects a string-to-date conversion without an explicit, deterministic style code (such as 112 or 121), it flags the view as potentially corrupted since the stored values could differ from a freshly computed result if server locale or settings change.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Column or Expression in the View Definition

  • Run sp_helptext 'SchemaName.ViewName' in SSMS or Azure Data Studio to dump the full view source code.
  • Scan the CREATE VIEW script for any CAST() or implicit conversions involving VARCHAR, CHAR, or NVARCHAR columns being compared or joined against DATE, DATETIME, or DATETIME2 columns.
  • Pay close attention to WHERE clauses and computed columns within the SELECT list, as these are common hiding spots for implicit string-to-date logic.

Step 2: Rewrite the Conversion Logic Using Explicit, Deterministic Styles

  • Modify the view script to wrap every string-to-date transformation with CONVERT(datetime, YourStringColumn, 121).
  • Style code 121 (ODBC Canonical) or 112 (ISO YYYYMMDD) are the preferred deterministic formats recognized by the SQL Server 2025 query optimizer.
  • Avoid using CAST() for this specific scenario, as CAST relies on default session settings which are considered non-deterministic for string-to-date transformations.
  • Execute the updated ALTER VIEW statement to push the change live: ALTER VIEW SchemaName.ViewName WITH SCHEMABINDING AS SELECT CONVERT(datetime, DateStringCol, 121) AS FixedDate FROM dbo.SourceTable;

Step 3: Drop and Rebuild the Clustered Index on the View

  • Since the underlying schema binding logic has changed, the existing indexed view data may be stale or flagged.
  • Drop the existing unique clustered index using DROP INDEX IX_IndexName ON SchemaName.ViewName;.
  • Recreate the index to force SQL Server to re-materialize the data using the new deterministic logic: CREATE UNIQUE CLUSTERED INDEX IX_IndexName ON SchemaName.ViewName (FixedDate);.

Step 4: Validate Server and Database Collation Settings

  • Open PowerShell as Administrator and check the instance-level collation to ensure it aligns with expected date formats: sqlcmd -S localhost -Q "SELECT SERVERPROPERTY('Collation')".
  • Ensure the Windows Server 2025 regional settings (via Control Panel > Region) are not configured to a locale that conflicts with the hardcoded date styles used in Step 2.

Alternative or Verification Steps

  • Run DBCC CHECKTABLE('SchemaName.ViewName') WITH DATA_PURITY to confirm the view is no longer reporting corruption flags and that the data integrity check passes cleanly.
  • If the error persists after rebuilding, use sys.sql_expression_dependencies to check if a nested view or inline function elsewhere in the dependency chain is still performing a hidden non-deterministic cast.

How to fix Error 3805 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3805 – Non-Deterministic Conversion in Computed Column Index

Why This Error Happens

This error occurs when an indexed computed column relies on an implicit conversion from a string data type (such as varchar or nvarchar) to a date or datetime type, and that conversion depends on session settings like LANGUAGE or DATEFORMAT. Because the result of the conversion can change based on the session context in which the index was built versus queried, SQL Server flags the index as potentially non-deterministic and therefore unreliable for maintaining data integrity. This typically surfaces after an in-place upgrade to SQL Server 2025 or after a database is moved to a server with different regional/language settings than the original.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Index and Computed Column

  • Run the following query to extract the exact object names from the error text:
  SELECT i.name AS IndexName, t.name AS TableName, c.name AS ColumnName, c.definition
  FROM sys.indexes i
  JOIN sys.tables t ON i.object_id = t.object_id
  JOIN sys.computed_columns c ON t.object_id = c.object_id
  WHERE t.name = 'YourTableName';
  • Confirm the column definition contains an implicit string-to-date cast (e.g., CAST(OrderDateString AS DATE)).

Step 2: Validate Index Integrity with DBCC CHECKTABLE

  • Open SQL Server Management Studio (SSMS) 21 or later on Windows 11 / Windows Server 2025.
  • Execute:
  DBCC CHECKTABLE ('YourTableName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review output for actual corruption (Msg 8928 or 8951) versus just the deterministic warning. If corruption is found, proceed to restore from backup or run REPAIR_REBUILD in a maintenance window.

Step 3: Rewrite the Computed Column Definition with Explicit CONVERT

  • Drop the existing index on the affected computed column:
  DROP INDEX IX_YourIndexName ON dbo.YourTableName;
  • Drop and recreate the computed column using an explicit, deterministic style code (e.g., style 23 or 126 for ISO formats):
  ALTER TABLE dbo.YourTableName DROP COLUMN ComputedDateColumn;
  ALTER TABLE dbo.YourTableName
    ADD ComputedDateColumn AS CONVERT(date, OrderDateString, 23) PERSISTED;
  • Rebuild the index on the corrected, now-deterministic column:
  CREATE INDEX IX_YourIndexName ON dbo.YourTableName (ComputedDateColumn);

Step 4: Standardize Server-Level Language and Date Format Settings

  • Check current default language on Windows Server 2025 instance:
  EXEC sp_configure 'default language';
  • Ensure SET DATEFORMAT and SET LANGUAGE are consistent across all application connection strings and linked servers to prevent recurrence after future restores or migrations.

Step 5: Rebuild All Related Indexes and Update Statistics

  • Execute a full index rebuild on the table to clear any residual metadata flags:
  ALTER INDEX ALL ON dbo.YourTableName REBUILD;
  UPDATE STATISTICS dbo.YourTableName;
  • Confirm no further Error 3805 entries appear in the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.

Alternative or Verification Steps

  • Re-run DBCC CHECKTABLE ('YourTableName') WITH ALL_ERRORMSGS after rebuilding; a clean result with zero allocation/consistency errors confirms the fix.
  • If explicit CONVERT is not feasible due to application dependencies, as an alternative, mark the column as non-persisted (remove PERSISTED) so it is computed at query time rather than stored and indexed, eliminating the determinism requirement entirely.

How to fix Error 3804 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3804 – Check Constraint Disabled Due to Checksum Function Change

Why This Error Happens

This warning occurs when a check constraint on a table uses the CHECKSUM() or BINARY_CHECKSUM() function, and the underlying implementation of that function has changed between SQL Server versions or builds (commonly after an in-place upgrade or cumulative update). Because the new checksum algorithm can produce different hash values than the one originally used to validate existing data, SQL Server automatically disables the constraint rather than risk incorrectly flagging valid rows as violations. This is a protective mechanism, not data corruption, but it means the constraint is no longer being enforced until it is manually rebuilt and revalidated.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Constraint and Table

  • Run the following query to confirm which constraints are disabled and reference checksum logic:
SELECT name, OBJECT_NAME(parent_object_id) AS TableName, definition
FROM sys.check_constraints
WHERE is_disabled = 1;
  • Review the definition column for any use of CHECKSUM(*) or BINARY_CHECKSUM(*).
  • Note the exact table name and schema reported in the Error 3804 message text.

Step 2: Drop and Recreate the Check Constraint

  • Script out the existing constraint definition before dropping it (use SSMS “Script Constraint as DROP and CREATE To” for safety).
  • Drop the disabled constraint:
ALTER TABLE dbo.YourTable
DROP CONSTRAINT CK_YourConstraintName;
  • Recreate it using the same logical checksum validation, forcing SQL Server to recalculate it with the current engine version:
ALTER TABLE dbo.YourTable
ADD CONSTRAINT CK_YourConstraintName
CHECK (CHECKSUM(ColumnA, ColumnB) <> 0);

Step 3: Validate Existing Data Against the New Constraint

  • Use WITH CHECK explicitly to force SQL Server to re-verify all existing rows against the new checksum logic rather than trusting old values:
ALTER TABLE dbo.YourTable WITH CHECK
CHECK CONSTRAINT CK_YourConstraintName;
  • If this fails, identify non-conforming rows first using a SELECT with the same CHECK expression negated, then clean the data before re-enabling.

Step 4: Apply Latest Cumulative Update (CU) Consistently Across Nodes

  • On Windows Server 2025 clusters or Always On Availability Groups, ensure all replicas are running the identical SQL Server 2025 build to avoid checksum mismatches between nodes.
  • Verify current build via:
SELECT @@VERSION;
  • Download and apply the matching CU from the Microsoft Update Catalog if versions differ across nodes.

Alternative or Verification Steps

  • Confirm the fix by re-running the sys.check_constraints query from Step 1 — the is_disabled column should now return 0 for the affected constraint.
  • If rebuilding the constraint is not immediately feasible, temporarily document and monitor the table at the application layer, then schedule a maintenance window to run DBCC CHECKCONSTRAINTS('YourTable') to confirm data integrity before re-enabling enforcement.

How to fix Error 3802 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3802 — Constraint May Be Impacted by Collation Upgrade

Why This Error Happens

This warning occurs when SQL Server 2025 performs a collation upgrade (often during an in-place upgrade, database restore, or ALTER DATABASE COLLATE operation) and detects CHECK or FOREIGN KEY constraints that reference character-based columns. Because the collation change can alter sort order and comparison rules, SQL Server cannot guarantee that existing data still satisfies the constraint logic under the new collation, so it flags the constraint as untrusted rather than silently assuming validity. This is not data corruption — it is a safety flag requiring manual revalidation.

Step-by-Step Resolution Guide

Step 1: Identify All Impacted Constraints

  • Run the following query to list all untrusted constraints in the affected database:
  • SELECT name, OBJECT_NAME(parent_object_id) AS TableName FROM sys.check_constraints WHERE is_not_trusted = 1 UNION ALL SELECT name, OBJECT_NAME(parent_object_id) FROM sys.foreign_keys WHERE is_not_trusted = 1;
  • Cross-reference this list with the exact table/constraint names printed in the Error 3802 messages from the SQL Server Error Log (Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG).

Step 2: Disable and Re-Enable Each Constraint WITH CHECK

  • For CHECK constraints, run: ALTER TABLE dbo.YourTable NOCHECK CONSTRAINT YourConstraintName; followed immediately by ALTER TABLE dbo.YourTable WITH CHECK CHECK CONSTRAINT YourConstraintName;
  • For FOREIGN KEY constraints, use the same syntax pattern substituting the FK constraint name.
  • The WITH CHECK clause forces SQL Server to re-scan existing data against the new collation rules and marks the constraint as trusted again if no violations are found.

Step 3: Automate for Bulk Constraints (Multiple Tables)

  • If dozens of constraints are impacted, generate dynamic SQL rather than fixing them manually:
  • SELECT 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + ' WITH CHECK CHECK CONSTRAINT ' + QUOTENAME(name) + ';' FROM sys.check_constraints WHERE is_not_trusted = 1;
  • Copy the generated output into a new query window and execute it as a batch.

Step 4: Check for Underlying Data Violations

  • If the WITH CHECK CHECK CONSTRAINT step fails with error 547, the data itself violates the constraint under the new collation (e.g., duplicate values that now compare as equal, or string comparisons that now evaluate differently).
  • Query the offending rows manually using the constraint’s CHECK expression to isolate and clean bad data before re-attempting Step 2.

Step 5: Rebuild Indexes on Affected Columns

  • Collation changes can also affect index key ordering on char/varchar/nchar/nvarchar columns.
  • Run ALTER INDEX ALL ON dbo.YourTable REBUILD; on each impacted table to ensure index structures align with the new collation sort order.

Alternative or Verification Steps

  • Verify the fix by re-running the Step 1 query — if it returns zero rows, all constraints are trusted and the collation upgrade is fully reconciled.
  • If constraints repeatedly fail validation due to large-scale data conflicts, consider dropping and recreating the constraint instead of using NOCHECK/WITH CHECK, after first cleaning the conflicting data using a staging table comparison.

How to fix Error 3803 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3803 – Index Disabled Due to Checksum Function Change

Why This Error Happens

This warning occurs when a database is restored or attached to a SQL Server instance where the internal checksum algorithm implementation differs from the one used when the index was originally built, commonly after a major version upgrade such as migrating to SQL Server 2025. Because the page/row checksum values can no longer be validated consistently against the new engine logic, SQL Server proactively disables the affected index to prevent returning incorrect or corrupted query results. This is not a sign of physical corruption but rather a compatibility safeguard triggered during cross-version data movement.

Step-by-Step Resolution Guide

Step 1: Identify All Disabled Indexes

  • Run the following query to locate every index disabled due to this issue:
  • SELECT OBJECT_NAME(object_id) AS TableName, name AS IndexName, is_disabled FROM sys.indexes WHERE is_disabled = 1;
  • Cross-reference the output with the SQL Server Error Log (search for Error 3803) to confirm the checksum-related cause.

Step 2: Rebuild the Affected Indexes

  • Open SQL Server Management Studio (SSMS) or a query window connected to the affected instance.
  • Execute a full rebuild for each disabled index to force SQL Server to recalculate checksums using the current engine version:
  • ALTER INDEX [IndexName] ON [SchemaName].[TableName] REBUILD;
  • For large tables, consider using REBUILD WITH (ONLINE = ON) (Enterprise Edition) to minimize downtime.

Step 3: Rebuild All Indexes at the Database Level (If Multiple Tables Are Affected)

  • If many indexes across the database were disabled, run a database-wide rebuild script instead of handling tables individually:
  • Use sp_MSforeachtable @command1="ALTER INDEX ALL ON ? REBUILD" as a bulk remediation utility.
  • Monitor tempdb growth in C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA during the operation, as large rebuilds can spike tempdb usage significantly.

Step 4: Run DBCC CHECKDB to Confirm Data Integrity

  • After rebuilding, execute DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to ensure no underlying corruption exists beyond the checksum mismatch.
  • Review the output for any additional allocation or consistency errors unrelated to the checksum warning.

Step 5: Update Statistics and Validate Compatibility Level

  • Confirm the database compatibility level matches SQL Server 2025 requirements via SELECT compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName';
  • Update it if necessary using ALTER DATABASE [YourDatabaseName] SET COMPATIBILITY_LEVEL = 170;
  • Refresh statistics with EXEC sp_updatestats; to ensure the query optimizer uses accurate, post-rebuild index data.

Alternative or Verification Steps

  • Re-run the sys.indexes query from Step 1 to confirm is_disabled now returns 0 for all previously affected indexes, and check the SQL Server Error Log to verify Error 3803 no longer appears on subsequent restarts or restores.
  • If rebuilding fails due to insufficient disk space or locking issues, drop and recreate the index manually using the original CREATE INDEX script (retrievable from SSMS’s “Script Index as CREATE” feature) as a fallback alternative to ALTER INDEX REBUILD.

How to fix Error 3801 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3801 – Index Collation Upgrade Warning

Why This Error Happens

This warning occurs when SQL Server 2025 undergoes a collation upgrade (often triggered by a Windows Server 2025 / Windows 11 OS update or a SQL Server version upgrade) and detects that existing indexes were built using sort order rules from the previous collation version. Because character sorting and comparison logic can shift between collation versions, indexes containing character-based key columns may no longer reflect accurate ordering, which can lead to logical corruption or incorrect query results. SQL Server raises Error 3801 as a precautionary flag rather than a hard failure, prompting administrators to validate data integrity before the index is trusted again.

Step-by-Step Resolution Guide

Step 1: Identify Affected Databases and Tables

  • Check the SQL Server Error Log or Event Viewer (Windows Logs > Application) for all instances of Error 3801.
  • Note the exact database, schema, table, and index names reported in the message.
  • Run the following to cross-reference collation-sensitive columns:
  SELECT name, collation_name FROM sys.columns WHERE collation_name IS NOT NULL;

Step 2: Run DBCC CHECKTABLE for Validation

  • Execute the command exactly as recommended by the warning:
  DBCC CHECKTABLE ('YourSchema.YourTableName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review output for allocation or consistency errors tied to the flagged index.
  • If errors are found, back up the database first:
  BACKUP DATABASE [YourDB] TO DISK = 'C:\SQLBackups\YourDB_PreFix.bak';

Step 3: Rebuild Impacted Indexes

  • Rebuild the specific index to force it to regenerate under the new collation rules:
  ALTER INDEX [IndexName] ON [Schema].[Table] REBUILD;
  • For a full table/database sweep, rebuild all indexes:
  ALTER INDEX ALL ON [Schema].[Table] REBUILD;
  • Ensure sufficient disk space in C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\ before large rebuild operations.

Step 4: Update Statistics and Recompile Plans

  • After rebuilding, update statistics to ensure the query optimizer uses fresh metadata:
  UPDATE STATISTICS [Schema].[Table] WITH FULLSCAN;
  • Clear cached execution plans related to the table to avoid stale collation assumptions:
  DBCC FREEPROCCACHE;

Alternative or Verification Steps

  • Re-run DBCC CHECKTABLE on the same table after the rebuild — a clean result with zero allocation/consistency errors confirms the fix.
  • If Error 3801 persists after rebuilding, consider restoring from a pre-upgrade backup and reapplying the Windows/SQL Server update in a staging environment first to isolate the collation conflict.

How to fix Error 3800 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3800 in SQL Server 2025

Why This Error Happens

This error occurs when SQL Server’s internal column-name comparison logic detects that two or more column names within the same table are too similar, typically differing only by case sensitivity, trailing whitespace, or Unicode normalization variants that collate to the same binary representation. SQL Server 2025 enforces stricter column-name differentiation checks during CREATE TABLE or ALTER TABLE operations to prevent ambiguity in collation-insensitive lookups, metadata caching, and columnstore index operations. This is often triggered by scripts generated from ORMs, migration tools, or copy-pasted DDL where names like OrderID and orderid (or Name with a trailing space) are used in the same schema.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Column Names

  • Open the DDL script or run sp_help 'YourTableName' in SQL Server Management Studio (SSMS) to list all existing columns.
  • Look for columns that appear nearly identical, especially differing only in case (e.g., UserID vs userid) or hidden characters (trailing spaces, tabs, or non-breaking Unicode spaces copied from Word/Excel).
  • Use the query below to detect whitespace or hidden characters in column names:
  SELECT name, LEN(name) AS actual_length, DATALENGTH(name) AS byte_length
  FROM sys.columns
  WHERE object_id = OBJECT_ID('YourTableName');

Step 2: Correct the Column Definitions in the Script

  • Rename one of the conflicting columns to a clearly distinct name (e.g., change orderid to Order_Reference_ID).
  • If the issue stems from copy-pasted text, retype the column name manually in a plain text editor (like Notepad) to strip any invisible Unicode characters, then paste it back into SSMS.
  • Save the corrected script, for example at C:\Scripts\FixedSchema.sql.

Step 3: Check Server Collation Settings

  • Verify the database collation using:
  SELECT DATABASEPROPERTYEX('YourDatabaseName', 'Collation');
  • If the collation is case-insensitive (e.g., SQL_Latin1_General_CP1_CI_AS), ensure new column names are not relying on case alone to differentiate them, as SQL Server 2025 will reject this during table creation or alteration.
  • Adjust the collation at the column level if a case-sensitive exception is required:
  ALTER TABLE YourTableName
  ALTER COLUMN YourColumnName VARCHAR(50) COLLATE SQL_Latin1_General_CP1_CS_AS;

Step 4: Re-run the DDL Statement

  • Execute the corrected CREATE TABLE or ALTER TABLE statement in SSMS or via sqlcmd:
  sqlcmd -S YourServerName -d YourDatabaseName -i C:\Scripts\FixedSchema.sql
  • Confirm no Error 3800 is thrown and the table structure updates successfully.

Alternative or Verification Steps

  • Run sp_columns YourTableName after applying the fix to visually confirm all column names are now distinct and correctly spelled.
  • If the error persists despite visually correct names, rebuild the script from scratch in Notepad (avoiding copy-paste from PDFs or web pages) to eliminate any residual Unicode homoglyphs or zero-width characters.

How to fix Error 3768 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3768 – Cannot Drop Primary Key Constraint Due to Vector Index

Why This Error Happens

This error occurs because SQL Server 2025’s new vector index feature creates a dependency on the underlying primary key (or clustering key) structure of the table to maintain its internal mapping between vector embeddings and row identifiers. When a vector index exists on a table, SQL Server locks the schema of the primary key constraint to prevent structural changes that would invalidate the vector index’s internal row-lookup mechanism. Attempting to drop the primary key while this dependency is active triggers Error 3768, as the Database Engine refuses to let the index enter an orphaned or inconsistent state.

Step-by-Step Resolution Guide

Step 1: Identify the Vector Index Blocking the Operation

  • Open SQL Server Management Studio (SSMS) 21 or Azure Data Studio connected to your SQL Server 2025 instance.
  • Run the following query to find vector indexes on the target table:
  • SELECT i.name AS IndexName, i.type_desc, t.name AS TableName FROM sys.indexes i JOIN sys.tables t ON i.object_id = t.object_id WHERE t.name = 'YourTableName' AND i.type_desc = 'VECTOR';
  • Note the exact name(s) of the vector index(es) returned.

Step 2: Drop the Vector Index Before Modifying the Constraint

  • Execute a DROP INDEX statement targeting the vector index specifically.
  • DROP INDEX [YourVectorIndexName] ON [dbo].[YourTableName];
  • Confirm no error messages are returned and the index no longer appears in sys.indexes.

Step 3: Drop or Alter the Primary Key Constraint

  • Now that the dependency is removed, execute the original ALTER TABLE command.
  • ALTER TABLE [dbo].[YourTableName] DROP CONSTRAINT [PK_YourConstraintName];
  • Make any necessary schema changes (e.g., changing data types, adding columns to the key).

Step 4: Recreate the Vector Index (If Required)

  • If the vector index is still needed for AI/embedding search functionality, rebuild it using the CREATE VECTOR INDEX syntax.
  • CREATE VECTOR INDEX [YourVectorIndexName] ON [dbo].[YourTableName]([VectorColumn]) WITH (METRIC = 'cosine', TYPE = 'diskann');
  • Ensure the new primary key structure is compatible with the vector index’s distance metric configuration.

Alternative or Verification Steps

  • Verify the Fix: Query sys.indexes again post-change to confirm the vector index exists (if recreated) and run SELECT OBJECTPROPERTY(OBJECT_ID('YourTableName'), 'TableHasPrimaryKey'); to confirm the new primary key is active.
  • Alternative Solution: If dropping the index is not feasible due to size/rebuild time constraints, consider using ALTER TABLE...WITH (ONLINE = ON) if the specific schema change supports online processing, though this typically still requires the vector index to be absent for primary key modifications specifically.

How to fix Error 3766 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3766 – “Cannot drop %S_MSG ‘%.*ls’ using old ‘Table.Index’ syntax”

Why This Error Happens

This error occurs when a T-SQL script attempts to drop an index using the deprecated DROP INDEX table.index_name syntax, which has been fully removed in SQL Server 2025. Modern SQL Server versions require the standardized ANSI syntax DROP INDEX index_name ON table_name instead. This commonly surfaces when legacy migration scripts, old maintenance jobs, or third-party tools generated on older SQL Server versions (2008 R2 or earlier) are executed against a 2025 instance without being updated.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Script or Job

  • Open SQL Server Management Studio (SSMS) connected to your Windows Server 2025 / Windows 11 instance.
  • Check the exact error message in the SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) to locate the batch or job that triggered Error 3766.
  • If triggered by a SQL Agent Job, navigate to SQL Server Agent > Jobs in SSMS and review the job step history for the failing T-SQL command.

Step 2: Rewrite the DROP INDEX Statement

  • Locate the deprecated syntax in your script, which looks like this:
  DROP INDEX MyTable.IX_MyIndex
  • Replace it with the modern ANSI-compliant syntax:
  DROP INDEX IX_MyIndex ON dbo.MyTable
  • If multiple indexes are being dropped in one old-style batch, split them into individual DROP INDEX ... ON ... statements, as SQL Server 2025 does not support comma-separated multi-table old syntax drops.

Step 3: Update Legacy Tools and Compatibility Level

  • Check the database compatibility level by running:
  SELECT name, compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName';
  • Note that raising or lowering compatibility level will not restore old syntax support; the fix must be done in the script itself.
  • If the script originates from a third-party backup/migration tool, check the vendor’s website for an updated version compatible with SQL Server 2025.

Step 4: Re-deploy and Test the Corrected Script

  • Save the updated script and re-run it in a test/staging environment first.
  • Use SET NOEXEC ON temporarily to validate syntax parsing without executing the drop, then set it back to OFF before the real run.

Alternative or Verification Steps

  • Verify the fix by re-running the corrected script and confirming no Error 3766 appears in the SSMS Messages tab or the ERRORLOG file.
  • As an alternative, use SQL Server Management Studio’s Generate Scripts wizard (right-click database > Tasks > Generate Scripts) to auto-generate properly formatted DROP INDEX statements instead of manually editing legacy code.

How to fix Error 3767 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3767 – Could Not Drop Primary Key Constraint Because Table Has a JSON Index

Why This Error Happens

This error occurs because SQL Server 2025 introduces native JSON indexes, which are internally implemented as a special form of index tied directly to the table’s structure, often relying on the clustering key or row identifier. When a primary key constraint is dropped, SQL Server cannot guarantee the integrity or lookup mechanism of the dependent JSON index, so it blocks the operation to prevent orphaned or corrupted index structures. This typically happens when a DBA attempts a schema change (like altering a data type or renaming a key) without first accounting for newly added JSON indexing features.

Step-by-Step Resolution Guide

Step 1: Identify the Dependent JSON Index

  • Open SQL Server Management Studio (SSMS) connected to your SQL Server 2025 instance.
  • Run a system catalog query to find indexes of type JSON associated with the target table:
  • SELECT name, type_desc FROM sys.indexes WHERE object_id = OBJECT_ID('YourSchema.YourTable') AND type_desc = 'JSON';
  • Note the exact name(s) of the JSON index(es) returned by this query.

Step 2: Drop the JSON Index Temporarily

  • Execute a DROP INDEX statement specifically targeting the JSON index identified in Step 1.
  • Syntax example: DROP INDEX [JSON_Index_Name] ON [YourSchema.YourTable];
  • Ensure you are not running this in a production environment during peak hours, as dropping indexes can cause a temporary query performance dip.

Step 3: Modify the Primary Key Constraint

  • Now that the dependency is removed, execute your original schema change command.
  • Syntax example: ALTER TABLE [YourSchema.YourTable] DROP CONSTRAINT [PK_ConstraintName];
  • Proceed with whatever action you originally intended (e.g., changing a column type or re-creating the key with a different configuration).

Step 4: Recreate the JSON Index

  • Once the primary key alteration is successfully committed, restore the JSON indexing functionality.
  • Use the CREATE JSON INDEX syntax (new to SQL Server 2025) to rebuild the index on the relevant JSON column.
  • Example: CREATE JSON INDEX [JSON_Index_Name] ON [YourSchema.YourTable]([JSONColumnName]);

Alternative or Verification Steps

  • Verification: Run SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID('YourSchema.YourTable'); to confirm both the Primary Key and the JSON Index are listed as active and valid.
  • Alternative: If recreating the index is not immediately possible due to size constraints, consider using the WITH (ONLINE = ON) option during the DROP INDEX step in Step 2 to minimize table locking on high-availability systems running Windows Server 2025.

How to fix Error 3765 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3765 – Could Not Delete Native Shuffle Storage

Why This Error Happens

Error 3765 occurs when SQL Server 2025’s native shuffle engine attempts to clean up temporary shuffle storage artifacts but encounters a locked file handle, insufficient disk permissions, or a corrupted intermediate storage segment. This typically arises during parallel query execution involving data redistribution (shuffle operations) across worker nodes, where the storage path becomes inaccessible due to antivirus interference, abrupt query cancellation, or filesystem-level ACL misconfigurations on the shuffle spill directory. In some cases, the underlying disk volume may have run out of space mid-operation, leaving orphaned shuffle files that the engine cannot safely remove.

Step-by-Step Resolution Guide

Step 1: Check the SQL Server Error Log for Root Cause Details

  • Open SQL Server Management Studio (SSMS) and navigate to Management > SQL Server Logs.
  • Look for accompanying entries near Error 3765, such as “Access Denied” or “I/O error” on the shuffle storage path (commonly C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\ShuffleTemp\).
  • Run EXEC sp_readerrorlog 0, 1, 'shuffle'; in a query window to filter relevant log lines quickly.

Step 2: Verify File System Permissions on the Shuffle Storage Directory

  • Right-click the shuffle temp folder (default path above) and select Properties > Security.
  • Ensure the SQL Server service account (e.g., NT Service\MSSQLSERVER) has Full Control permissions.
  • From an elevated PowerShell prompt, run:
  icacls "C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\ShuffleTemp" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F"

Step 3: Clear Orphaned Shuffle Files and Restart the Shuffle Service

  • Stop the SQL Server instance using net stop MSSQLSERVER via an elevated Command Prompt.
  • Manually delete any residual .shuf or .tmp files in the ShuffleTemp directory.
  • Restart the service with net start MSSQLSERVER and allow the shuffle subsystem to reinitialize.

Step 4: Exclude Shuffle Storage Path from Antivirus Scanning

  • Open Windows Security (or your third-party antivirus console).
  • Add an exclusion for the full ShuffleTemp directory path to prevent real-time scanning from locking files during write/delete operations.
  • Reboot the server to ensure the exclusion takes effect system-wide.

Step 5: Validate Disk Space and Volume Health

  • Check available free space on the drive hosting the shuffle storage using Get-PSDrive in PowerShell.
  • If space is critically low, relocate the shuffle temp directory using ALTER SERVER CONFIGURATION SET SHUFFLE STORAGE PATH = 'D:\SQLShuffle'; to a volume with adequate capacity.

Alternative or Verification Steps

  • Re-run the original parallel query or shuffle-dependent workload and confirm Error 3765 no longer appears in the error log after completion.
  • If the issue persists, enable Trace Flag 3766 to capture verbose shuffle diagnostics, then review sp_readerrorlog output for a deeper I/O-level root cause before escalating to Microsoft Support.

How to fix Error 3764 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 3764 (Change Data Capture Conflict)

Why This Error Happens

Error 3764 occurs when an attempt is made to drop, alter, or disable an object (typically a table, schema, or database) that still has Change Data Capture (CDC) enabled on it. SQL Server protects the integrity of CDC-tracked objects by preventing structural changes or removal until CDC is explicitly disabled. This commonly happens during schema migrations, table drops, or database downgrade scripts where CDC cleanup was skipped.

Step-by-Step Resolution Guide

Step 1: Identify Which Tables Have CDC Enabled

  • Run the following query to list all CDC-enabled tables in the affected database:
  SELECT s.name AS SchemaName, t.name AS TableName, t.is_tracked_by_cdc
  FROM sys.tables t
  JOIN sys.schemas s ON t.schema_id = s.schema_id
  WHERE t.is_tracked_by_cdc = 1;
  • Note the exact schema and table name referenced in the error message (%.*ls).

Step 2: Disable CDC on the Specific Table

  • Execute the stored procedure to disable capture instances for the table:
  EXEC sys.sp_cdc_disable_table
      @source_schema = N'dbo',
      @source_name   = N'YourTableName',
      @capture_instance = N'all';
  • Repeat this for every table flagged in Step 1 that is blocking your DROP/ALTER operation.

Step 3: Disable CDC at the Database Level (If Required)

  • If you are attempting to drop the entire database or remove CDC completely, disable it at the database scope:
  USE YourDatabaseName;
  GO
  EXEC sys.sp_cdc_disable_db;
  • Verify that the CDC jobs (capture and cleanup) are removed from SQL Server Agent via SSMS under SQL Server Agent > Jobs.

Step 4: Retry the Original Operation

  • Re-run the original DROP TABLE, ALTER TABLE, or DROP DATABASE command that triggered Error 3764.
  • Confirm the operation completes without the CDC-related block.

Step 5: Re-enable CDC (If Still Needed)

  • If CDC tracking is still required for business logic (e.g., ETL pipelines), re-enable it only after structural changes are finalized:
  EXEC sys.sp_cdc_enable_table
      @source_schema = N'dbo',
      @source_name   = N'YourTableName',
      @role_name     = NULL;

Alternative or Verification Steps

  • Verify the fix by querying sys.tables again to confirm is_tracked_by_cdc = 0 for the target table, and check cdc.change_tables to ensure no orphaned capture instances remain.
  • If disabling CDC via T-SQL fails due to permission errors, ensure the executing account is a member of the db_owner role or has been granted sysadmin rights, as CDC management requires elevated database-level permissions.