查詢鎖定的表,及數據庫

如下:

Select a.req_spid,
db_name(a.rsc_dbid) as 數據庫,
object_name(a.rsc_objid) as 表,
資源類型=case a.rsc_type when 1 then 'NULL 資源(未使用)'
   when 2 then '數據庫'
   when 3 then '文件'
   when 4 then '索引'
   when 5 then '表'
   when 6 then '頁'
   when 7 then '鍵'
   when 8 then '擴展盤區'
   when 9 then 'RID(行 ID)'
   when 10 then '應用程序'
   end,
鎖模式=case a.req_mode when 0 then 'Null'
 when 1 then 'Sch-S(架构性定性)'
 when 2 then 'Sch-M(架构修改)'
 when 3 then 'S(共享鎖)'
 when 4 then 'U更新'
 when 5 then 'X排它鎖'
 when 6 then 'IS意向共享'
 when 7 then ''
 end,
鎖狀態=case a.req_status when 1 then '已授權'
              when 2 then '正在轉換'
 when 3 then '正在等待'
 end,
對象類型=case a.req_ownertype when 1 then '事務'
 when 2 then '遊標'
 when 3 then '會話'
 end,
     BlkBy         =
          CASE               isnull(convert(char(5),b.blocked),'0')
                When '0' Then '.'
          Else            isnull(convert(char(5),b.blocked),'0')
           END,

用戶=user_name(b.uid),
b.cpu,
b.physical_io,
b.open_tran,
b.status,
b.hostname,
b.program_name,
b.cmd,
b.nt_username,
b.loginame,
b.blocked
 from master..syslockinfo as a,master..sysprocesses as b
where a.rsc_dbid = b.dbid and
a.req_spid = b.spid
order by req_spid

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值