select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type=‘OBJECT‘ kill spid
每次服务激活时检查。有点蒙,是不是该这样。有什么好办法请告诉我。
测试做一个deadlock:
BEGIN TRANSACTION--开始事务 update Sessions set Created=GETDATE() where sessionid=‘001‘ WAITFOR DELAY ‘02:00‘; select * from Sessions where sessionid=‘001‘
select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type=‘OBJECT‘
根据得到的spid进行kill
kill spid
原文地址:https://www.cnblogs.com/usegear/p/11565483.html
时间: 2024-11-18 12:26:24