Solved

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

Posted on 2014-03-03
5
434 Views
Last Modified: 2014-03-03
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,
0
Comment
Question by:feesu
  • 2
  • 2
5 Comments
 
LVL 10

Assisted Solution

by:HuaMinChen
HuaMinChen earned 500 total points
Comment Utility
Try to stop all relevant services of relevant database instance within services.msc and then retry.
0
 

Author Comment

by:feesu
Comment Utility
how do I do that?
0
 
LVL 10

Accepted Solution

by:
HuaMinChen earned 500 total points
Comment Utility
run services.msc within the server machine
stop the services like what I show in the attached
retry to do detach
t674.png
0
 

Author Comment

by:feesu
Comment Utility
Perfect. Thanks.
0
 
LVL 11

Expert Comment

by:Giladn
Comment Utility
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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now