sp_lock–查询哪个进程锁表了,spid:进程ID,ObjId:对象ID
EXEC sp_executesql N‘KILL [spid]‘–杀进程
select object_name([ObjId])–查询哪张表被锁
使用sql语句进行查看
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type=‘OBJECT‘
时间: 2024-11-08 21:28:23