Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2245662
  • 博文数量: 310
  • 博客积分: 6853
  • 博客等级: 准将
  • 技术积分: 2833
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-04 16:41
文章分类

全部博文(310)

文章存档

2013年(17)

2012年(42)

2011年(76)

2010年(71)

2009年(99)

2007年(2)

2006年(1)

2005年(2)

分类: 数据库开发技术

2009-09-02 22:31:43

基本信息查询
从sys.dm_tran_lock中可以查到一些有用信息。
SELECT resource_type, resource_description,
resource_associated_entity_id, request_mode, request_status
FROM sys.dm_tran_locks
WHERE resource_associated_entity_id > 0


对查询范围的限制,查自己想要的信息。
 resource_associated_entity_id > 0
I am interested only in locks that are actually held on data resources

可以增加更多的过滤条件。

结果样例:

resource_type resource_description resource_associated_entity_id request_mode
 request_status
------------- -------------------- ------------------------------ ------------ -------------

KEY (92007ad11d1d) 72057594045857792 X GRANT
PAGE 1:5280 72057594045857792 IX GRANT
OBJECT 722101613 IX GRANT



字段含义:
resource_associated_entity_id is an allocation_unit_id. For the OBJECT locks, the resource_associated_entity_id is a table

继续查找响应值的具体信息:
SELECT object_name(722101613)

既能查出已获取的资源,也可以查看在等待的资源,例如:

resource_type resource_description resource_associated_entity_id request_mode request_status
------------- -------------------- ------------------------------- ------------ -------------

OBJECT 722101613 X WAIT














阅读(1738) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~