Shrinking log file

  • In SQL Server 2008 R2 can someone please tell me how to shrink log file and also the data file.

    . I have Log shipping going on so really don't want to break the log chain.

    I know shrinking is not good but i really need this right now to free up some space and this is a dev environemnt so shrinking doesn't matter.

  • In the GUI you can right click the database and go to tasks > Shrink and select either files or data

  • doesn't shrink that way, any script you have please share.

  • If your database recovery model is FULL then you simply need to schedule a job to backup the transaction log. If it is set to SIMPLE then you probably have some run-a-way job that is filling up your transaction log.

    Although it is an option it is not advisable to manually shrink the transaction log.

    Kurt

    Kurt W. Zimmerman
    SR DBA
    Lefrak Organization
    New York, NY

    http://www.linkedin.com/in/kurtwzimmerman

  • For example code look here:

    http://msdn.microsoft.com/en-us//library/ms189493.aspx

    However the last poster is right in saying you may need to backup your log first. You can check if your log can not be shrunk by using DBCC Loginfo and if the status column has a 2 in it, then those virtual log files can not be truncated without first being backed up.

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

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