Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to restore a SQL Server 2000 database to a backup of about 2 days ago. I have just backed it up and have tried to restore it, but it says it is in use.

What is the best way to find out who is still using it and then how to disconnect them?

I imagine taking the DB offline is a simple way of doing it, but probably not the safest?

share|improve this question
@SQLFox thanks. It just a load of SQL Management Studio instances. If I take it offline I can still restore OK yeah? – rhughes Jul 17 '13 at 15:15
up vote 5 down vote accepted

Running sp_who2 will show you who is connected to the database.

The safest way to disconnect users is to ask them to disconnect themselves. If that is not practical, you can take the database offline or set it to SINGLE_USER mode to force the other connections out before performing your restore.

See this for more information and examples:


FROM DISK = 'c:\test4.BAK' 
WITH MOVE 'Test4_Data' TO 'c:\data\Test4.mdf', 
MOVE 'Test4_Log' TO 'c:\data\Test4_log.ldf' 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.