Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Thanks

share|improve this question

migrated from stackoverflow.com Feb 10 '10 at 16:53

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

add comment

5 Answers

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
add comment

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
1  
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
add comment

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
add comment

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.

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.