Showing posts with label disconnect. Show all posts
Showing posts with label disconnect. Show all posts

Monday, March 26, 2012

Lock out user for database structure update

Is there any way to disconnect active users from a live database and lock them out till the database strucure has been updated?

Something like this should work for you.

use <db>

go

--remove all active users from the database

Alter database <db> set SINGLE_USER with ROLLBACK IMMEDIATE

go

--make changes to the database structure on this connection

go

--let users back in

Alter database <db> set MULTI_USER

|||Thank you