반응형
declare @ms_now bigint
select @ms_now = ms_ticks from sys. dm_os_sys_info ;
select record_id ,
dateadd (ms , - 1 * ( @ms_now - [timestamp] ), GetDate ()) as [EventTime],
SQLProcessUtilization ,
100 - ( SystemIdle + SQLProcessUtilization) as [OtherProcessUtilization] ,
100 - SystemIdle as [Total CPU Usage]
from (
select
record .value ( '(./Record/@id)[1]', 'int') as record_id ,
record .value ( '(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]' , 'int' ) as SystemIdle ,
record .value ( '(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]' , 'int' ) as SQLProcessUtilization ,
[timestamp]
from (
select timestamp , convert ( xml, record) as record
from sys . dm_os_ring_buffers
where ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR'
and record like '%<SystemHealth>%'
) as x
) as y
order by record_id desc
반응형
'MSSQL' 카테고리의 다른 글
sys.dm_db_persisted_sku_features 뷰 (0) | 2025.04.15 |
---|---|
'SET STATISTICS PROFILE ON' 옵션을 사용하여 인덱스 생성 모니터링 (0) | 2025.03.25 |
MS SQL SQLAgentRole (0) | 2025.03.25 |
MSSQL 성능 모니터링 (0) | 2024.10.18 |
LinkedServer 사용 시 distributed transaction error (0) | 2024.09.13 |