20 January,2017 by Tom Collins
Question: I received a database monitoring alert for a disk space full on a server hosting SQL Server. On closer inspection , the drive was full because of an excessively sized transaction log which had consumed the drive space.
This also had a knock-on effect of not allowing any of the other database transaction log files to grow, causing jobs to fail.
I'd like direction on a sqlserver shrink log file
How can I shrink down the physical size of the sqlserver database log file? The database is in Full Recovery mode, with only a FULL BACKUP issued every day.
Answer: Shrinking down the physical log file size is straight forward, but I think it’s important to understand the reasons it occurred causing this outage.
If there is unused space in the log file , you can issue a DBCC SHRINKFILE. In the example , we’re shrinking the size to 200 MB
USE mydb; GO DBCC SHRINKFILE('mydb_LOG', 200);
If there is not enough unused space, you’ll need to do a LOG BACKUP to clear down the space and then proceed with the DBCC SHRINKFILE. If the database is already in SIMPLE RECOVERY mode , you cannot issue a LOG BACKUP, this will require a separate process , read more on Is a LOG BACKUP allowed on a SIMPLE RECOVERY database ...
Managing SQL Server transaction log files is an indepth topic that may require a level of analysis. There are substantial efficiencies to be gained from applying some thought to the initial set up and configuration.For some guidelines read SQL Server Install Checklist
SQL LOG FILE AUTOGROW performance ... - SQL Server DBA
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |