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 7: <strong>FILESTREAM</strong> Database AdministrationSELECTsnapshot_isolation_state_descFROM sys.databasesWHERE name = DB_NAME()/*snapshot_isolation_state_desc------------------------------OFF*/Listing 7-1:Determining whether snapshot isolation level is enabled.If the snapshot isolation level is disabled (OFF), we can enable it by running the queryin Listing 7-2. Note, again, that <strong>SQL</strong> <strong>Server</strong> 2008 does not allow you to enable snapshotisolation level on databases having <strong>FILESTREAM</strong> filegroups. This restriction has beenremoved in <strong>SQL</strong> <strong>Server</strong> 2008 R2.ALTER DATABASE NorthPoleSET ALLOW_SNAPSHOT_ISOLATION ONListing 7-2:Enabling snapshot isolation level on a database.<strong>The</strong>refore, starting from <strong>SQL</strong> <strong>Server</strong> 2008 R2, we can use snapshot isolation to access a<strong>FILESTREAM</strong> data value for read operations even if the row being read is locked (sharedor exclusive). However, write operations are not permitted on the rows that are alreadylocked (shared or exclusive) by another session. If any attempt is made to do so, <strong>SQL</strong><strong>Server</strong> will display the following error:<strong>The</strong> process cannot access the file specified because it has been opened in anothertransaction.274

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

Saved successfully!

Ooh no, something went wrong!