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

Troubleshooting Guide: SQL Server Error 9131 – Stats Messages Disabled at Startup

Why This Error Happens

Error 9131 occurs when SQL Server’s statistics messaging/diagnostic feature is explicitly disabled using a startup trace flag or configuration setting, preventing the stats collection subsystem from initializing. This is commonly caused by trace flag 3136 or similar diagnostic-suppression flags being passed to the SQL Server service at boot, often set intentionally for performance tuning or inherited from a misconfigured startup script. It can also occur if the SQL Server resource governor or diagnostic subsystem fails to allocate memory for the stats messaging queue due to resource constraints on the host.

Step-by-Step Resolution Guide

Step 1: Verify Current Startup Parameters

  • Open SQL Server Configuration Manager on Windows Server 2025 / Windows 11.
  • Navigate to SQL Server Services > right-click your instance > Properties > Startup Parameters tab.
  • Check for any trace flags (e.g., -T3136, -T3604) that may be suppressing diagnostic/stats messaging.
  • Cross-reference with the registry path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQLServer\Parameters.

Step 2: Remove or Modify the Offending Trace Flag

  • In the Startup Parameters tab, select the problematic flag (e.g., -T3136) and click Remove.
  • Click Apply, then restart the SQL Server service for changes to take effect.
  • Alternatively, edit via command line: net stop MSSQLSERVER && net start MSSQLSERVER /T-3136 (if supported in your build).

Step 3: Check SQL Server Error Log for Confirmation

  • Open the latest error log located at: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
  • Search for the startup banner and confirm no trace flags related to stats suppression are listed.
  • Look for the line: SQL Server is starting at normal priority base without any stats-disabling flag references.

Step 4: Reconfigure via sp_configure (If Applicable)

  • Open SQL Server Management Studio (SSMS) and connect to the instance.
  • Run: EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
  • Check for any custom configuration overriding stats messaging: EXEC sp_configure 'extended events enabled';
  • Reset to default if misconfigured, then RECONFIGURE WITH OVERRIDE;

Step 5: Restart the SQL Server Service

  • Restart via Configuration Manager or PowerShell: Restart-Service -Name 'MSSQLSERVER' -Force
  • Confirm the service starts cleanly without generating Error 9131 in the Event Viewer under Windows Logs > Application.

Alternative or Verification Steps

  • Run DBCC TRACESTATUS(-1); in SSMS to list all currently active trace flags and confirm the stats-disabling flag is no longer active.
  • If the error persists, check Windows Event Viewer (Event ID 9131 under Application logs) for correlating resource allocation failures, and consider increasing the SQL Server service account’s memory allocation via Resource Governor settings.