在SQL Server 2008中查找SQL锁的最佳方法 [英] Best way to find SQL Locks in SQL Server 2008

查看:113
本文介绍了在SQL Server 2008中查找SQL锁的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与SQL Server 2008中与该锁相关联的用户一起查找SQL锁的最佳方法是什么?

解决方案

select * from sys.dm_tran_locks 将列出所有当前的锁(已授予或未决),以及请求的会话ID. select * from sys.dm_exec_sessions 将列出所有当前会话,包括客户端主机和登录名.但是这种方式很少是您想要的.有关更易消化的表格,请使用活动监视器,并查看此处报告的阻止情况.

What is the best way to find the SQL locks along wih the user associated with that lock in SQL Server 2008?

解决方案

select * from sys.dm_tran_locks will list all current locks, granted or pending, along with the requesting session id. select * from sys.dm_exec_sessions will list all current sessions, including the client host and login name. But going this way is very seldom what you want. For a more digestible form, use the Activity Monitor and watch the blocking as reported there.

这篇关于在SQL Server 2008中查找SQL锁的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆