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

Troubleshooting Guide: Error 5005 – Invalid Recovery Time Specification in SQL Server 2025

Why This Error Happens

Error 5005 occurs when the recovery interval configuration option in SQL Server is set to a value outside the acceptable range (typically 0 to 2,147,483,647 seconds for the advanced setting, or a much smaller practical range in minutes for the basic setting). This usually happens due to a misconfigured sp_configure command, a corrupted or manually edited configuration value in the system catalog, or an automated deployment script that passed a negative or malformed integer. Since SQL Server validates this value during database recovery or startup, an out-of-bounds entry prevents the Database Engine from calculating checkpoint intervals correctly, triggering this error.

Step-by-Step Resolution Guide

Step 1: Verify the Current Recovery Interval Setting

  • Open SQL Server Management Studio (SSMS) or Azure Data Studio and connect to the affected instance.
  • Run the following query to inspect the current value:
EXEC sp_configure 'recovery interval (min)';
  • Check if the run_value or config_value is negative, null, or exceeds the maximum threshold (2147483647 for advanced settings).

Step 2: Reset the Recovery Interval to a Valid Default

  • Enable advanced options first, since recovery interval may require elevated configuration visibility:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
  • Set the recovery interval back to the SQL Server default (0, which lets SQL Server auto-manage it):
EXEC sp_configure 'recovery interval (min)', 0;
RECONFIGURE WITH OVERRIDE;
  • If a specific custom value is required by your workload, ensure it does not exceed documented limits (generally 0–32767 minutes depending on build).

Step 3: Restart the SQL Server Service

  • On Windows Server 2025 or Windows 11, open SQL Server Configuration Manager.
  • Navigate to SQL Server Services, right-click the instance (e.g., SQL Server (MSSQLSERVER)), and select Restart.
  • Alternatively, use PowerShell with elevated privileges:
Restart-Service -Name 'MSSQLSERVER' -Force

Step 4: Check for Registry or Startup Parameter Overrides

  • Open regedit and navigate to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQLServer\Parameters
  • Confirm no startup trace flags or legacy parameters are forcing a deprecated recovery interval value.
  • Remove any suspicious -T trace flag entries related to recovery timing if present, then restart the service again.

Step 5: Review SQL Server Error Logs for Residual Corruption

  • Locate the error log at:
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG
  • Search for repeated 5005 entries to confirm the timestamp aligns with your configuration change.
  • If corruption in msdb or master system tables is suspected, run DBCC CHECKDB against master to rule out catalog corruption.

Alternative or Verification Steps

  • Confirm the fix by restarting the SQL Server instance and checking the ERRORLOG for successful recovery messages without Error 5005 reappearing.
  • If the issue persists after resetting via sp_configure, rebuild the master database configuration using setup.exe /ACTION=REBUILDDATABASE (only as a last resort, with a full backup beforehand).