Sql Server : How to KILL a SPID and then check the status of KILL / ROLLBACK progress
- Posted by Sqltimes
- On September 12, 2015
- 0 Comments
Quick one today:
A few days ago, this script came in handy when a certain thread needed to be cleaned on a lab server.
1
2
3
4
5
|
-- -- Kill a SPID -- KILL 52 GO |
Sometimes such a command could take a long time depending on the payload of the SPID that we are trying to kill. Sql Server will first try to rollback the SPID, to make sure it brings the session back to a stable point and then kills it. Such rollback sometimes takes a long time. So, to check how far along it has progresses, this below script comes in handy.
1
2
3
4
5
|
-- -- Kill a SPID -- KILL 52 WITH STATUSONLY GO |
Hope this helps,
_Sqltimes
_Sqltimes
0 Comments