dataiotech Labs
Scripts Library/sqlserver/#56
Script #56
sqlserver
Monitoringread-onlyMin Version: 2012

SQL Server Page Life Expectancy and Memory Status

Shows PLE, Memory Grants Pending and memory settings. Tells you quickly whether there is memory pressure.

#memory#page-life-expectancy#buffer-pool
sqlserver · sql
SELECT counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name IN ('Page life expectancy','Memory Grants Pending','Total Server Memory (KB)','Target Server Memory (KB)')
  AND (object_name LIKE '%Buffer Manager%' OR object_name LIKE '%Memory Manager%');

SELECT physical_memory_kb / 1024 AS os_memory_mb,
       (SELECT CAST(value_in_use AS INT) FROM sys.configurations WHERE name = 'max server memory (MB)') AS max_server_memory_mb
FROM sys.dm_os_sys_info;
Operational Notes & Remediation Guidance

PLE consistently below 300 seconds per 4GB of buffer pool indicates severe memory pressure and cache thrashing.

Production Safety & Execution Standards
  • This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
  • Prior to executing on production systems under high load, verify the target database version (Min. Version: 2012).
  • Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.

Engineering Triad: Related Runbooks & Incident Response

Which production incidents and emergency drills execute this script as a diagnosis step?

Runbook Library (63)
Related Alerts & Metrics
M25SQL Server Page Life Expectancy (PLE)SQL Server
M26SQL Server Memory Grants PendingSQL Server