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

Troubleshooting Guide: SQL Server Error 5805 – “Too Few Locks Specified”

Why This Error Happens

This error occurs when the locks configuration option in SQL Server has been manually set to a value below the minimum threshold required for the engine to start and operate safely. SQL Server 2025 requires a baseline number of lock structures to manage concurrency, and setting this value too low (often during an attempt to manually tune memory) prevents the Lock Manager from initializing. This is typically caused by a misconfigured sp_configure 'locks' value or a legacy startup parameter carried over from a server migration or restore.

Step-by-Step Resolution Guide

Step 1: Verify the Current Locks Configuration

  • Open SQL Server Management Studio (SSMS) or connect via sqlcmd using the Dedicated Administrator Connection (DAC) if the instance won’t start normally.
  • Run the following query to check the current setting: EXEC sp_configure 'locks';
  • Note the config_value and run_value columns; a non-zero value below the system minimum (typically 5000) is the likely culprit.

Step 2: Reset the Locks Value to Dynamic (Default)

  • Execute the following T-SQL commands to restore dynamic lock management, which is the recommended setting for SQL Server 2025:
  • EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
  • EXEC sp_configure 'locks', 0; RECONFIGURE;
  • Setting the value to 0 allows SQL Server to dynamically allocate and de-allocate lock memory as needed, preventing manual threshold errors.

Step 3: Start the Instance Using Minimal Configuration (If Service Won’t Start)

  • If the SQL Server service fails to start due to this error, open the Services app (services.msc) on Windows Server 2025/Windows 11.
  • Locate the SQL Server service, right-click, and navigate to Properties.
  • Temporarily add the startup parameter -f (minimal configuration) in the Startup Parameters tab to force the engine to bypass the invalid locks setting.
  • Start the service, apply the fix detailed in Step 2, remove the -f flag, and restart the service normally.

Step 4: Check for Registry or Startup Script Overrides

  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQLServer\Parameters in the Windows Registry.
  • Inspect for any legacy -T trace flags or startup scripts that might be re-applying an old locks value on every restart.
  • Remove or correct any deprecated parameters found in this key.

Alternative or Verification Steps

  • Verify the Fix: Restart the SQL Server service via services.msc or net start MSSQLSERVER and confirm the instance comes online without Error 5805 appearing in the SQL Server Error Log (located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG).
  • Alternative Solution: If the configuration continues to revert, restore the master database from a known-good backup taken prior to the configuration change, as a corrupted master database can sometimes cause configuration values to stick incorrectly.