SQL Log Files (LDF) Not Smaller After Truncation

KB ID: 1876
Product: Veeam Agent for Microsoft Windows
Veeam Backup & Replication
Published: 2014-04-21
Last Modified: 2022-07-19
Languages: DE
Get weekly article updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.

Cheers for trusting us with the spot in your mailbox!

Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest

error icon

Oops! Something went wrong.

Please try again later.

Challenge

After Veeam Backup & Replication or Veeam Agent for Microsoft Windows successfully truncates a SQL Server  Database with Application-Aware Processing enabled, the SQL Log File (.ldf) does not become smaller.

Cause

This is due to the fact that the LDF file itself is a container, when truncation occurs the internals of the LDF are cleared and space is freed within it, but the LDF itself is not made smaller.

One could manually shrink or configure “Auto Shrink” to make the LDF itself physically smaller.

Solution

Considerations regarding Shrinking

The information provided below is a limited explanation of shrinking and is only intended to demonstrate how to perform a shrink operation. Veeam Support highly recommends before shrinking, you review options with your SQL Administrator and conduct independent research. Many tech articles recommend against shrinking when it is not strictly necessary. Before performing a shrink operation, you should fully understand the impacts of shrinking (e.g. fragmentation and performance).

Advised reading regarding SQL shrinking can be found here:
https://docs.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-file

To view the actual free space within the LDF file, perform the following.

  1. Open SQL Management Studio and connect to the SQL instance where the database in question is located.
  2. Right-Click on the database and go to Tasks>Shrink>Files
shrink
  1. Switch to "Log" under [File type:]
spacetoshrink
This will display the currently allocated space and the available free space. The database in this example is set for "Simple" recovery model, which keeps the log size low. When a SQL database is configured for "Full" recovery model, the LDF could be considerably larger depending on the time between truncation events.
Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Spelling error in text

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

Oops! Something went wrong.

Please try again later.

KB Feedback/Suggestion

This form is only for KB Feedback/Suggestions, if you need help with the software open a support case

By submitting, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Verify your email to continue your product download
We've sent a verification code to:
  • Incorrect verification code. Please try again.
An email with a verification code was just sent to
Didn't receive the code? Click to resend in sec
Didn't receive the code? Click to resend
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

error icon

Oops! Something went wrong.

Please try again later.