Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

574


Part V: Enterprise Data Management


FIGURE 21-9
The Restore Page interface lets you check and see which database pages are marked as suspect.

The database’s backup chain is automatically loaded into the backup sets window. This is
needed because the transaction log backups must be applied to all fi les that contain a page
that is being recovered. If no existing transaction log backups exist, it uses the last full
backup along with the latest differential backup, if there are any. It automatically adds the
new tail-log backup that is created during this process. Clicking the Verify button performs
a RESTORE WITH VERIFYONLY against the backup set to ensure that the backups are
valid and readable.

After you verify that all options are valid, click OK. This initiates the restore process.
You can see the progress of this activity at the top of the Restore Page window. When
it is complete you see a pop-up message stating “Database ‘<database name>’ Restored
Successfully”.

Restoring with T-SQL Code
A database backup is a regularly scheduled occurrence, so if SQL Server’s built-in
Maintenance Plan Wizard isn’t to your liking, it makes sense to write some repeatable code
to perform backups and set up your own SQL Server Agent jobs.

However, unless the backup plan is only a full backup, it’s diffi cult to know how many dif-
ferential backups or transaction-log backups need to be restored; and because each backup
fi le requires a separate restore command, it’s diffi cult to script the recovery effort before-
hand without writing a lot of code to examine the msdb tables and determine the restore
sequence properly.

c21.indd 574c21.indd 574 7/31/2012 9:22:53 AM7/31/2012 9:22:53 AM


http://www.it-ebooks.info
Free download pdf