Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to find CPU usage for SQL server 2005 Server

share|improve this question
add comment

migrated from stackoverflow.com Aug 19 '09 at 6:47

This question came from our site for professional and enthusiast programmers.

4 Answers

From MSDN Article on Troubleshooting Performance Problems in SQL Server 2005

The following query gives you a high-level view of which currently cached batches or procedures are using the most CPU. The query aggregates the CPU consumed by all statements with the same plan__handle (meaning that they are part of the same batch or procedure). If a given plan_handle has more than one statement, you may have to drill in further to find the specific query that is the largest contributor to the overall CPU usage.

select top 50  
    sum(qs.total_worker_time) as total_cpu_time,  
    sum(qs.execution_count) as total_execution_count, 
    count(*) as  number_of_statements,  
    qs.plan_handle  
from  
    sys.dm_exec_query_stats qs 
group by qs.plan_handle 
order by sum(qs.total_worker_time) desc
share|improve this answer
    
How do I get the plan_handle i.e. the query for that handle ? –  Anonymous Aug 18 '09 at 22:38
add comment

A few more:

  • WMI
  • Peformance Counters
  • SNMP
share|improve this answer
add comment

A few ways come to mind

  • TaskManager
  • Process Explorer
  • Get-Process sqlservr |select CPU
  • WMI
  • Performance Counters via PerfMon
share|improve this answer
    
Task Manager ..good ..thaks Scott –  Anonymous Aug 18 '09 at 22:34
    
Performance counters ? where are they located ? –  Anonymous Aug 18 '09 at 22:40
    
Start->Run.. Type: Perfmon –  Nick Kavadias Aug 19 '09 at 6:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.