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 7: <strong>FILESTREAM</strong> Database AdministrationUSE masterGOIF DB_ID('NorthPole') IS NOT NULLDROP DATABASE NorthPoleGOCREATE DATABASE NorthPole ONPRIMARY (NAME = NorthPole,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole.mdf'),FILEGROUP NorthPole2(NAME = NorthPole2,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole2.ndf'),FILEGROUP NorthPole_fs1 CONTAINS <strong>FILESTREAM</strong> DEFAULT(NAME = NorthPole_fs1,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs1'),FILEGROUP NorthPole_fs2 CONTAINS <strong>FILESTREAM</strong>(NAME = NorthPole_fs2,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs2')LOG ON (NAME = NorthPole_log,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_log.ldf')GOListing 7-28:Creating a <strong>FILESTREAM</strong> database with multiple <strong>FILESTREAM</strong> filegroups.This database contains a primary filegroup (NorthPole) containing the primary datafile, a filegroup called NorthPole2, containing a secondary data file, two <strong>FILESTREAM</strong>filegroups, NorthPole_fs1 and NorthPole_fs2, and the log file. Purely for convenience,all <strong>of</strong> these are stored on the same disk volume but, in a real-world scenario, you'dprobably put all these files on different disk volumes.Next, we're going to create two partitions to store the <strong>FILESTREAM</strong> data. Listing 7-29shows the partition function and partition schemes to do this, assuming we're going topartition the table by the ID column. Take a look at the code and then we'll discuss howit works.300

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

Saved successfully!

Ooh no, something went wrong!