How to remove one of two log files

  • Hi,

    We have a database that has two log files because of the space issue. The first log file is one the same drive as the data file. The second one is on another drive which has bigger space.

    My question is how to remove the first log file.

    Any help would be appreciated!

    David

  • The first transaction log cannot be removed. Instead you could move the first log file to the drive which has enough space and then delete the second one.

    This article has good information on that.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • The primary log file cannot be removed, so the second log file will need to be removed and then the first log file moved to a different drive.

    Under SQL Server 2000, you can move files either with the sp_detach_db/sp_attach_db method or backup/restore method.

    SQL = Scarcely Qualifies as a Language

  • Thanks for your replies.

    I assume to move the first log file, I need to detach the database, move the log files, attach the database back. But my concern is it may not allow me to delete the second file.

    Actually I have tried to delete the second log file, but it told me that "cannot delete the file because it's not empty".

  • Hi Adiga,

    I have tried to use the method in the article you recommended. It worked. I have successfully removed the second log file. The only thing I need to do to move the primary log file, hopefully tomorrow morning.

    Thanks a lot!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply