欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

SqlServer查看锁

程序员文章站 2024-01-13 18:44:10
...

SELECT request_session_id sessionid, resource_type type, resource_database_id dbid, OBJECT_NAME(resource_associated_entity_id, resource_database_id) objectname, request_mode rmode, request_status rstatus FROM sys.dm_tran_locks WHERE resour

SELECT request_session_id sessionid,
resource_type type,
resource_database_id dbid,
OBJECT_NAME(resource_associated_entity_id, resource_database_id) objectname,
request_mode rmode,
request_status rstatus
FROM sys.dm_tran_locks
WHERE resource_type IN ('DATABASE', 'OBJECT')

-- exec('kill 51') 解除锁 51-> dbid