--每秒死锁数量
SELECT *
FROM sys.dm_os_performance_counters
WHERE counter_name liKE 'Number of Deadlocksc%';
--查询当前阻塞
WITH CTE_SID ( BSID,SID,sql_handle ) AS ( SELECT blocking_session_ID, session_ID, sql_handle FROM sys.dm_exec_requests WHERE blocking_session_ID <> 0 UNION ALL SELECT A.blocking_session_ID, A.session_ID, A.sql_handle FROM sys.dm_exec_requests A JOIN CTE_SID B ON A.SESSION_ID = B.BSID ) SELECT C.BSID, C.SID, S.login_name, S.host_name, S.status, S.cpu_time, S.memory_usage, S.last_request_start_time, S.last_request_end_time, S.logical_reads, S.row_count, q.text FROM CTE_SID C JOIN sys.dm_exec_sessions S ON C.sID = s.session_ID CROSS APPLY sys.dm_exec_sql_text(C.sql_handle) Q ORDER BY sID 总结 以上是内存溢出为你收集整理的SQLServer 2008数据库查看死锁、堵塞的SQL语句全部内容,希望文章能够帮你解决SQLServer 2008数据库查看死锁、堵塞的SQL语句所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)