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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8: Backup and Restore for <strong>FILESTREAM</strong> Databases<strong>The</strong> script in Listing 8-11 restores the file backup that we created earlier. Note the usage<strong>of</strong> the PARTIAL option in the restore process. When the script has successfully executed,the new database will be online and you will be able to query all the data that is availablein the primary filegroup.Any filegroups that were not part <strong>of</strong> the restore will be piecemeal restored and, in thecase below, the <strong>FILESTREAM</strong> filegroup will be marked as RECOVERY_PENDING, as shownfrom the query against the system catalog view sys.database_files in Listing 8-12.USE NorthPolePartialGOSELECTtype_desc,name,physical_name,state_descFROM sys.database_files/*type_desc name physical_name state_desc---------- ------------ ------------------------------ ---------------ROWS NorthPoleDB C:\<strong>Art</strong>O..\NorthPolePartial.mdf ONLINELOG NorthPoleLOG C:\..\NorthPolePartial_log.ldf ONLINE<strong>FILESTREAM</strong> NorthPoleFS C:\<strong>Art</strong>OfFS\Dem...\NorthPole_fs RECOVERY_PENDING*/Listing 8-12:Retrieving the list <strong>of</strong> filegroups associated with a database.<strong>The</strong> <strong>FILESTREAM</strong> filegroup will become a "ghost" and, unless you have a file backup <strong>of</strong>the <strong>FILESTREAM</strong> filegroup and associated transaction logs, there is no way to get rid <strong>of</strong> it.<strong>The</strong> data stored in such ghost filegroups will not be available to the database.In this example, all the data in the Items table except the <strong>FILESTREAM</strong> columns will beavailable for reading and writing. However, if we attempt to access the <strong>FILESTREAM</strong> data,<strong>SQL</strong> <strong>Server</strong> will generate an error. <strong>The</strong>refore, the SELECT * on the Items table will failbecause this operation attempts to read the <strong>FILESTREAM</strong> column along with all the othercolumns, as illustrated in Listing 8-13.324

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

Saved successfully!

Ooh no, something went wrong!