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 6: Log <strong>Restore</strong>s<br />

If we do need to perform maintenance operations that can be minimally logged <strong>and</strong><br />

we wish to switch to BULK_LOGGED model, the recommended practice is to take a log<br />

backup immediately before switching to BULK_LOGGED, <strong>and</strong> immediately after switching<br />

the database back to FULL recovery, as demonstrated in Listing 6-1. This will, as far as<br />

possible, isolate the minimally logged transactions in a single log backup file.<br />

Performing Log <strong>Restore</strong>s<br />

Being prepared to restore your database <strong>and</strong> log backups is one of the DBAs most<br />

important jobs. All DBAs are likely, eventually, to find themselves in a situation where<br />

a crash recovery is required, <strong>and</strong> it can be a scary situation. However, the well-prepared<br />

DBA will know exactly where the required backup files are stored, will have been<br />

performing backup verification <strong>and</strong> some r<strong>and</strong>om test restores, <strong>and</strong> can exude a calm<br />

assurance that this database will be back online as quickly as possible.<br />

As we did for log backups, we're going to discuss how to perform log restores the "GUI<br />

way," in SSMS, <strong>and</strong> then by using native T-<strong>SQL</strong> <strong>Backup</strong> comm<strong>and</strong>s. We're going to be<br />

restoring to various states the DatabaseForLog<strong>Backup</strong>s database from Chapter 5, so<br />

before we start, let's review, pictorially, our backup scheme for that database, <strong>and</strong> what<br />

data is contained within each backup file.<br />

With our first example, using the GUI, we'll restore the DatabaseForLog<strong>Backup</strong>s<br />

database to the state in which it existed at the point after the first log backup was taken;<br />

in other words, we'll restore right to the end of the transaction log DatabaseForLog-<br />

<strong>Backup</strong>s_Native_Log_1.trn, at which point we should have 20 rows in each of our<br />

three message tables.<br />

187

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

Saved successfully!

Ooh no, something went wrong!