Solved

get history of locks?

Posted on 2014-10-21
8
86 Views
Last Modified: 2014-10-22
is it possible to get dates of when last data locks happened on select queries?
0
Comment
Question by:25112
  • 3
  • 3
  • 2
8 Comments
 
LVL 5

Author Comment

by:25112
ID: 40394642
I checked master.syslockinfo but it does not have any date, but some binary data.

also master.dbo.syslockinfo  is bringing different count than master.sys.syslockinfo. i am assuming lock info is captured per db specific.
0
 
LVL 46

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 300 total points
ID: 40394794
You can't since the available information it's in general a snapshot of what's going on at the moment.
The only way it's to create a database where you can keep all those information for later verification.
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 200 total points
ID: 40394799
The new view is sys.dm_tran_locks.  But you won't find datetime.  I suspect that would be just too much overhead to keep up with.  When SQL gets busy, locks are taken and released at a huge rate, so trying to time stamp all of them would be too damaging to performance.
0
 
LVL 5

Author Comment

by:25112
ID: 40394867
OK, what I get is that unless i profile(r), i cant capture past locks..

then, is there any value to this query, now:
select * from master.dbo.syslockinfo a join master.dbo.sysprocesses b on a.req_spid=b.spid where object_name(a.rsc_objid) is not null
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 200 total points
ID: 40394868
Hmm, I don't really know.  I haven't used those obsolete views in years, so I'm not familiar with them any more.
0
 
LVL 46

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 300 total points
ID: 40394892
That query only works if when you run it the lock still exists. If not, will return nothing.
Like I told you that's only work as snapshot not with stored information. For that you need to create your own monitoring tool or use one as SCOM or another one similar.
0
 
LVL 46

Accepted Solution

by:
Vitor Montalvão earned 300 total points
ID: 40394905
Here's an article how to create your own monitoring tool for deadlocks.
0
 
LVL 5

Author Comment

by:25112
ID: 40396669
thank you
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now