SQL Server 2008中查看锁信息
;with tran_locks as(
select resource_type,db_name(resource_database_id) as db_name,resource_description
,object_name(resource_associated_entity_id,resource_database_id) as object_name,request_mode,request_type,request_status,request_session_id
from sys.dm_tran_locks
where resource_type='OBJECT'
union
select resource_type,db_name(resource_database_id) as db_name,resource_description
,object_name(p.object_id,l.resource_database_id) as object_name,request_mode,request_type,request_status,request_session_id
from sys.dm_tran_locks as l
join sys.partitions as p on l.resource_associated_entity_id=p.hobt_id
where resource_type in ('PAGE','KEY')
union
select resource_type,db_name(resource_database_id) as db_name,resource_description
,null as object_name,request_mode,request_type,request_status,request_session_id
from sys.dm_tran_locks as l
where resource_type not in ('OBJECT','PAGE','KEY')
)select l.*,s.login_name,text from tran_locks as l
join sys.dm_exec_sessions as s on s.session_id=l.request_session_id
left join sys.dm_exec_requests as r on r.session_id=s.session_id
cross apply sys.dm_exec_sql_text(sql_handle)
where not (resource_type='DATABASE' and request_mode='S' and request_type='LOCK' and request_status='GRANT')
--and db_name=''
--and object_name=''
order by db_name,object_name,request_type
最新文章
- No.021:Merge Two Sorted Lists
- css3 操作动画要点
- 每天一个linux命令--退出<;符号
- 网络编程-socket
- ArrayList、HashTable、List、Dictionary的演化及如何选择使用
- UINavigationController基本使用
- PHP + ajax 实现异步登录验证
- Let&#39;s go home
- window.showModalDialog以及window.open用法简介
- ppt画笔标记在哪里|ppt中画笔工具功能怎么用?
- POJ2239 二分图最大匹配
- C-KMP
- SVN的命令解析(感觉不错就转了)
- DIV 和 SPAN 区别
- 自学JS
- django的models模型类的常用数据类型和选项
- my live boadband
- 大数据入门到精通10--spark rdd groupbykey的使用
- Deep learning with Python 学习笔记(9)
- linux 后台运行nohup &; ctrl+z