Truncating the SQL Log File

If the SQL log file is not backed up at least weekly, it can grow unchecked to the point of running the server out of disk space.  A bloated log file also creates performance issues and slows processing of SQL transactions.

This only applies to databases that are using the Full recovery model.  Simple recovery automatically purges log transactions.  You can check which recovery option is being used in the database properties->Options screen.

How to check for a large log file

  1. Using SQL Management Studio (SMS), connect to the database server.
  2. Right click on the lobbyCentral database and choose Properties.
  3. Select Files
  4. The fourth column called Initial Size actually display the current size of the files.

  5. The log file should be around 25% of the size of the database.  If it is over 100MB in size, this generally is too large and should be truncated.

Truncating the SQL Log File

  1. Change the Initial Size to a smaller size in megabytes.  For example, if the current size is 100MB, change it to 10MB.   As long as Autogrowth is on (next column), the size does not need to be exact.
  2. Click OK
  3. Right click lobbyCentral and choose Backup
  4. Perform a Full backup
  5. Right-click lobbyCentral and choose Backup again.
  6. Change the Backup Type to Transaction Log
  7. Remove the current file name, which should be the file that was created with the first backup.
  8. Add a new filename indicating it is a log backup to identify the two backup files

  9. Click OK
You must perform the data backup first, then follow with a backup of the log or the truncate will not work.

Preventing Explosive Log Growth

Create a SQL Agent job to backup the database and log in separate steps using SQL Agent.   We recommend that you schedule the job to run daily.
If you are using SQL Express, SQL Agent is not available and this must be performed manually.   When performing manually, you can follow the steps above but skip steps 1 and 2.   Changing the size of the database is only required to reduce the size of the file.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us