How To Check SQL Server CPU Utilization History In SQL Server 2019

preview_player
Показать описание
Script:
SQL Server CPU Utilization history report for last N minutes:

/***** Script: SQL Server CPU Utilization report from last N minutes *****/
/***** Support: SQL Server 2008 and Above *****/
/***** Tested On: SQL Server 2008 R2 and 2014 *****/
/***** Output:
SQLServer_CPU_Utilization: % CPU utilized from SQL Server Process
System_Idle_Process: % CPU Idle - Not serving to any process
Other_Process_CPU_Utilization: % CPU utilized by processes otherthan SQL Server
Event_Time: Time when these values captured
*****/

DECLARE @ts BIGINT;
DECLARE @lastNmin TINYINT;
SET @lastNmin = 10;
SQLProcessUtilization AS [SQLServer_CPU_Utilization],
SystemIdle AS [System_Idle_Process],
100 - SystemIdle - SQLProcessUtilization AS [Other_Process_CPU_Utilization],
[timestamp]
FROM (SELECT[timestamp], convert(xml, record) AS [record]
WHERE ring_buffer_type =N'RING_BUFFER_SCHEDULER_MONITOR'AND record LIKE'%%')AS x )AS y
ORDER BY record_id DESC;

Рекомендации по теме
Комментарии
Автор

If there is a query to check what is the other process/job consuming cpu it will be very useful to show to users/customers.

VenkataSivaKumarReddy
Автор

other process cpu utilization what it means you have wrongly copied columns what is system idle process

ravibathula