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> DatabasesHowever, there may be times when a DBA does not want the <strong>FILESTREAM</strong> data to bepart <strong>of</strong> the regular database backups. For example, you may want to grab a most recentcopy <strong>of</strong> the production database and send it to the development/test team. A productiondatabase with <strong>FILESTREAM</strong> data could be quite large, and you might only need therelational data for your development or test environment.It is possible to create a full file backup <strong>of</strong> a <strong>FILESTREAM</strong> database to exclude the<strong>FILESTREAM</strong> filegroups. This is helpful when you do not care about the <strong>FILESTREAM</strong>data and only want to deal with the relational data. When you restore such a backupusing the Enterprise edition <strong>of</strong> <strong>SQL</strong> <strong>Server</strong>, you will be able to query all the relationaldata. However, any query that tries to access the <strong>FILESTREAM</strong> data will obviously fail.Let's go ahead and run some scripts to see this in action. First, rerun the script in Listing8-1 to re-create the sample database, and then run the script provided in Listing 8-10 totake a backup <strong>of</strong> the PRIMARY filegroup (excluding the <strong>FILESTREAM</strong> filegroup).-- Take a backupBACKUP DATABASE NorthPoleFILEGROUP = 'PRIMARY'TO DISK = 'C:\<strong>Art</strong>OfFS\Demos\Chapter8\bak\NorthPolePrimary.bak'GOListing 8-10:Creating a file backup that excludes the <strong>FILESTREAM</strong> filegroup.Now let's go ahead and create a new database from this partial backup.-- RestoreRESTORE DATABASE NorthPolePartialFROM DISK = 'C:\<strong>Art</strong>OfFS\Demos\Chapter8\bak\NorthPolePrimary.bak'WITH RECOVERY,PARTIAL,MOVE 'NorthPole' TO 'C:\<strong>Art</strong>OfFS\Demos\Chapter8\NorthPolePartial.mdf',MOVE 'NorthPole_log' TO 'C:\<strong>Art</strong>OfFS\Demos\Chapter8\NorthPolePartial_log.ldf',GOListing 8-11:Restoring a partial backup that excludes <strong>FILESTREAM</strong> filegroups.323

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

Saved successfully!

Ooh no, something went wrong!