|
I wrote an article last year regarding log file management as it pertains to Time Matters. The previous article was somewhat technical in nature and didn't properly cover specific recommendations for Time Matters. To a large degree that can be difficult to do, but for the vast majority I think we can set a baseline. From this baseline you can decide on a firm by firm basis what needs to be done specific to their needs. The transaction log management starts and stops with two elements - The Database Recovery Model
- Backups

As illustrated in the screen shot above, the recovery model is a database level option that controls how your transaction log will be managed. There are many articles written on how to manage this option and I encourage you to google "Recovery Model" if you're interested in the details. The growing size of transaction logs has been an increasing problem with the rise in popularity of SQL Server by small firms (without IT staff).
In general, if your database Recovery Model is set to Simple, you are done.There are no special precautions as that pertain to managing the log file, SQL Server will do it automatically. Though it can be modified, this was considered the norm for the stored procedure that Time Matters ships with. The other common setting is Full Recovery Model (Bulk is rarely used). The Full Recovery Model requires a thorough understanding of SQL Server transaction backup theory. In General, a full database backup would be performed once a day, then several smaller, transaction log backups are performed throughout the day. This allows a backup to be restored to a specific point in time. All transaction log backups need to be present for this to occur. This is referred to as a "backup chain" because subsequent log backups are dependent on previous log backups, back to the point of the last full backup. It is important to note that truncating a log will destroy the log chain. In keeping this simple, choosing the appropriate option comes down to on site expertise and the expectation for data recovery. If your client has on site IT staff that are capable of managing Transaction Log backups (and more importantly restores), this option provides the ability to recover data in a very granular method. If your client is comfortable with restores based on the last full backup, that is by far the most simple, low maintenance approach. Converting from Full to Simple Recovery If you have a large log file and want to move from Full to Simple recovery mode follow these steps: - Perform a transaction log backup, DO NOT use the TRUNCATE ONLY option.
- Change the recovery model to SIMPLE
- Perform a FULL backup
- Shrink the Log file
- Going forward, let SQL Server manage growing the file size, it will do a good job.
Staying With Full Recovery But Managing Log Size If you have a large log file and want to continue to use Full Recovery, make sure you are benefiting from it. - Perform a transaction log backup, DO NOT use the TRUNCATE ONLY option
- Shrink the log file
- Perform a daily Full Backup
- Perform several Log backups throughout the day
- Going forward, let SQL Server manage growing the file size, it will do a good job.
(NOTE: Most problem stem from not performing step 4 so the log grows exponentially.) My training comes from the school of hard knocks and a lengthy tenure on the Time Matters development team. Use this information as a guide to better understanding and always consult a database professional before jumping into critical areas such as this. |