SQL 查看锁起来的表,|| 解锁锁起来表

查看锁的表:
select object_name(resource_associated_entity_id) as tableName, request_session_id as pid from sys.dm_tran_locks
where resource_type = 'OBJECT' and object_name(resource_associated_entity_id) is not null


select object_name(resource_associated_entity_id) as tableName, request_session_id as pid from sys.dm_tran_locks
where resource_type = 'OBJECT' and object_name(resource_associated_entity_id) is not null


--要解锁的表ID
kill 107

 

 

 

 

 

//查询死锁
select dbid,* from sys.sysprocesses
where 1=1
and spid >50
and blocked <> 0
 
 //查出表名
 
 Select name,dbid from master.sys.sysdatabases 
 
//输入死锁的语句
 
 dbcc inputbuffer(54)
kill  杀死死锁

 

posted @ 2020-08-17 12:54  自不量力  阅读(180)  评论(0编辑  收藏  举报