Wednesday, 18 September 2013

Query to show Performance Counters that SQL Server exposes to Windows OS

T-SQL query that can quickly show some valuable performance counters from SQL Server. The values in this system view are actual, they get refreshed many times a second.

SELECT *
FROM master.sys.dm_os_performance_counters
WHERE
instance_name = 'MyDbName'
OR OBJECT_NAME = 'SQLServer:General Statistics'

OR counter_name = 'Batch Requests/sec'

Troubleshooting: if this query returns nothing then you may have Performance Counters disabled. Run this to verify, it should return at least one row : SELECT COUNT(*) from sys.dm_os_performance_counters;


No comments:

Post a Comment