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

Troubleshooting Guide: SQL Server Error 5831

Why This Error Happens

This error occurs when the min server memory configuration value is set higher than the max server memory value in SQL Server’s memory configuration, violating the engine’s internal validation rule. This typically happens due to manual misconfiguration via sp_configure, an automated deployment script applying values in the wrong order, or a failed migration process that left memory settings in an inconsistent state. SQL Server 2025 strictly enforces that minimum memory cannot exceed maximum memory, and will reject the configuration change or fail to start the memory manager correctly until corrected.

Step-by-Step Resolution Guide

Step 1: Verify Current Memory Configuration Values

  • Open SQL Server Management Studio (SSMS) or connect via sqlcmd on your Windows Server 2025 / Windows 11 instance.
  • Run the following query to inspect current settings:
  EXEC sp_configure 'show advanced options', 1;
  RECONFIGURE;
  EXEC sp_configure 'min server memory';
  EXEC sp_configure 'max server memory';
  • Note the current values (config_value and run_value) for both parameters.

Step 2: Correct the Max Server Memory Value First

  • Always set max server memory before adjusting min server memory to avoid the conflict.
  • Run:
  EXEC sp_configure 'max server memory', 8192; -- example: 8 GB in MB
  RECONFIGURE WITH OVERRIDE;
  • Ensure this value is appropriate for your physical RAM, leaving enough headroom for the OS (typically 2-4 GB reserved for Windows Server 2025).

Step 3: Set Min Server Memory to a Valid Value

  • Set min server memory to a value less than or equal to the corrected max server memory.
  • Run:
  EXEC sp_configure 'min server memory', 2048; -- example: 2 GB in MB
  RECONFIGURE WITH OVERRIDE;
  • Confirm the change applied without triggering Error 5831.

Step 4: Restart the SQL Server Service (If Required)

  • Open Services.msc on Windows Server 2025 / Windows 11.
  • Locate SQL Server (MSSQLSERVER) or your named instance.
  • Right-click and select Restart to ensure the new memory configuration is fully applied at the engine level.

Alternative or Verification Steps

  • Re-run EXEC sp_configure 'min server memory'; and EXEC sp_configure 'max server memory'; to confirm min is now less than or equal to max in both config_value and run_value columns.
  • If the error persists after reconfiguration, check the SQL Server Error Log (via SSMS > Management > SQL Server Logs) for conflicting startup parameters or use sp_configure with explicit values in a single transaction to avoid race conditions during automated deployment scripts.