[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2014-03-03
5
Medium Priority
?
469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Assisted Solution

by:HuaMinChen
HuaMinChen earned 2000 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 11

Accepted Solution

by:
HuaMinChen earned 2000 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
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.

656 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