Tags
CRM 2011, Microsoft Dynamics CRM, MSCRM 2011, SQL Error - Exclusive access could not be obtained because the database is in use : Kill the Processes having open connections to SQL
Hello Everyone,
Most of the time while Restoring a Database we might have came across the following Error:
System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)
In order to find the Processes that have an open connection with that particular Database in SQL, we use Activity Monitor.
To Open Activity Monitor -> Right click on the SQL Serve Instance Name under Object Explorer in SQL Server Management Studio.
Now under the Database Column, select your particular database and it will list all the active connection regarding selected Database. Right Click on any one and you will find the option Kill Process.
This way you can kill all the active process and continue with the Database Restoration.
**Another way to Kill open connections are through SQL Queries which has been described in the Code Project.
Hope that helps.
Thanks !!!
🙂