Orion Adrian
Orion Adrian

Reputation: 19573

How do I figure out who has a SQL Server 2005 database in Single User Mode?

I have a database in single user mode and I am trying to drop it so I can re-run the creation scripts on it, but I'm being locked out from it.

  1. How do I figure out who has the lock on it?
  2. How do I disable that lock?

Upvotes: 0

Views: 137

Answers (2)

Eric Lathrop
Eric Lathrop

Reputation: 1358

From SQL Server Management Studio:

  1. open the object explorer
  2. expand the database server
  3. expand "Management"
  4. double-click on "Activity Monitor"
  5. locate the process using the desired database
  6. right-click on process
  7. click "Kill Process"

Upvotes: 0

Andy Irving
Andy Irving

Reputation: 2697

run sp_who, find the spid with the database name you require, kill the spid.

Upvotes: 1

Related Questions