?
Solved

get history of locks?

Posted on 2014-10-21
8
Medium Priority
?
100 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 51

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 1200 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 800 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
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
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
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 800 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 51

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 1200 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 51

Accepted Solution

by:
Vitor Montalvão earned 1200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

764 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