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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5: Log <strong>Backup</strong>s<br />

When determining a backup strategy <strong>and</strong> schedule for a given database, one of the<br />

major considerations is the extent to which potential data loss can be tolerated in the<br />

event of an errant process, or software or hardware failure. If toleration of data loss is,<br />

say, 24 hours, then we need do nothing more than take a nightly full backup. However,<br />

if exposure to the risk of data loss is much lower than this for a given database, then it's<br />

likely that we'll need to operate that database in FULL recovery model, <strong>and</strong> supplement<br />

those nightly full backups with transaction log backups (<strong>and</strong> possibly differential database<br />

backups – see Chapter 7).<br />

With a log backup, we capture the details of all the transactions that have been recorded<br />

for that database since the last log backup (or since the last full backup,if this is the firstever<br />

log backup). In this chapter, we'll demonstrate how to capture these log backups<br />

using either the SSMS GUI or T-<strong>SQL</strong> scripts. However, we'll start by taking a look at how<br />

space is allocated <strong>and</strong> used within a log file; this is of more than academic interest, since<br />

it helps a DBA underst<strong>and</strong> <strong>and</strong> troubleshoot certain common issues relating to the transaction<br />

log, such as explosive log growth, or internal log fragmentation.<br />

Capturing an unbroken sequence of log backups means that we will then, in Chapter 6,<br />

be able restore a full backup, then apply this series of log backups to "roll forward" the<br />

database to the state in which it existed at various, successive points in time. This adds<br />

a great deal of flexibility to our restore operations. When capturing only full (<strong>and</strong> differential)<br />

database backups, all we can do is restore one of those backups, in its entirety.<br />

With log backups, we can restore a database to the state in which it existed when a given<br />

log backup completed, or to the state in which it existed at some point represented within<br />

that log backup.<br />

144

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

Saved successfully!

Ooh no, something went wrong!