博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

sqlserver2005里查询当前锁的状态。

Posted on 2007-08-22 14:09  懒人ABC  阅读(520)  评论(0编辑  收藏  举报

select t1.* ,t2.name from sys.dm_tran_locks t1
inner join sys.tables t2
on
t1.resource_associated_entity_id = t2.object_id

where resource_type = 'OBJECT'



sys.dm_tran_locks:所有锁的信息
sys.tables:所有表的信息

主要可以查询锁的类型,状态。