Hi,
The script will be :-
use Master
go
Alter database <dbname> set single_user with Rollback immediate
go
Restore database <dbname> from disk='filename'
go
Alter database <dbname> set multi_user
The above commands will remove all the user connections from the database ,
set to single user and do the restore and after the restore the database is
set to Multi user.
Thanks
Hari
MCDBA
"James" <Homer@jamco> wrote
Quote:
I'm resoring my sql database on a nightly basis, but sometimes it fails as
some users leave there connection to the database up.
Could someone give me the script, or point me in the right direction for a
script that will disconnect all open sessions.
Thanks a lot |