From: stoney on 21 Mar 2007 11:18 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
From: Tibor Karaszi on 21 Mar 2007 11:59
Check 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(a)discussions.microsoft.com> wrote in message news:72A7EDA3-A421-45CB-80F8-97213E80A19F(a)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 |