Kill SPID (SQL Spackle)

  • Comments posted to this topic are about the item Kill SPID (SQL Spackle)

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Do you think killing the Spid will resolve issue? What about the transaction running behind that?

  • The KILL command does end the transaction being run under the specified SPID. It then has to roll back of course so there may be a delay depending on how big the transaction was.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • I think KILL command will automatically ROLLBACK the transaction my point is if we use KILL command there will be a data loss.

  • Yes if you use KILL to end a transaction it will be rolled back and any changes made by that transaction will no longer exist. Unfortunately sometimes there is no option. For example if a developer runs an update query but forgets to commit the transaction and then leaves for the night. Then later that evening your batch process won't complete because it's blocked. Your only real option is to kill the developers session and roll back their transaction.

    Another example of using KILL is when you have a runaway query that is taking FAR longer than you intended or can allow.

    KILL is an emergency fix it's not something that should be used on any regular basis.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Just a thought...but an additional item regarding finding the lead blocker would be a great plus in this article 🙂

    ------------------------------------------------------------------------------------------------Standing in the gap between Consultant and ContractorKevin3NFDallasDBAs.com/BlogWhy is my SQL Log File HUGE?!?![/url]The future of the DBA role...[/url]SQL Security Model in Plain English[/url]

  • Kenneth.Fisher (7/1/2014)


    Yes if you use KILL to end a transaction it will be rolled back and any changes made by that transaction will no longer exist. Unfortunately sometimes there is no option. For example if a developer runs an update query but forgets to commit the transaction and then leaves for the night. Then later that evening your batch process won't complete because it's blocked. Your only real option is to kill the developers session and roll back their transaction.

    Another example of using KILL is when you have a runaway query that is taking FAR longer than you intended or can allow.

    KILL is an emergency fix it's not something that should be used on any regular basis.

    I thought you were speaking of killing the developer. That seemed extreme but slightly reasonable. :hehe:

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • I've had days where killing the developer was discussed. Primarily when an Access query was left open over the weekend and blocked the batch cycle that ran at 2am Sat morning. Generally I've found killing the session and a discussion with the developer (after time to cool off) works better and causes the police less concern.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • We are using the sp_whoisactive stored procedure. You can check it:

    http://sqlmag.com/sql-server/spwhoisactive

    or downloaded it from here:

    http://sqlblog.com/blogs/adam_machanic/archive/2012/03/22/released-who-is-active-v11-11.aspx

  • Excellent point. I should have included sp_whoisactive in the article. It is an awesome tool.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply