17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

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: Backup and Restore for <strong>FILESTREAM</strong> DatabasesOur complete backup scheme for the NorthPole database consists <strong>of</strong> a full backup, adifferential backup and two transaction log backups. With these backup files, we couldperform another restore operation to completely restore the NorthPole database;in other words, we could restore each backup file in sequence, rolling the databaseforward to the state it existed in at the end <strong>of</strong> the second log backup, and then recoverthe database. In fact, in this very simple case, we can perform a complete restore simplyusing the full backup and the two transaction log backups; remember that a log backupcaptures all contents in the log file since the last log backup and so, in this case, the firsttransaction log backup will contain the log records for both the rows added after the fullbackup, and the second log backup will contain the details <strong>of</strong> the final insert. In a morerealistic backup scheme, there would likely have been transaction log backups taken atregular intervals in the time between the full backup and the differential backup. In sucha case, the differential backup would have allowed us to avoid having to restore thoselog backups, and our restore operation would instead have used just the full backup, thedifferential backup, and any subsequent log backups.In any event, the problem we have here is that a complete restore would return thedatabase to the state where the contents <strong>of</strong> the Items table were deleted since, when werestore the second log backup, it would roll forward, not only the fourth insert, but alsothe transaction that deleted the contents <strong>of</strong> Items. What we want to do instead, to getall the contents <strong>of</strong> our Items table back, is restore to a specific point in time within thatsecond log backup; namely, the time that we recorded after the fourth insert, but beforethe accidental delete.Fortunately, <strong>SQL</strong> <strong>Server</strong> supports point-in-time recovery <strong>of</strong> <strong>FILESTREAM</strong> databases;when you restore a <strong>FILESTREAM</strong>-enabled database from a certain point in time, the<strong>FILESTREAM</strong> data will be consistent with the relational data in the restored database.Let's look at an example that performs a point-in-time restore <strong>of</strong> a <strong>FILESTREAM</strong>database. This time, instead <strong>of</strong> restoring over the top <strong>of</strong> the existing NorthPoledatabase, we're going to restore to a new database, called NothPole2. At the end <strong>of</strong> thisoperation what we should have is a NorthPole database, with one row in the Itemstable, and a NorthPole2 database with all four rows back in the Items table.320

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

Saved successfully!

Ooh no, something went wrong!