SQLSERVER服务器的CPU 100%紧急对应:查询占CPU高的session并KILL

Posted szone

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQLSERVER服务器的CPU 100%紧急对应:查询占CPU高的session并KILL相关的知识,希望对你有一定的参考价值。

---查询使用CPU高的session
SELECT TOP 10
[session_id],
[request_id],
[start_time] AS ‘开始时间‘,
[status] AS ‘状态‘,
[command] AS ‘命令‘,
dest.[text] AS ‘sql语句‘,
DB_NAME([database_id]) AS ‘数据库名‘,
[blocking_session_id] AS ‘正在阻塞其他会话的会话ID‘,
[wait_type] AS ‘等待资源类型‘,
[wait_time] AS ‘等待时间‘,
[wait_resource] AS ‘等待的资源‘,
[reads] AS ‘物理读次数‘,
[writes] AS ‘写次数‘,
[logical_reads] AS ‘逻辑读次数‘,
[row_count] AS ‘返回结果行数‘
FROM sys.[dm_exec_requests] AS der
CROSS APPLY
sys.[dm_exec_sql_text](der.[sql_handle]) AS dest
WHERE [session_id]>50 AND DB_NAME(der.[database_id])=‘数据库名‘
ORDER BY [cpu_time] DESC


---杀掉session

kill [session_id]

例:kill 90

 

以上是关于SQLSERVER服务器的CPU 100%紧急对应:查询占CPU高的session并KILL的主要内容,如果未能解决你的问题,请参考以下文章

Oracle 11g CPU负载很高紧急处理负载100%

程序猿是如何解决SQLServer占CPU100%的

CPU持续100%分析并解决

CPU持续100%分析并解决

CPU持续100%分析并解决

SqlServer优化:当数据量查询不是特别多,但数据库服务器的CPU资源一直100%时,如何优化?