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-- Set the database recovery model to fullALTER DATABASE NorthPole SET RECOVERY FULLGO-- Create a table with a <strong>FILESTREAM</strong> columnUSE NorthPoleGO-- Create the "Items" tableCREATE TABLE [dbo].[Items]([ItemID] UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE,[ItemNumber] VARCHAR(20),[ItemDescription] VARCHAR(50),[ItemImage] VARBINARY(MAX) <strong>FILESTREAM</strong> NULL,[CreatedDate] DATETIME DEFAULT GETDATE())GO-- Insert the data into the tableINSERT INTO Items (ItemID, ItemNumber, ItemDescription, ItemImage)SELECTNEWID(), 'MS1001', 'Micros<strong>of</strong>t Mouse',CAST(bulkcolumn AS VARBINARY(MAX))FROM OPENROWSET(BULK 'C:\<strong>Art</strong>OfFS\Demos\Images\Micros<strong>of</strong>tMouse.jpg', SINGLE_BLOB) AS xListing 8-1:T-<strong>SQL</strong> script to create the sample database for the examples in this chapter.Backing up <strong>FILESTREAM</strong> DatabasesIn this section we'll consider the three most common types <strong>of</strong> database backup.• Full database backup – Backs up all the data and objects in all the data files associatedwith a database.• Differential database backup – Backs up any data and objects in all the data files for agiven database that have changed since the last full backup.314

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

Saved successfully!

Ooh no, something went wrong!