Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > sql server programming > june 2005 >

sql server programming : Deadlock



Markus Eßmayr
6/30/2005 12:00:00 AM
Hi there!

In my database client application (C#) I sometimes get an exception telling
me, that my application (which runs a some kind ob batch job) was selected
as deadlock victim and the active transaction was terminated.
No I want to get mor information about, which other application causes the
deadlock.

I thought about executing "sp_lock" just after I received the
deadlock-exception, but I think that this is too late, because my
transaction will be already terminated at this time, and ther won't be a
deadlock any longer.

Can anyone tell me, what would be the best way to receive information about
the active database-connections and their locks, BEFORE the deadlock
situation is cleared by the database-engine?
Is there some kind of trigger or sth. like that?

As the problem doesn't occur regularly, and it's only on the productive
machine, I absolutely don't want to have the profiler active!

Thanks in advance!
Max

Uri Dimant
6/30/2005 10:56:02 AM
Markus
Take a look at sp_who2 stored procedure on clolumn blkby (If I remember
well) . That tells you who is blocked and by whom.

Regarding to DEADLOCKS please visit at this site

http://www.sql-server-performance.com/deadlocks.asp




[quoted text, click to view]

Luciano Caixeta Moreira
6/30/2005 11:08:07 AM
Use the trace flag 1024 to receive notifications about deadlocks.

DBCC TRACEON (1024, -1)

[]s
Luciano Caixeta Moreira
Meu blog: http://br.thespoke.net/MyBlog/Luti/MyBlog.aspx

[quoted text, click to view]

AddThis Social Bookmark Button