Monday, March 19, 2012

connection issue

Created a script to restore db. it drops all connection first then it waits
for 5 minutes just incase there are jobs running.
problem is after it kills all the users and then it waits 5 minutes before
it drops the db another users can connect to the db. Any idea on what I can
do so no one connects to the db during its wait time of 5 minutes before it
drops the db
thxCheck out ALTER DATABASE and SET RESTRICTED_USER (or SINGLE_USER) with a rollback clause, like
ROLLBACK IMMEDIATE.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"stoney" <stoney@.discussions.microsoft.com> wrote in message
news:72A7EDA3-A421-45CB-80F8-97213E80A19F@.microsoft.com...
> Created a script to restore db. it drops all connection first then it waits
> for 5 minutes just incase there are jobs running.
> problem is after it kills all the users and then it waits 5 minutes before
> it drops the db another users can connect to the db. Any idea on what I can
> do so no one connects to the db during its wait time of 5 minutes before it
> drops the db
> thx

No comments:

Post a Comment