30.06.2013 Views

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1: Basics of <strong>Backup</strong> <strong>and</strong> <strong>Restore</strong><br />

transactions. In such circumstances, the log records pertaining to an interrupted transaction,<br />

or one for which the ROLLBACK comm<strong>and</strong> is explicitly issued, are read <strong>and</strong> the<br />

changes rolled back.<br />

In these ways, <strong>SQL</strong> <strong>Server</strong> ensures that, either all the actions associated with a transaction<br />

succeed as a unit, or that they all fail, <strong>and</strong> so guarantees data consistency <strong>and</strong> integrity<br />

during normal day-to-day operation.<br />

Log backups <strong>and</strong> point-in-time restore<br />

As we've discussed, each log record contains the details of a specific change that has been<br />

made to the database, allowing that change to be performed again as a part of REDO, or<br />

undone as a part of UNDO, during crash recovery. Once captured in a log backup file, the<br />

log records can be subsequently applied to a full database backup in order to perform a<br />

database restore, <strong>and</strong> so re-create the database as it existed at a previous point in time, for<br />

example right before a failure. As such, regular backups of your log files are an essential<br />

component of your database backup <strong>and</strong> restore strategy for any database that requires<br />

point-in-time restore.<br />

The other very important reason to back up the log is to control its size. Since your log<br />

file has a record of all of the changes that have been made against it, it will obviously take<br />

up space. The more transactions that have been run against your database, the larger<br />

this log file will grow. If growth is left uncontrolled, the log file may even exp<strong>and</strong> to the<br />

point where it fills your hard drive <strong>and</strong> you receive the dreaded "9002 (transaction log<br />

full)" error, <strong>and</strong> the database will become read-only, which we definitely do not want to<br />

happen. We'll discuss this in more detail in Chapter 5.<br />

27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!