usp_KillConnections

  • Antonio Pedrosa

    Ten Centuries

    Points: 1012

    Comments posted to this topic are about the item usp_KillConnections

  • Joe B-478020

    SSC Eights!

    Points: 966

    Nice stored procedure to kill processes but I don't understand when you would use it?

    If you need everyone out of a database and need them to stay out, then I'd use:

    ALTER DATABASE [MyDatabase] SET SINGLE_USER WITH ROLLBACK AFTER n SECONDS

    do maintenance tasks here

    ALTER DATABASE [MyDatabase] SET MULTI_USER

    While the maintenance tasks are running, no one else can connect.

    If you need to restrict it to admins only, then use RESTRICTED_USER instead of SINGLE_USER.

    Just a thought,

    Joe

  • rw_ebox

    Say Hey Kid

    Points: 686

    For my case, after I kill user connections by using this kind of stored procedure, our application re-connects to database right away. I believe that it is the good choice to put your database in single user mode.

  • Charles Deaton

    SSC-Addicted

    Points: 422

    You neglected to include the net send logic.

  • sreejithsql

    SSCommitted

    Points: 1813

    hi,

    its soo helpful script for me. so simple to run. really appreaciatable.

    thx

    sreejith

    MCAD

Viewing 5 posts - 1 through 5 (of 5 total)

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