死锁查询
死锁查询语句
1 WITH CTE_SID ( BSID, SID, sql_handle ) 2 AS ( SELECT blocking_session_id , 3 session_id , 4 sql_handle 5 FROM sys.dm_exec_requests 6 WHERE blocking_session_id <> 0 7 UNION ALL 8 SELECT A.blocking_session_id , 9 A.session_id , 10 A.sql_handle 11 FROM sys.dm_exec_requests A 12 JOIN CTE_SID B ON A.SESSION_ID = B.BSID 13 ) 14 SELECT C.BSID , 15 C.SID , 16 S.login_name , 17 S.host_name , 18 S.status , 19 S.cpu_time , 20 S.memory_usage , 21 S.last_request_start_time , 22 S.last_request_end_time , 23 S.logical_reads , 24 S.row_count , 25 q.text 26 FROM CTE_SID C 27 JOIN sys.dm_exec_sessions S ON C.sid = s.session_id 28 CROSS APPLY sys.dm_exec_sql_text(C.sql_handle) Q 29 ORDER BY sid
作者:刘彬
出处:http://www.cnblogs.com/Albin/
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面