Friday, September 11, 2009

Put SQL Server to single user mode

In order to have exclusive access to the database, the following command can be issued, it will kill all connections to the specified database except for the connection that we currently have to the database.

alter database xxx
set single_user
with rollback immediate

the following command bring it back to multiple user access.
alter database xxx
set multi_user

No comments: