Solved

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

Posted on 2014-03-03
5
436 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
ID: 39899848
Try to stop all relevant services of relevant database instance within services.msc and then retry.
0
 

Author Comment

by:feesu
ID: 39899855
how do I do that?
0
 
LVL 10

Accepted Solution

by:
HuaMinChen earned 500 total points
ID: 39899866
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
ID: 39899898
Perfect. Thanks.
0
 
LVL 11

Expert Comment

by:Giladn
ID: 39899929
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What is format f12.8 for a CSV file 6 41
Sql Join Problem 2 33
Need SQL that flips  value 5 19
TSQL - 'WHILE EXIST' loop and LIKE % operator 4 0
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

896 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

12 Experts available now in Live!

Get 1:1 Help Now