今天看监控,发现服务器CPU比往常高几乎一倍,发现是前一天开始升高的。
进去服务器查看系统及SqlServer最近30分钟的CPU使用情况(只是取一段时间看看CPU)
DECLARE @ts_now bigint = (SELECT cpu_ticks/(cpu_ticks/ms_ticks) FROM sys.dm_os_sys_info WITH (NOLOCK)); SELECT TOP(30) SQLProcessUtilization AS [SQL Server Process CPU Utilization], SystemIdle AS [System Idle Process], 100 - SystemIdle - SQLProcessUtilization AS [Other Process CPU Utilization] ,DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS [Event Time] 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 WITH (NOLOCK) WHERE ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR' AND record LIKE N'%<SystemHealth>%' ) AS x ) AS y ORDER BY record_id DESC OPTION (RECOMPILE);
可以看到,SqlServer的CPU在40%~50%的范围,跟往常一样,不变,不是SqlServer引起的CPU升高。
打开任务管理器按CPU使用比例排序,发现 explorer.exe占用CPU 10%~30%.
explorer.exe 一般情况下都为0,偶尔才大于1%,可以发现主要是explorer.exe 的影响.
点击 “用户” ,发现有一个不活动的用户并未断开,直接右键 注销该用户。
完后发现, explorer.exe 的CPU已经明显下降了!
过些时间看看监控,CPU下来了。explorer.exe的CPU升高,主要还是用户未注销。