sqlrver查看死锁,以及执⾏语句查看死锁
SELECT
DB_NAME(resource_databa_id)AS数据库名,
青青草色定山春
益肾丸
t2.wait_duration_ms 等待时间,
(
SELECT
TEXT
FROM
sys.dm_exec_requests r CROSS apply sys.dm_exec_sql_text (r.sql_handle)
WHERE
r.ssion_id = t1.request_ssion_id
)AS等待者要执⾏的SQL,
t2.blocking_ssion_id [锁定者SID],
(
SELECT
玫瑰花茶的泡法TEXT
FROM
sys.sysprocess p CROSS apply sys.dm_exec_sql_text (p.sql_handle)
WHERE
p.spid = t2.blocking_ssion_id
)锁定者执⾏语句
FROM
sys.dm_tran_locks t1,
转正工作总结sys.dm_os_waiting_tasks t2
WHERE
t1.lock_owner_address = t2.resource_address
查看正在阻塞sql
SELECT TOP10剑圣天赋
[ssion_id],
[request_id],
[start_time]AS'开始时间',
[status]AS'状态',
[command]AS'命令',
罗汉果泡水喝的功效dest.[text]AS'sql语句',
DB_NAME([databa_id])AS'数据库名',
[blocking_ssion_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[ssion_id]>50AND DB_NAME(der.[databa_id])='SeedLandContractDB'
ORDER BY[cpu_time]DESC