Tuesday, 10 April 2012

killing active sql server DB connections

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

1. Open Sql server management studio

2. Go to ObjectExplorer and right click on the connection item

image

This will open the details in the right side window

image

Now right click on desire process and select Kill Process.

image

For SQL Server 2005 -

In Sql server 2005 you can find the activity monitor in the ObjectExplorer under the Connection –> Management –> Activity monitor

image

Double click and there will be a new window that will show you current process.on each database. Right click on the desired item select kill process.

And you’re done. Now you can perform your Database level operations.

No comments:

Post a Comment