SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Trigger for lock event.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bobanjayan
Yak Posting Veteran

India
67 Posts

Posted - 04/17/2004 :  03:57:32  Show Profile  Reply with Quote

Is it possible to create a trigger on the event of block/Lock if the status "Sleeping" and wait type is "Awaiting Command" ?

So that it automativally kill the session when it detects lock contention.

nr
SQLTeam MVY

United Kingdom
12543 Posts

Posted - 04/17/2004 :  19:07:38  Show Profile  Visit nr's Homepage  Reply with Quote
Not a trigger but you can write an sp and schedule it to run frequently.
You probably wouldn't want to kill this sort of process immediately anyway.

Another option would be to use the profiler to log the events to a table and put trigger on the table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

bobanjayan
Yak Posting Veteran

India
67 Posts

Posted - 04/20/2004 :  05:00:43  Show Profile  Reply with Quote
Nice idea.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

USA
4184 Posts

Posted - 04/20/2004 :  08:02:20  Show Profile  Visit derrickleggett's Homepage  Send derrickleggett an AOL message  Send derrickleggett a Yahoo! Message  Reply with Quote
If you're getting to the point where locks are this bad, you should probably look at using WITH(NOLOCK) strategically and a possible redesign on your tables. Have you thought about that? You can find the contention areas by using Profiler like Nigel suggested.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000