Working as developer you often have to deal with SqlServer database activities. In a development environment a very basic task is to take backup and restore the database. But sometimes if that environment is shared and multiple people connects to the DB server then performing database level operation might lead to the following error:
"Can not perform xxxxx operation because the database either is in use or you donot have permisssions".
This is because you have active connections to your database. Now to see the those active connections follow below steps-
For SqlServer 2008 R2
- Open SQL Server Management Studio
- Go to the ObjectExplorer and right-click on the connection item:
This will open the details in the right side window:
Now right-click on the process to be killed and select Kill Process.
For SQL Server 2005
In SQL Server 2005 you can find the activity monitor in the ObjectExplorer under the Connection â€“> Management â€“> Activity monitor:
Double-click and there will be a new window that will show you the current process on each database. Right-click on the desired item then select kill process.
And you're done. Now you can perform your Database level operations.