|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Sunday, November 13, 2011 2:37 AM
Points: 987,
Visits: 95
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 9:39 AM
Points: 183,
Visits: 225
|
|
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
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Today @ 10:13 AM
Points: 45,
Visits: 183
|
|
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.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 2:49 PM
Points: 12,
Visits: 118
|
|
You neglected to include the net send logic.
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Saturday, August 25, 2012 9:48 PM
Points: 777,
Visits: 134
|
|
hi, its soo helpful script for me. so simple to run. really appreaciatable.
thx sreejith MCAD
|
|
|
|