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 9: Investigating <strong>FILESTREAM</strong> DatabasesIdentifying the <strong>FILESTREAM</strong> file name associated with each<strong>FILESTREAM</strong> value<strong>SQL</strong> <strong>Server</strong> names <strong>FILESTREAM</strong> files based on the transaction LSN that created the file.<strong>SQL</strong> <strong>Server</strong> keeps track <strong>of</strong> this value internally and uses it to identify the correct file whena read/write request comes in.Though it is possible to identify the disk file associated with each <strong>FILESTREAM</strong> valueon your <strong>FILESTREAM</strong> column, it is a lengthy process. <strong>SQL</strong> <strong>Server</strong> MVP Paul Randal haswritten a detailed blog post which explains how to do this. I would recommend you take alook at it (http://brurl.com/fs9).<strong>FILESTREAM</strong>-related DMVs<strong>SQL</strong> <strong>Server</strong> has a number <strong>of</strong> <strong>FILESTREAM</strong>-related DMV views that we can use t<strong>of</strong>ind very detailed information regarding <strong>FILESTREAM</strong> storage and activity against<strong>FILESTREAM</strong> databases.sys.dm_filestream_file_io_handlesThis DMV returns all the open <strong>FILESTREAM</strong> handles which any client application hasopened using the Win32 API function OpenSqlFilestream or the SqlFilestreammanaged class. It has a number <strong>of</strong> columns providing detailed information about theopen I/O handles. You can find a complete reference <strong>of</strong> all the columns in MSDN athttp://brurl.com/fs10. <strong>The</strong> columns below may be particularly helpful.• filestream_transaction_id – Shows the ID <strong>of</strong> the transactionassociated with the given handle. This is the value returned by the346

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

Saved successfully!

Ooh no, something went wrong!