SQL Server 2005 - MDF File is In Use (Permission Denied)

Hi experts,

I have this SQL Server 2005 database that even when I deattach it or take it offline I am not able to copy it or deal with it as it keeps saying “database is in use” and “permission denied”. I have restarted my PC but it keeps saying the same. I don’t know how to deal with it!

Thanks,
feesuAsked:
Who is Participating?
 
HuaMinChenConnect With a Mentor Business AnalystCommented:
run services.msc within the server machine
stop the services like what I show in the attached
retry to do detach
t674.png
0
 
HuaMinChenConnect With a Mentor Business AnalystCommented:
Try to stop all relevant services of relevant database instance within services.msc and then retry.
0
 
feesuAuthor Commented:
how do I do that?
0
 
feesuAuthor Commented:
Perfect. Thanks.
0
 
GiladnCommented:
If all the above fails, try setting the database to SINGLE USER MODE
with the following syntax:
USE [master];
GO
ALTER DATABASE  database-name  SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO

don't forget to set single user to false when done, see here:
http://technet.microsoft.com/en-us/library/ms345598.aspx

hope this helps,


G
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.