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 8: Database <strong>Backup</strong> <strong>and</strong> <strong>Restore</strong> with <strong>SQL</strong> <strong>Backup</strong> Pro<br />

As a final test, we can rerun Listing 8-21, but performing a native, non-compressed<br />

backup, <strong>and</strong> then restoring from that. In my tests, the restore times for native compressed<br />

<strong>and</strong> <strong>SQL</strong> <strong>Backup</strong> compressed backups were roughly comparable, with the native<br />

compressed restores performing slightly faster. Native non-compressed restores were<br />

somewhat slower, running in around 21 seconds in my tests.<br />

Verifying <strong>Backup</strong>s<br />

As discussed in Chapter 2, the only truly reliable way of ensuring that your various backup<br />

files really can be used to restore a database is to perform regular test restores. However,<br />

there are a few other things you can do to minimize the risk that, for some reason, one of<br />

your backups will be unusable.<br />

<strong>SQL</strong> <strong>Backup</strong> backups, like native backups can, to some extent, be checked for validity<br />

using both BACKUP...WITH CHECKSUM <strong>and</strong> RESTORE VERIFYONLY. If both options are<br />

configured for the backup process (see Figure 8-5b) then <strong>SQL</strong> <strong>Backup</strong> will verify that the<br />

backup is complete <strong>and</strong> readable <strong>and</strong> then recalculate the checksum on the data pages<br />

contained in the backup file <strong>and</strong> compare it against the checksum values generated<br />

during the backup. Listing 8-22 shows the script.<br />

EXECUTE master..sqlbackup '-<strong>SQL</strong> "BACKUP DATABASE [DatabaseFor<strong>SQL</strong><strong>Backup</strong>s]<br />

TO DISK = ''D:\<strong>SQL</strong><strong>Backup</strong>s\Chapter8\DatabaseFor<strong>SQL</strong><strong>Backup</strong>s_FULL.sqb''<br />

WITH CHECKSUM, DISKRETRYINTERVAL = 30, DISKRETRYCOUNT = 10, THREADCOUNT = 2,<br />

VERIFY"'<br />

Listing 8-22: BACKUP…WITH CHECKSUM <strong>and</strong> RESTORE VERIFYONLY with <strong>SQL</strong> <strong>Backup</strong>.<br />

Alternatively, we can run either of the validity checks separately. As discussed in Chapter<br />

2, BACKUP…WITH CHECKSUM verifies only that each page of data written to the backup file<br />

is error free in relation to how it was read from disk. It does not validate that the backup<br />

data is valid, only that what was being written, was written correctly. It can cause a lot<br />

of overhead <strong>and</strong> slow down backup operations significantly, so evaluate its use carefully,<br />

based on available CPU capacity.<br />

291

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

Saved successfully!

Ooh no, something went wrong!