• When performing emergency or long running maintenance operations on a database, one method to kick out all active user sessions (and insure they stay out until the database is ready again) is to set status to Restricted User mode, meaning that only SA and DBO accounts can connect. The following command will start rolling back all active transactions, and when the last rollback is completed, it will set to Restricted Mode.

    ALTER DATABASE [YourDatabaseName] SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE;

    When you're finished doing your stuff, set the mode back to Multi User and send out an email notifying that the database is back online.

    ALTER DATABASE [YourDatabaseName] SET MULTI_USER;

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho