Skip navigation

How can I stop a SQL Server process?

A. Do a select * from sysprocesses and identify the spid in question. Then do a "KILL <spidno>"

This will mark the spid as "dead". Note that it may take a while for the process to end as it has to rollback all the updates that it has been doing. Also kill only marks the process as dead - the process itself needs to check for this, and if it is stuck in a loop as the result of a bug or whateverthen it won't terminate. Also certain processes like dump and dbcc commands have significant code paths where the kill command is not checked for and so these can take some time to terminate.

Also, if the process is in an extended-stored procedure, or is waiting on network traffic/remote stored-procedure it will not check whether it has been terminated until these actions have been completed.

See Q171224 for more info - including details on the waittype that can tell you what a process is waiting on.

If the process won't die for one of the above reasons then your only choice is to stop the sqlservr.exe process itself and re-start.


TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish