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 />

Execute the script, then, while it is running, we can take a quick look at the <strong>SQL</strong> <strong>Backup</strong><br />

monitoring stored procedure, sqbstatus, a feature that lets us monitor any <strong>SQL</strong> <strong>Backup</strong><br />

restore operation, while it is in progress. Quickly open a second tab in SSMS <strong>and</strong> execute<br />

Listing 8-14.<br />

EXEC master..sqbstatus<br />

GO<br />

Listing 8-14: Red Gate <strong>SQL</strong> <strong>Backup</strong> Pro monitoring stored procedure.<br />

The stored procedure returns four columns: the name of the database being restored; the<br />

identity of the user running the restore; how many bytes of data have been processed;<br />

<strong>and</strong> the number of compressed bytes that have been produced in the backup file. It can<br />

be useful to check this output during a long-running restore the first time you perform<br />

it, to gauge compression rates, or to get an estimate of completion time for restores <strong>and</strong><br />

backups on older versions of <strong>SQL</strong> <strong>Server</strong>, where Dynamic Management Views are not<br />

available to tell you that information.<br />

Once the restore completes, you'll see restore metrics similar to those shown in Figure<br />

8-21, but with an additional section for the tail log restore. If you rerun Listing 8-12 to<br />

verify your data, you should find that the "missing" 21 rows in MessageTable2 are back!<br />

<strong>SQL</strong> <strong>Backup</strong> point-in-time restore to st<strong>and</strong>by<br />

In our final restore example, we're going to restore a st<strong>and</strong>by copy of the DatabaseFor-<br />

<strong>SQL</strong><strong>Backup</strong>s database to a specific point in time in order to attempt to retrieve some<br />

accidentally deleted data.<br />

St<strong>and</strong>by servers are commonly used as a High Availability solution; we have a secondary,<br />

or st<strong>and</strong>by, server that can be brought online quickly in the event of a failure of the<br />

primary server. We can restore a database to the st<strong>and</strong>by server, <strong>and</strong> then successively<br />

279

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

Saved successfully!

Ooh no, something went wrong!