Server Fault is a question and answer site for system and network administrators. 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 am trying to copy a database from one folder to another. There is no program at all running except operating system.(I mean all windows shut)

I keep getting this :

The action cannot be completed because the file is open is another program

close file and try again

Try again, Try again , Try again .........

what the hell on earth is holding that file and how can I carry on with copy / delete / overwrite files(DB) as this problem is something very common.


share|improve this question

migrated from Feb 10 '10 at 16:53

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

Try net stop mssqlserver /y and see what happens. Naturally I'm assuming here it's okay to stop the DB server.

share|improve this answer
I think this is very likely going to be the resolution despite the tools suggested for checking what the file is being locked by. – tcnolan Feb 10 '10 at 23:27

Go to Task Manager and see, it's sqlservr.exe proccess is running. If so, kill it and try again. Also there is a useful small program called 'Unlocker' which allows to look which proccesses are attached to the file, kills them and let the file be deleted or moved.

A similar tool is WhoLockMe!

share|improve this answer
I've used those tools as well pretty good... – tcnolan Feb 10 '10 at 23:24

This error can be solved by stopping MSSQLSERVER service form configuration Tool in Microsoft Sql Server as shown with diagram in the link below:

Solve Error The action can’t be completed because the file is open in SQL SERVER(MSSQLSERVER)

share|improve this answer
Thanks for your answer. In case the site you linked to should ever go away, it's better to repost the image in your answer. – Andrew Schulman Dec 29 '13 at 15:57

Open the Microsoft SQL Server Management Studio,then open Object Explorer .Right Click and you can find Restart the connection.This will stop the SQL Server and you can delete or transfer the database.

share|improve this answer

I usually prefer to use first party tools for this kind of thing, process monitor from sysinternals is my tool of choice for this kind of thing. Just watch out if you have a lot of background services running cause you will see lots of activity going through. Really useful for watching your registry as well.

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.