Much like health checks, many agencies assume their software vendors have put database backups in place on their behalf. Because backups require the same customization as the health checks we discussed earlier, this is rarely the case.
There are different types of backups used to protect databases:
Full
- A complete image of your database. This single file can be used to restore your database back to the time it was taken. Any changes made from the time the backup was started to the present time will be lost. These backups take the longest to complete and result in the largest file size as they can be the same size as your full database if not compressed. Depending on database size many agencies choose to do full backups either weekly or nightly.
Differential - A collection of all database changes since the last time a full backup was taken. Differential backups take less time to complete than full backups and result in smaller files since only changes since the last full backup Due to this misconception I have decided to provide a detailed explanation of both how they work and why they must be backed up.
The easiest way to envision a database log is to think of it as a courtroom stenographer. The transaction log documents every single transaction performed on your database. This is extremely important for two reasons:
First, imagine you're running a monthly job on your database to verify whether 911 calls have been through the QA process or not. Now imagine your database server crashes during that job. Once it comes back up you have no idea which calls have been verified and which haven't...logging to the rescue! By design your database will immediately roll-back every change made as part of that failed job and put all of your records back to their pre-job state.
Second, backups backups backups! We have already discussed full and differential backups. Log files MUST also be backed up to ensure properly functionality of your SQL server, even if you never need to restore them!
Even with the obvious importance of maintaining transaction logs, many IT professionals are caught off guard when their SQL server crashes because they ran out of disk space for their log file. This is by design and cannot be disabled. If this has happened to you and your software vendor's help desk used the words "delete", "shrink" or "truncate" in describing how to fix the problem you should be worried! What that means is that they forced your SQL server to delete all of these transaction logs, costing you all of the inherent protection they provide.
What should you do then? Just keep buying more disk space as the log grows and grows? Of course not. Transaction logs should be backed up regularly. Once backed up, your transaction log will allow itself to be overwritten, preventing the file from growing in the first place. A properly managed database will have both it's database file size and transaction log file size set by a knowledgeable database administrator and neither will exceed the space allocated to them.
In the event of a disaster you can restore your transaction log backups to a specific point-in-time. This can be invaluable for "rolling back" a case of human error. A customer of mine once accidentally closed their payroll period in their timekeeping application before the period ended, effectively making it impossible for any employees to clock in or out...this was on the first Wednesday of the new two week pay period! The last full database backup was taken the Sunday night prior and the last differential was taken the Tuesday night prior. They didn't want to lose half a day of time clock punches by reverting back to the backup made the night prior. Transaction log backups to the rescue! I was able to restore their database to a point exactly 1 minute before the payroll period was closed. Instead of losing half a day of payroll data, they had to manually clock two employees in who reported for work during the time required to do the recovery.