Tuesday, June 30, 2009

How to stop a run-away SQL transaction

Recently was testing my web-app against a SQL-Server 2008 database and got a time-out expired message from the SQL database. No matter what I did after that it just did not want to drop the transaction and I continually got the time-out. I needed to find and stop the SQL transaction.

The solution: Sign onto the SQL-Server with the Enterprise Manager.

Execute sp_who2
and look for rows that are blocked on another connection (the BlkBy column will have the spid of the blocking connection in it).

Now kill the culprit:
kill xx
(xx = spid).

No comments:

Post a Comment