De-Attach and Attach method

Last Post 17 Aug 2012 04:23 PM by gunneyk. 2 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
New Member
New Member

16 Aug 2012 07:27 PM


abc.mdf file in S:\drive
abc.ldf file in S:\drive
abc_2.ldf file in E:\drive

abc_2.ldf was created recently in E:\drive as a temporary measure due to insufficient freespace in S\drive.

Customer has given another logical drive called G:\drive which has ample space for growth.
I am going to move all the above datafiles (mdf and ldf) to this new logical drive.

Can I use deattach method and then move these files to G:\drive and then attach them back to the system ?

Do you thing there will be any complication in this process as to ldf currently located in S:\drive and E:\drive ? Intention is to move them all the newly created G:\drive

Thanks in advance.


New Member
New Member

17 Aug 2012 05:41 AM
I prefer to modify file path with 'alter database', take db offline, copy files to new location then bring db online. Much saver than detach/attach.
New Member
New Member

17 Aug 2012 04:23 PM
I have never had an issue with attaching a db but in 2008 the preferred syntax is CREATE DATABASE FOR ATTACH. I would do a DBCC SHRINKFILE with EMPTYFILE on that 2nd log file before you dettach it as there is no need for two files if you have the space on the drive. However I would prefer to see the log file on a different physical array than the data file for performance reasons but as always it depends on many factors as to if this is necessary or practical.

Acceptable Use Policy