Complete a Server Assessment – Additional Memory Counters

Below you will find the code for the Auto Tuning Settings of a database.  Simply select the text and copy to the Clipboard.

Return to Code Library Main Page

FROM sys.dm_os_performance_counters
WHERE [counter_name] IN (‘Page Life Expectancy’, ‘Stolen Server Memory (KB)’, ‘Total Server Memory (KB)’, ‘Target Server Memory (KB)’, ‘SQL Cache Memory (KB)’, ‘Optimizer Memory (KB)’,
‘Memory Grants Outstanding’, ‘Memory Grants Pending’, ‘Free Memory (KB)’, ‘Connection Memory (KB)’, ‘Lock Memory (KB)’, ‘Cursor memory usage’, ‘Database pages’, ‘Checkpoint pages/sec’,
‘Page reads/sec’, ‘Page writes/sec’, ‘Batch Requests/sec’, ‘SQL Compilations/sec’, ‘SQL re-Compilations/sec’, ‘Free list stalls/sec’, ‘Lazy writes/sec’, ‘Granted Workspace Memory (KB)’,
‘Maximum Workspace Memory (KB)’, ‘Average Wait Time (ms)’, ‘Lock Waits/sec’, ‘Active cursors’, ‘Cursor Requests/sec’, ‘Memory broker clerk size’, ‘Pressure evictions/sec’) AND
instance_name IN (, ‘_total’)

This code was written using the Microsoft SQL Server documentation.  If you find that this code was copied from else where, please let me know so I can remove it or give proper credit.