The action can’t be completed because the file is open in SQL server
January 29, 2014luhemmk SQL Server 3 Comments
You get this error message when you try to copy/move SQL database .mdf and .ldf
files from its existing location to some other folder in your computer.
If you want to copy or move your mdf and ldf files to another location, you’ll have
to either take the database offline or shutdown the SQL service. To offline the
database, please try one of the following:
Solution1:
Follow steps given below
1. Open your SQL Server Management Studio.
2. Select the Database that you want to copy then right click it.
3. Go to Tasks -> Take Offline.
Solution2:
Execute following Query
alter database Database_Name set offline
Once the database is offline, you can successfully copy these database files to any
folder.
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
Multiple attempts results in the same error.
What could be keeping that file open and how can I carry on with copy / delete /
overwrite files(DB) as this problem is something very common.
sql-serverdatabase
https://serverfault.com/questions/111598/error-file-in-use-sqlserver