• 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

  • 相关阅读:
    selenium爬取沃尔玛分类和商品详情
    linux下部署redis
    linux系统基本操作命令
    Scrapy & Django项目
    爬虫爬取百度搜狗图片持久化存储
    django + vue 简单配置登录注册及分页和实例化
    vue安装及常用属性
    vue跨域配制
    Django中配置全文检索
    Django框架知识点简单总结(1)
  • 原文地址:https://www.cnblogs.com/yangdunqin/p/5316789.html
Copyright © 2020-2023  润新知