Kill numerous Processes

  • Hello All

    I am wanting to have the ability to kill numerous processes at a time. Sometimes when wanting to restore a database from backup, such as from one environment to another, I have to go in and manually kill the processes that are connected to the database that I want to restore.

    How can I script this to kill all the processes for a certain username, or those accessing a certain database?

    Thanks in advance for your help

    Andrew SQLDBA

  • See attached ... I made this last month, but never really got to implement it as my problem resolved itself for the most part. I tested it out back then and it worked great, but you might want to play around with it before implementing. Let me know if you come across any issues.

    Anyways it will allow you to kill all connections to a specified database based on database name, or login name with some optional abilities to put into read only or drop database. Also will send email notification about what was killed if desired (useful for scheduled processes and such).

    Enjoy.

  • Thanks

    I will give this a try.

    We use the same comment section at the top of the procedure. I have been using that comment block since about 4.2

    Thanks for your help with this.

    Andrew SQLDBA

Viewing 3 posts - 1 through 2 (of 2 total)

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