Create a new log file from a command line

If the log file is too large and you want to create a new log. Detach the database. Rename the old log file to something like jpegger_log1.ldf (or move it to another directory). Then from Management Studio, open a new query and enter the command:

create database [jpegger] on (FILENAME = ‘C:\jpegger.mdf‘) for attach_rebuild_log

where jpegger is the name of the database and ‘C:\jpegger.mdf‘ is the path for the mdf file surrounded by single quotes(‘).

Leave a Reply

Your email address will not be published. Required fields are marked *