Wednesday, March 21, 2012

detect and solve deadlocks

Is there any way by which deadlocks can be detacted and then appropriate
action can be taken (in vb.net code or sql) to avoid it. instead of throwing
error we can revoke the sp call..
thankshttp://www.sql-server-performance.com/deadlocks.asp
"Vikram" <aa@.aa> wrote in message
news:%23x95g36CGHA.2700@.TK2MSFTNGP14.phx.gbl...
> Is there any way by which deadlocks can be detacted and then appropriate
> action can be taken (in vb.net code or sql) to avoid it. instead of
> throwing
> error we can revoke the sp call..
> thanks
>|||http://msdn.microsoft.com/library/d...
tabse_5xrn.asp
Troubleshooting Deadlocks
http://www.support.microsoft.com/?id=224453 Blocking Problems
http://www.support.microsoft.com/?id=271509 How to monitor SQL 2000
Blocking
Andrew J. Kelly SQL MVP
"Vikram" <aa@.aa> wrote in message
news:%23x95g36CGHA.2700@.TK2MSFTNGP14.phx.gbl...
> Is there any way by which deadlocks can be detacted and then appropriate
> action can be taken (in vb.net code or sql) to avoid it. instead of
> throwing
> error we can revoke the sp call..
> thanks
>|||You can determine what processes are currently blocking other processes by
running sp_who and looking for SPIDs in the [blkby] column.
http://msdn2.microsoft.com/ms174313.aspx
Once you have the SPID of a blocking process, you can use DBCC INPUTBUFFER
to see what command it last executed.
http://msdn.microsoft.com/library/d...
v8y.asp
Here are a couple of articles on tracing deadlocks:
http://support.microsoft.com/defaul...kb;en-us;832524
http://support.microsoft.com/defaul...kb;en-us;271509
"Vikram" <aa@.aa> wrote in message
news:%23x95g36CGHA.2700@.TK2MSFTNGP14.phx.gbl...
> Is there any way by which deadlocks can be detacted and then appropriate
> action can be taken (in vb.net code or sql) to avoid it. instead of
> throwing
> error we can revoke the sp call..
> thanks
>|||http://support.microsoft.com/defaul...kb;en-us;832524
Regards
Amish
*** Sent via Developersdex http://www.examnotes.net ***|||I think all the answers you are getting explain how to figure out what is
causing deadlocks so you can rewrite your applications to avoid them. While
this is definitely the right approach, you seem to be asking what you can do
to detect deadlocks in your code. SQL Server already detects and resolves
deadlocks for you. It does this by picking one of the transactions involved
in the deadlock and terminating it so the other transactions can continue.
The error you get at the client is saying that your transaction is the one
picked as the victim. The right thing to do when you're the deadlock victim
is to restart the transaction. If you have enough information available to
do the transaction again, you can just do it without telling the user that
something happened but if you need the user to re-enter the data to rerun
the transaction then just tell the user what happened and have them redo it.
Avoiding deadlocks through application design is important but in some cases
they are unavoidable and you should code your application to respond
appropriately.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Vikram" <aa@.aa> wrote in message
news:%23x95g36CGHA.2700@.TK2MSFTNGP14.phx.gbl...
> Is there any way by which deadlocks can be detacted and then appropriate
> action can be taken (in vb.net code or sql) to avoid it. instead of
> throwing
> error we can revoke the sp call..
> thanks
>

No comments:

Post a Comment