Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

how to kill a process "in use"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SQL Programmer - 11 Jul 2008 16:32 GMT
Hello:

Twice this week, I have gotten in trouble with SQL 2005 preventing me from
conducting different tasks because it gives me a message saying that
something is "in use".

I know about running sp_who and sp_who2, in order to track down a database
or process that is "in use".  But, even with going into the Activity Monitor
afterward, it would not let me kill processes that were preventing me from
accomplishing tasks.  I would right-click on a process in Activity Monitor
and nothing would happen.

One task was restoring a database.  Since SQL told me that database was in
use, even though it was not, I had to have all users log out in order to
restore.

Another situation was last night, when I was trying to detach a database.  I
was told that it was in use, and it was not.  I had to stop and restart SQL
while in Management Studio, in order to detach.

My question is: how do you kill such "hung" processes when you cannot do so
in Activity Monitor?

SQL 2005 is very frustrating.  I miss the good ole SQL 2000 days.

Thanks, for your time!!!

SQL Programmer (it's just a name)
Denny Cherry - 11 Jul 2008 21:13 GMT
You can kill processed by using the KILL command.  You can see what
processes are running by looking at the sys.sysprocesses DMV.

SELECT spid
FROM sys.sysprocesses
WHERE dbid = db_id('YourDatabase')

When restoring a database, or detaching a database within the UI you
have to right click on the database which opens a session to the
database, which then causes you to lock the database and make it
unavailable for restoring to detaching.

Denny

>Hello:
>
[quoted text clipped - 24 lines]
>
>SQL Programmer (it's just a name)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.