Symptoms
Microsoft SQL Server Database Log files grow to large file sizes. SQL Server database goes offline and is unavailable if the Transaction Log drive location runs out of space.
Cause
The most common cause of Microsoft SQL Server Transaction Logs to grow continuously is when the Database Recovery Model is set to Full or Bulk Logged. When using the Full or Bulk-Logged recovery model and the log file is not backed up it continues to grow. File corruption may also occur resulting in the Transaction Log growing to sizes larger than expected relative to database transaction activity.
Resolution
When the SQL Server Transaction Log has grown to file sizes threatening to take up all available disk space the file should be reduced with a shrink log operation. The steps below can be used to shrink the size of SQL Server Transaction Logs.
- Use SQL Server Studio Management. Right-click the database with Transaction Log that must shrink. Select Tasks -> Shrink -> Files.
- The interface that comes up gives options for the file shrink operation. Make the selection options below:
"File type:" In the drop-down field, pick "Log."
"Release unused space" Select the radio button.
Click "OK" button to complete the file shrink.
- Using TSQL to shrink Transaction Log file.
Run the TSQL statement below to shrink the designated database log file, replace the database log name with the name of the database log being shrunk:
- If the Transaction Log does not shrink successfully with the command above. The steps below should allow the shrinking of the log. Replace database name and log file names where necessary.
NOTE: A common reason the SQL Server transaction log will not shrink is because there is not enough space in the log to allow the shrink operation to run.
Shirking Your Microsoft SQL Server Transaction Log File
Duration: 00:07:55 (hh:mm:ss)
When available, closed caption (subtitles) language settings can be chosen using the CC icon on this video player.
Affected Products
Dell Quickstart Data Warehouse Appliance, Microsoft Windows Server 2016, Microsoft Windows Server 2019, Microsoft Windows Server 2022, Microsoft Windows 2012 Server R2, Prosupport for Microsoft Software