forked from MasayukiOzawa/SQLServer-Util
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f23481b
commit 77e57a6
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
SELECT | ||
tl.request_session_id, | ||
tl.resource_type, | ||
tl.request_mode, | ||
tl.request_type, | ||
tl.request_status, | ||
tl.request_owner_type, | ||
OBJECT_NAME(p.object_id) AS object_name, | ||
i.name, | ||
er.command, | ||
er.wait_type, | ||
COUNT(*) AS lock_count | ||
FROM | ||
sys.dm_tran_locks AS tl WITH(NOLOCK) | ||
INNER JOIN | ||
sys.dm_exec_requests AS er WITH(NOLOCK) | ||
ON | ||
er.session_id = tl.request_session_id | ||
AND | ||
er.wait_type LIKE 'REDO%' | ||
LEFT JOIN | ||
sys.partitions AS p WITH(NOLOCK) | ||
ON | ||
p.hobt_id = tl.resource_associated_entity_id | ||
LEFT JOIN | ||
sys.indexes AS i WITH(NOLOCK) | ||
ON | ||
i.object_id = p.object_id AND i.index_id = p.index_id | ||
GROUP BY | ||
tl.request_session_id, | ||
tl.resource_type, | ||
tl.request_mode, | ||
tl.request_type, | ||
tl.request_status, | ||
tl.request_owner_type, | ||
p.object_id, | ||
i.name, | ||
er.command, | ||
er.wait_type | ||
GO |