Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving MDF and LDF files

Status
Not open for further replies.

Skiboy

Technical User
Sep 8, 2003
9
AU
Hi,

I have detached several databases from an instance using Enterprise Manager. I can move the MDF and LDF files from their original directory to a secondary directory on the same machine, but when I try to move them to another machine (in this case for archiving) I keep getting "can not copy these files... cause they may be in use" errors.

Is there another step that I need to specify when detaching a database to allow the files to be moved?.. or is this a WIN 2K Server protection thing??
 
sp_detach_db - From BOL - "The detached files remain and can be reattached..... The files can also be moved to another server and attached."

Are you sure the in use error does not relate to the destination machine ie they are already used for an existing database on the destination machine ?

 
Sounds like you need to Stop the SQL Server services, this should release your lock file (LDF) and allow you to move the MDF file. The LDF file is suppose to prevent you from moving it.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top