SQL Server error 802, with a severity level of 17, is related to insufficient memory when attempting to allocate system resources. This issue typically occurs when the available physical or virtual memory (or configured memory in SQL Server) is exhausted.
The full error message typically reads, "There is insufficient memory available in the buffer pool."
What triggers for Error 802:
- Lack of sufficient system resources (physical memory or virtual address space).
- Misconfigured max server memory (`max_server_memory`) resulting in constraints on allocations.
- Excessive parallel query execution plans consuming too many threads and resources.
- Fragmentation in the Buffer Pool causing inefficient allocation.
- External processes running on the same server consuming high amounts of RAM, reducing what's left for SQL Server.
SQL Server utilizes a Buffer Pool as part of its internal architecture to manage database pages, caching data from files into memory to optimize reads and writes efficiently.
When you encounter this error:
- It signals that either there isn’t enough physical/virtual RAM available for the tasks being executed, or;
- configuration limits prevent adequate availability.
Severity 17 indicates "an environment-related problem," meaning it's not directly caused by code issues but rather inadequate hardware resource management or improper configurations within your environment.
Analyze Current Memory Usage Use Dynamic Management Views (DMVs) to identify how much total memory is used by each process component inside SQL Server along with external pressures.
SELECT total_physical_memory_kb / 1024 AS Total_Physical_Memory_MB, available_physical_memory_kb / 1024 AS Available_Physical_Memory_MB, total_page_file_kb / 1024 AS Total_Page_File_MB, available_page_file_kb / 1024 AS Available_Page_File_MB, system_memory_state_desc
FROM sys.dm_os_sys_memory;