Solved

get history of locks?

Posted on 2014-10-21
8
83 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 45

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:ScottPletcher
ScottPletcher 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 69

Assisted Solution

by:ScottPletcher
ScottPletcher 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 45

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 45

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL Backup 24 70
Help with SQL Query 23 39
Advice on encrpting some store produces on MS SQL  sql 5 16
sql query Help 12 29
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

706 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

15 Experts available now in Live!

Get 1:1 Help Now