How to drop all connections of a database?
In my current project, we need quite often to do a restore of the SQL Server database of the testing environment. It can be a nightmare to have to restore a database while dozens of persons are using it.
A simple solution to do it exists:
- First, detach the database:
- From the MS SQL Server Management Studio, right-click on the database and choose “Detach”
- Tick the “Drop Connections” box
- Detach the database
- All the connections are dropped and you can perform your restore of the database
- Here you are, users can continue to use the database until your next restore.
Advertisement