[dba-VB] C# SQLCommand.Timeout

Stuart McLachlan stuart at lexacorp.com.pg
Tue Dec 1 10:49:57 CST 2009


http://windowsitpro.com/article/articleid/14148/how-can-i-stop-a-sql-server-process.html

<quote>
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.

</quote>

See also http://msdn.microsoft.com/en-us/library/aa933230%28SQL.80%29.aspx
for info on KILL x WITH STATUSONLY for tracking the rollback once you kill a process.

-- 
Stuart

On 1 Dec 2009 at 10:58, jwcolby wrote:

> I am sure there is some way to "officially" stop a running process, I just don't know how.
> 




More information about the dba-VB mailing list