Another IT blog
Just another IT blog

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

No Responses to “How to drop all connections of a database?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.