Unix Technical Forum

Using aba_lockinfo in a loop

This is a discussion on Using aba_lockinfo in a loop within the SQL Server forums, part of the Microsoft SQL Server category; --> Erland Sommarskog's procedure aba_lockinfo provides very valuable information when trying to sort out locking and blocking problems. However is ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 08:11 PM
Jim Devenish
 
Posts: n/a
Default Using aba_lockinfo in a loop

Erland Sommarskog's procedure aba_lockinfo provides very valuable
information when trying to sort out locking and blocking problems.

However is only provides a snapshot in time.

Is it possible to have this run continuously for a period of time? or
possibly at set intervals, say every minute?

If so, how would one set it up?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 08:12 PM
Roy Harvey
 
Posts: n/a
Default Re: Using aba_lockinfo in a loop

On alternative would be a watifor loop. Here is an example using a
five second delay over one minute.

declare @t datetime
set @t = dateadd(second,60,getdate())

WHILE getdate() <= @t
BEGIN
--do something here
select getdate()
waitfor delay '00:00:05'
END

Roy Harvey
Beacon Falls, Ct

On 18 Aug 2006 02:59:45 -0700, "Jim Devenish"
<internet.shopping@foobox.com> wrote:

>Erland Sommarskog's procedure aba_lockinfo provides very valuable
>information when trying to sort out locking and blocking problems.
>
>However is only provides a snapshot in time.
>
>Is it possible to have this run continuously for a period of time? or
>possibly at set intervals, say every minute?
>
>If so, how would one set it up?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 08:12 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Using aba_lockinfo in a loop

Jim Devenish (internet.shopping@foobox.com) writes:
> Erland Sommarskog's procedure aba_lockinfo provides very valuable
> information when trying to sort out locking and blocking problems.
>
> However is only provides a snapshot in time.
>
> Is it possible to have this run continuously for a period of time? or
> possibly at set intervals, say every minute?
>
> If so, how would one set it up?


You could run it from SQL Server Agent. When you set up the job step, there
is an Advanced tab where you can redirect output to a file, and you can opt
to append to an existing file.

I would however not recommend you do this for any longer period of time in
a production environment. If system is already under load, and there are a
lot processes and lot of locks, the procedure itself takes some resources.

(But I recall that I did precisely this, ran aba_lockinfo once a minute at
one of our customers for a day or two, back in the days of SQL 6.5, and I
was able to find several flaws in our product. In fact some of the blocking
situations were unbelivable. In the lvl column which displays how many you
are waiting for, I saw the number 15!)


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 08:12 PM
Jim Devenish
 
Posts: n/a
Default Re: Using aba_lockinfo in a loop

Thanks to both of you. I will give it a try.

May be back for more detailed info if I get stuck

Jim

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 08:12 PM
Jim Devenish
 
Posts: n/a
Default Re: Using aba_lockinfo in a loop

Thanks. I have successfully set up a trial with SQL Server Agent -
every minute for 5 minutes. Works well. Now for the real thing.

Jim

Erland Sommarskog wrote:
>
> You could run it from SQL Server Agent. When you set up the job step, there
> is an Advanced tab where you can redirect output to a file, and you can opt
> to append to an existing file.
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com