Why This Error Happens
SQL Server 2025 raises Error 5866 when the configured Max server memory (MB) value exceeds the size of the Buffer Pool Extension (BPE) file. Because the buffer pool extension cannot address more memory than its own file size, the Database Engine disables BPE the next time the service restarts. This is strictly a configuration sizing mismatch between two settings — it is not caused by file corruption, permissions, or network/port issues, although permissions can prevent a fix from being applied correctly.
Step-by-Step Resolution Guide
Step 1: Record the Current Memory and BPE Values
- Connect to the instance with SQL Server Management Studio (SSMS) or
sqlcmdand enable advanced options so you can read the current setting:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory';
- Note the
run_value(in MB) returned — this is the value referenced in the Error 5866 message. - Keep the exact error text from the SQL Server log open for reference, since it also reports the current BPE size in MB.
Step 2: Confirm the Buffer Pool Extension Configuration
- Query the buffer pool extension DMV to see the current file path, state, and size:
SELECT path, state_description, current_size_in_kb / 1024 AS current_size_mb
FROM sys.dm_os_buffer_pool_extension_configuration;
- Confirm the
pathcolumn shows the actual.BPEfile location that was configured for this instance (there is no fixed default path — it is defined by whoever originally ranALTER SERVER CONFIGURATION SET BUFFER POOL EXTENSION ON). - Verify that file still exists at that path using File Explorer or PowerShell:
Test-Path "E:\SQLBPE\SQLServerBPE.BPE"
Step 3: Choose a Corrective Action
- Option A — Reduce Max server memory (MB) so it is less than or equal to the BPE size:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory', 8192; -- example: set to 8192 MB
RECONFIGURE;
- Option B — Increase the BPE size so it is greater than or equal to Max server memory. Buffer Pool Extension cannot be resized in place; it must be turned off and re-enabled with the new size:
ALTER SERVER CONFIGURATION SET BUFFER POOL EXTENSION OFF;
ALTER SERVER CONFIGURATION SET BUFFER POOL EXTENSION ON
(FILENAME = 'E:\SQLBPE\SQLServerBPE.BPE', SIZE = 40 GB);
- Choose whichever option matches your hardware constraints — Option A if you cannot add more disk space for the BPE file, Option B if you have fast SSD/NVMe storage available and want to preserve the higher memory ceiling.
Step 4: Restart the SQL Server Service
- Restart the instance using PowerShell (adjust the service name for named instances):
Restart-Service -Name 'MSSQLSERVER' -Force
- For a named instance, the service name follows the
MSSQL$<InstanceName>pattern:
Restart-Service -Name 'MSSQL$INSTANCE01' -Force
- Alternatively, open
services.msc, locate SQL Server (MSSQLSERVER) or SQL Server (InstanceName), and restart it from the Windows Services console. - Confirm the service returns to a Running state before proceeding.
Step 5: Review the SQL Server Error Log
- Open the current error log file directly from its default installation path (adjust the version/instance folder name to match your installation):
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG
- Alternatively, query the log from within SQL Server without leaving SSMS:
EXEC xp_readerrorlog 0, 1, N'5866';
- Confirm Error 5866 is no longer generated during the startup sequence that follows your change.
Alternative or Verification Steps
- Verify the final configuration by re-running both checks together and comparing the values directly:
EXEC sp_configure 'max server memory';
SELECT path, state_description, current_size_in_kb / 1024 AS current_size_mb
FROM sys.dm_os_buffer_pool_extension_configuration;
- Confirm
state_descriptionreadsENABLEDand that the Max server memory value is less than or equal tocurrent_size_mb. - If the error persists after restart:
- Check that the SQL Server service account (visible in
services.mscunder the Log On As column) has Read/Write/Modify NTFS permissions on the folder containing the.BPEfile. - Confirm the drive hosting the BPE file has enough free space to accommodate the configured
SIZEvalue — insufficient disk space will silently prevent BPE from re-enabling. - Re-run
EXEC sp_configure 'max server memory';to confirm the value you set in Step 3 was actually committed, sinceRECONFIGUREmust complete successfully and some environments requireRECONFIGURE WITH OVERRIDEif a configuration dependency check fails.