Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "close existing connections to destination database" grayed out on SQL Server 2012 Management Studio?

I am normally using SQL Server 2012 Management Studio to restore a SQL Server database from a "bak" file. I do this by overwriting an existing database. In the "Options" page, there is a check-box labeled "Close existing connections to destination database", which I mostly check because the target database is always "in use", even if I just restarted the MS SQL Service and I am sure that there are no applications using it.

Anyway, on my client's computer, I saw that that checkbox to close existing connections is grayed out without any information. How and why does this happen? A google search didn't yield any results.

like image 209
schlingel Avatar asked Sep 26 '13 13:09

schlingel


People also ask

How do I force close a connection in SQL Server?

Right-click on a database in SSMS and choose delete. In the dialog, check the checkbox for "Close existing connections." Click the Script button at the top of the dialog.

How do I close a connection in SSMS?

To disconnect the connection after the query completes, from the menus go to Tools > Options > Query Execution > SQL Server > Advanced and select "Disconnect after the query executes". By checking this option, after the query executes the database connection will be disconnected.

How do I stop a SQL database connection?

In more recent versions of SQL Server Management studio, you can now right click on a database and 'Take Database Offline'. This gives you the option to Drop All Active Connections to the database.


2 Answers

I had the same issue. I simply checked the Checkbox BEFORE choosing the source to restore from. After choosing the source the CB was grey but checked and the restore worked fine.

like image 197
Ehud Grand Avatar answered Oct 09 '22 21:10

Ehud Grand


right click on database-> properties-> Options-> change Auto Update statistics Asynchronously to false. it will solve close existing connections to destination database grayed out issue

I hope it help

like image 40
Mohamed Elmofty Avatar answered Oct 09 '22 21:10

Mohamed Elmofty