How can we help you today? How can we help you today?
RofL

Activity overview

Latest activity by RofL

OK I took the results from the query above and put them into a temp table. Then I have put together a script that will group the locking by table and locking mode. This gives a good starting point to show the frequency of locks. The locking mode and locking level here is not complete, it only covers the types of locks I've got in my table. --set a start and end date to get number of locks within a date range DECLARE @DaysBaselineStart INT = 10 DECLARE @DaysBaselineEnd INT = 0 --only key and page locks are accounted for in the cte below --row locks are also possible, as are db and table locks --remember, row locks never happen on indexes and key locks never occur on heaps --there are also key range locks reported. This happens because transactions are serializable ; WITH keylock AS ( SELECT SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex('objectname=', LT.Cluster_SqlServer_Error_Text) + 11, charindex('.', LT.Cluster_SqlServer_Error_Text) - charindex('objectname=', LT.Cluster_SqlServer_Error_Text) - 11) AS [Database] ,SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex('objectname', LT.Cluster_SqlServer_Error_Text) + 11, charindex('indexname', LT.Cluster_SqlServer_Error_Text) - charindex('objectname', LT.Cluster_SqlServer_Error_Text) - 11) AS [LockedObject] ,SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex('indexname=', LT.Cluster_SqlServer_Error_Text) + 10, charindex(' id=', LT.Cluster_SqlServer_Error_Text) - charindex('indexname=', LT.Cluster_SqlServer_Error_Text) - 10) AS [LockedIndex] ,SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex(' mode=', LT.Cluster_SqlServer_Error_Text) + 6, charindex(' associatedObjectId', LT.Cluster_SqlServer_Error_Text) - charindex(' mode=', LT.Cluster_SqlServer_Error_Text) - 6) AS [LockType] ,LT.[CollectionDate_DateTime] AS [CollectionDate_DateTime] FROM #LockTable_2110 LT WHERE Cluster_SqlServer_Error_Text LIKE '%keylock%' ) ,pagelock AS ( SELECT SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex('objectname=', LT.Cluster_SqlServer_Error_Text) + 11, charindex('.', LT.Cluster_SqlServer_Error_Text) - charindex('objectname=', LT.Cluster_SqlServer_Error_Text) - 11) AS [Database] ,SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex('objectname', LT.Cluster_SqlServer_Error_Text) + 11, charindex(' id=', LT.Cluster_SqlServer_Error_Text) - charindex('objectname', LT.Cluster_SqlServer_Error_Text) - 11) AS [LockedObject] ,'No Index - page lock' AS [LockedIndex] ,SUBSTRING(LT.Cluster_SqlServer_Error_Text, charindex(' mode=', LT.Cluster_SqlServer_Error_Text) + 6, charindex(' associatedObjectId', LT.Cluster_SqlServer_Error_Text) - charindex(' mode=', LT.Cluster_SqlServer_Error_Text) - 6) AS [LockType] ,LT.[CollectionDate_DateTime] AS [CollectionDate_DateTime] FROM #LockTable_2110 LT WHERE Cluster_SqlServer_Error_Text LIKE '%pagelock%' ) SELECT K.[Database] ,K.[LockedObject] ,K.[LockedIndex] ,CASE K.[LockType] WHEN 'S' THEN 'SHARED' WHEN 'U' THEN 'UPDATE' WHEN 'IX' THEN 'INTENT EXCLUSIVE' WHEN 'X' THEN 'EXCLUSIVE' WHEN 'IS' THEN 'INTENT SHARED' WHEN 'SIX' THEN 'SHARED INTENT EXCLUSIVE' WHEN 'UIX' THEN 'UPDATE INTENT EXCLUSIVE' WHEN 'IU' THEN 'INTENT UPDATE' WHEN 'RangeS-U' THEN 'SERIALIZABLE UPDATE SCAN' WHEN 'RangeI-N' THEN 'INSERT RANGE, NULL RESOURCE LOCK' WHEN 'RangeX-X' THEN 'EXCLUSIVE RANGE, EXCLUSIVE RESOURCE LOCK' ELSE K.[LockType] END AS [LockType] ,COUNT(1) AS Recurrence FROM keylock K WHERE K.[CollectionDate_DateTime] > DATEADD(DAY, - @DaysBaselineStart, GETDATE()) AND K.[CollectionDate_DateTime] < DATEADD(DAY, - @DaysBaselineEnd, GETDATE()) GROUP BY [Database] ,[LockedObject] ,[LockedIndex] ,[LockType] UNION ALL SELECT P.[Database] ,P.[LockedObject] ,P.[LockedIndex] ,CASE P.[LockType] WHEN 'S' THEN 'SHARED' WHEN 'U' THEN 'UPDATE' WHEN 'IX' THEN 'INTENT EXCLUSIVE' WHEN 'X' THEN 'EXCLUSIVE' WHEN 'IS' THEN 'INTENT SHARED' WHEN 'SIX' THEN 'SHARED INTENT EXCLUSIVE' WHEN 'UIX' THEN 'UPDATE INTENT EXCLUSIVE' WHEN 'IU' THEN 'INTENT UPDATE' WHEN 'RangeS-U' THEN 'SERIALIZABLE UPDATE SCAN' WHEN 'RangeI-N' THEN 'INSERT RANGE, NULL RESOURCE LOCK' WHEN 'RangeX-X' THEN 'EXCLUSIVE RANGE, EXCLUSIVE RESOURCE LOCK' ELSE P.[LockType] END AS [LockType] ,COUNT(1) AS Recurrence FROM pagelock P WHERE P.[CollectionDate_DateTime] > DATEADD(DAY, - @DaysBaselineStart, GETDATE()) AND P.[CollectionDate_DateTime] < DATEADD(DAY, - @DaysBaselineEnd, GETDATE()) GROUP BY [Database] ,[LockedObject] ,[LockedIndex] ,[LockType] ORDER BY [Database] ,[LockedObject] ,[LockedIndex] ,[Recurrence] DESC / comments
OK I took the results from the query above and put them into a temp table. Then I have put together a script that will group the locking by table and locking mode. This gives a good starting point ...
0 votes
Find Objects with Most deadlocks
Hi, I'm monitoring a Microsoft Dynamics NAV database with SQL Monitor, and whilst very happy SQL Monitor is alerting on a heck of a lot of deadlocks/blocks on the NAV database (100's a day.) I'm wo...
2 followers 3 comments 0 votes
Error When Installing SQL Monitor 4
Hi, I'm trying to install SQL Monitor on a Windows Server 2012 R2 box running a SQL Server 0214 instance. When I get to the point of connecting to an instance to create a new Monitor database I get...
2 followers 2 comments 0 votes
Brilliant thanks Petey. I thought this might be the case, but always best to check these things first, especially if you have no place to test this out first! / comments
Brilliant thanks Petey. I thought this might be the case, but always best to check these things first, especially if you have no place to test this out first!
0 votes
Redgate Backup and MS Log Shipping
Hi chaps, we use native Microsoft technologies for both full backups and Log Shipping, however we want to move to using SQL Backup 7 for the full backups. Can we continue to use the native Microsof...
2 followers 2 comments 0 votes