SQL Server 2008 R2 Remote Blob Storage
SQL Server 2008 R2 Remote Blob Storage
Summary:
This document contains extensive information about Microsoft SQL Server 2008 R2 Remote
BLOB Storage and the FILESTREAM RBS Provider. It also discusses how the FILESTREAM
RBS Provider can be implemented in Microsoft SharePoint Server 2010.
SQL Server 2008 R2 Remote BLOB Storage
Copyright
The information contained in this document represents the current view of Microsoft Corporation
on the issues discussed as of the date of publication. Because Microsoft must respond to
changing market conditions, it should not be interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the
date of publication.
This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES,
EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the
rights under copyright, no part of this document may be reproduced, stored in, or introduced into
a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise), or for any purpose, without the express written
permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual
property rights covering subject matter in this document. Except as expressly provided in any
written license agreement from Microsoft, the furnishing of this document does not give you any
license to these patents, trademarks, copyrights, or other intellectual property.
Microsoft, <plus, in alphabetical order, all Microsoft trademarks used in your white paper> are
trademarks of the Microsoft group of companies.
2
SQL Server 2008 R2 Remote BLOB Storage
Contents
Introduction: What is Remote BLOB Storage?.............................................................................6
The Case for RBS.................................................................................................................... 6
Large Database of Mostly Binary Data.................................................................................6
Digital Asset Management Databases..................................................................................7
When Storage Tiers Need to be Implemented......................................................................7
When Storage Needs to be Optimized.................................................................................7
Installing, Configuring, and Administering RBS............................................................................8
Component Overview...............................................................................................................8
RBS Feature Pack................................................................................................................ 8
Important RBS Concepts........................................................................................................11
Entity Relationships............................................................................................................ 12
Differences between LOCAL and REMOTE FILESTREAM Providers................................12
High Availability Considerations..........................................................................................14
Process Flow.......................................................................................................................... 15
BLOB Insert........................................................................................................................ 15
BLOB Retrieval................................................................................................................... 16
BLOB Delete....................................................................................................................... 17
BLOB Delete Propagation..................................................................................................17
Pre-requisites and Required Resources.................................................................................18
Enabling FILESTREAM for file I/O Streaming Access.......................................................18
Setting the filestream_access_level Parameter..................................................................20
Storage Architecture Considerations......................................................................................20
Implementation Guidance......................................................................................................21
Installing the RBS Feature Pack.............................................................................................21
Database Preparation.........................................................................................................21
Executing the RBS Feature Pack Installer..........................................................................21
Installing on Multiple Servers..............................................................................................32
Configuring RBS.................................................................................................................... 33
BLOB Store Core Configuration Settings............................................................................33
BLOB Store Extended Configuration Settings....................................................................33
RBS Configuration Settings................................................................................................34
3
SQL Server 2008 R2 Remote BLOB Storage
4
SQL Server 2008 R2 Remote BLOB Storage
5
SQL Server 2008 R2 Remote BLOB Storage
Introduction
As the volume of data generated by applications and services increase, the distribution of data
types that are stored in databases is also changing. Take for instance a document management
server system. Such a system may have thousands of versioned documents stored as blobs
(binary large objects) directly in the database along with the document metadata. As the usage
increases, the total size of binary document blobs will far outweigh the size of the document
metadata and other structured data. This skews the ratio of structured vs. unstructured binary
data far to the side of unstructured data. There are several advantages in moving the
unstructured data, simply referred to as BLOB data hereafter, outside of the main database.
This reserves the relational database storage for data which will be referenced in queries, and
places the bulk, unstructured data on storage more appropriate for it.
SQL Server 2008 R2 Remote BLOB Store (RBS) is an add-on feature pack for Microsoft SQL
Server 2008 R2. RBS is designed to move the storage of binary large objects (BLOBs) from
database servers to commodity storage solutions. With RBS, BLOB data is stored in storage
solutions such as Content Addressable Stores (CAS), commodity hardware storage systems
attached to the Databases and File systems or cloud storage solutions like Microsoft Windows
Azure.
A client application, such as Microsoft SharePoint 2010, can take advantage of SQL Server
2008 R2 and Remote BLOB Storage to store BLOB data. SharePoint 2010 supports the RBS
Feature Pack which facilitates the storage of the BLOB data outside of the SharePoint content
database.
NOTE: SharePoint 2010 may be generically referenced in this whitepaper. Unless otherwise
indicated this term applies to both Microsoft SharePoint Foundation 2010 and Microsoft
SharePoint Server 2010.
6
SQL Server 2008 R2 Remote BLOB Storage
Regular DBCC consistency checks will take much longer. If database integrity is not
regularly monitored, the risk of a corrupted database is considerably increased. Larger
databases will have a higher risk of corruption due to physical storage errors simply
because of the large quantity of storage they consume.
For these reasons, enabling RBS on an otherwise very large database can be very beneficial as
each of the concerns addressed above are alleviated.
Consider the scenario of a custom application that is designed to provide training content to
users. The application will contains less than 1000 documents but they are all training videos
that average 200MB in size. The database for this application would be nearly 200GB in size
even though there are relatively few documents. By enabling RBS, the binary data for these
videos can be kept out of the database while the structured metadata in the database remains
responsive and easy to manage. This is a much more natural and integrated solution than
allowing the video files to inflate the database or forcing the actual source videos to be stored in
an unmanaged location outside of the control of the application.
Consider the scenario where a document management solution has been or will be deployed for
an organization. A large percentage of the corporate user base will be adding and editing
collaborative content on a daily basis. Over time, a very large number of customer centric
documents are created, possibly declared as records for retention, and then archived.
In this scenario, an RBS provider that enables a tiered storage platform could provide
tremendous cost savings by intelligently managing the storage location of BLOB data. New and
frequently accessed content could be stored in high performance storage. Older documents
that are accessed only occasionally could be automatically moved to lower cost and lower
performance storage such as SATA arrays for example. Then over time, very old documents
that are rarely accessed could be automatically moved again to extremely inexpensive cloud
based storage. In all cases, end users are able to access content in real time but the
responsiveness and cost of the storage is intelligently managed.
7
SQL Server 2008 R2 Remote BLOB Storage
Also, RBS providers have an additional advantage in that they can perform additional
processing on the BLOB stream as it is being passed to the BLOB store. For example, some
providers may compress and decompress the BLOB content on the way to and from the BLOB
store. This results in a smaller overall storage footprint for the same BLOB data. This practice
should be carefully managed such that significant additional storage and retrieval latency is not
added to BLOB store operations.
The premise of the information in this section is the installation of the Local FILESTREAM RBS
provider along with the rest of the RBS Feature Pack. TechNet provides additional procedures
for deploying RBS without the FILESTREAM provider. If the FILESTREAM provider is not being
installed, then it is assumed that additional installation guidance will be provided by creator of
the RBS provider being implemented.
While the information in this section is directed towards the FILESTREAM RBS provider
implementation for SharePoint 2010, most of the information is applicable even if the
FILESTREAM RBS provider is not being implemented, such as when some other 3rd party RBS
provider is being deployed. Similarly, most of this information is also applicable for client
applications other than SharePoint 2010.
Component Overview
The SQL RBS framework is entirely contained in the RBS Feature Pack. This feature pack
contains elements that can be used to describe the core components of the RBS framework.
Server
The Server component refers to the T-SQL script that is used to deploy the RBS database
objects into the client database. The RBS database objects consist of ancillary tables, views,
stored procedures, functions, schemas and security roles. When the Server component is
selected for installation, this simply means that the T-SQL script will be installed to the RBS
8
SQL Server 2008 R2 Remote BLOB Storage
Feature Pack installation directory on the client server. It will not actually be executed on a
client database unless the Execute Script subcomponent is also selected.
When the RBS objects are properly deployed to a content database, the RBS “server” is
considered to be installed.
Client
The Client component refers to the RBS client library that is the key to the generic interface of
the client application and an RBS provider. The client library provides an abstract class that
must be implemented by the RBS provider. The abstract class in the client library ensures that
the RBS provider will provide the required functional components necessary to interact with the
BLOB store. When this component of the RBS Feature Pack is selected for installation, the
install process will deploy the client library to the RBS Feature Pack install location.
Thanks to the provider model, the client application instantiates only the general client library to
perform BLOB operations. It then invokes the RBS provider library to fulfill the request.
All BLOB objects that pass to and from the BLOB store are derived from the System.IO.Stream
object. This allows for binary data to be transferred between the BLOB store and the client
application in the most efficient way possible.
FILESTREAM Provider
Like any RBS provider, the FILESTREAM provider implements the BLOB Store abstract class in
the Client library in order to provide BLOB operation functionality to the client application. The
FILESTREAM provider utilizes SQL Server’s FILESTREAM technology to store BLOBs as files
in the NTFS file system. For more details on the FILESTREAM technology, reference the
FILESTREAM Storage in SQL Server 2008 whitepaper.
The FILESTREAM RBS provider has been extensively tested by the SQL Server development
team to ensure that it meets the reliability and scalability needs of an enterprise class solution.
Other software vendors have also developed RBS providers. There are positives and negatives
regardless of the provider that is chosen. The most basic distinction between the FILESTREAM
RBS provider and other third party providers is that deploying the FILESTREAM RBS provider,
while fully functional, results in more administrative overhead when compared with third party
providers. In contrast, third party providers typically have intuitive graphical user interfaces that
ease the administrative burden. But perhaps a more relevant distinction for most organizations
is that third party providers typically come at a significant cost. A licensing cost, annual
maintenance cost, or both will typically be required before the provider can be deployed in
production. In contrast, the FILESTREAM RBS provider from Microsoft is available at no cost
as part of the SQL Server 2008 R2 feature pack.
During RBS Feature Pack installation, selecting the FILESTREAM provider component will
cause the FILESTREAM provider to be installed and configured.
Selecting the Client subcomponent of the FILESTREAM provider will cause the FILESTREAM
provider library to be deployed to the Global Assembly Cache (GAC) so that the client library is
9
SQL Server 2008 R2 Remote BLOB Storage
The FILESTREAM Provider Server subcomponent refers to the T-SQL scripts, specific to the
FILESTREAM provider, that enable the provider to interact with the FILESTREAM file group for
the BLOB store. Selecting this subcomponent instructs the installer to deploy these scripts to
the RBS Feature Pack installation folder. But these scripts will not be executed unless the
Server => Execute Scripts subcomponent is selected.
NOTE: If the Local FILESTREAM provider is being deployed, the FILESTREAM provider
Server subcomponent T-SQL scripts will be executed in the context of the client database. If
the Remote FILESTREAM provider is being deployed, the FILESTREAM provider Server
subcomponent T-SQL scripts are executed in the context of an additional database, possibly on
a different server. The only purpose of this second database is to facilitate BLOB store
operations. An explanation of the LOCAL and REMOTE FILESTREAM providers are described
in the section below titled “Differences between LOCAL and REMOTE FILESTREAM
Providers”.
Maintainer
The Maintainer is a console application that facilitates lazy garbage collection processing and
other maintenance tasks. It is a client application that invokes special methods in the client
library to ensure that the BLOB store, the data in the RBS ancillary tables, and the BLOB
references in the client database remain in a consistent state. Because Maintainer invokes the
client library to perform all operations, it is provider agnostic. It doesn’t care what RBS provider
is being invoked by the client library.
The Maintainer is intended to be executed on a regular basis via the Task Scheduler. A
separate task should be scheduled for each client database that has been RBS enabled. The
Maintainer can be executed in order to perform the following maintenance tasks:
10
SQL Server 2008 R2 Remote BLOB Storage
expired. Once the delete has been fully propagated by the RBS maintainer, the BLOB is
no longer recoverable. Care should be taken to set the SLA required restore timeframe
correctly.
Orphan Cleanup. Orphans are created when a BLOB is created in the BLOB store but,
due to a rare situation like an application or server crash, the document row is not
committed to the client database. These orphans need to be garbage collected
periodically. Orphan cleanup is done by enumerating all BLOBs present in the BLOB
store which were created before the orphan cleanup time window, and from this list,
removing those BLOBs that are referenced by the database. The BLOBs remaining in
the list are deleted from the BLOB store. This process is executed on a subset of the
BLOB store documents called a pool.
It is normal for Orphan cleanup to take a lot of time. So it should be scheduled with a lower
frequency than delete propagation. Orphan cleanup can affect farm performance; particularly if
storage pools are allowed grow to contain very large number of BLOBs. This can be mitigated
by limiting pool sizes to a number that can be processed in a relatively short amount of time.
The pool size can be set during initial install or reconfigured after installation. When executing
the RBS Feature Pack installer using the installer UI, an option will be presented on the
FILESTREAM BLOB Store configuration dialog box that will allow advanced configuration
options (see Figure 1-1). This will allow the configuration of the storage pool size during
installation (see Figure 1-2).
Figure 1-1
11
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-2
But be careful not to set the pool size too small. The FILESTREAM provider creates a data
table in the client database to manage each pool. Try to balance the number of documents in
each pool and the number of pools with respect to the projected number of documents that will
allowed in the client application database. Orphan cleanup is a metadata operation which
means the full BLOB data is not parsed. The default value should be fine in most cases.
Entity Relationships
Continuing on with important concepts, it is important to understand the various components of
an RBS implementation. In this section the major components and their relationships will be
described so that they can be referenced throughout this document.
BLOB Store
The BLOB store is the final storage location of all BLOB content. A BLOB store can be any
storage location or device. Examples are NTFS file systems, SMB network shares, Content
Addressable Stores (CAS) or some other commodity (cloud) storage solution. RBS providers
are created to specifically support one or more BLOB Stores. It is the RBS provider that
maintains the specific code that is necessary to interact with a given BLOB store.
12
SQL Server 2008 R2 Remote BLOB Storage
It is possible to have multiple, populated BLOB Stores associated with a client database. For
example, it is possible to initially register a FILESTREAM BLOB store in a client application
database and then later register a BLOB store that uses a second provider in order to take
advantage of a CAS device. While both BLOB stores can be active and serve BLOB content,
only one BLOB store can be configured to receive new BLOB data at any given time.
When deploying the Local FILESTREAM provider the FILESTREAM file group is created
directly in the database that is being RBS enabled. This means that the same SQL Server that
is processing requests from the client application database is also acting as a BLOB store (see
Figure 1-3).
Figure 1-3
Lo c a l FILES TREAM S QL S e r ve r
When deploying the Remote FILESTREAM provider, the FILESTREAM file group can be
created in a database that is NOT the content database being RBS enabled (see Figure 1-4). In
fact, the FILESTREAM file group can even be created in a database that is hosted on an
entirely DIFFERENT (or REMOTE) SQL Server (see Figure 1-5). This means that a second
SQL Server can be deployed and dedicated to servicing RBS BLOB store requests, allowing the
SQL Server that hosts application databases to be dedicated to application processing. In
extreme scale environments this can result in a significant improvement to application
scalability.
13
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-4
BLOB S to re
(File Gr ou p a n d ta b le s )
Figure 1-5
BLOB S to re
Da ta b a s e
BLOB S to re
(File Gr ou p a n d ta b le s )
14
SQL Server 2008 R2 Remote BLOB Storage
availability of the BLOB references in the database when the provider is a FILESTREAM
provider. A separate solution, implemented at the scope of the BLOB store, must be
implemented to ensure the availability of BLOB data.
Mirroring and Replication. SQL mirroring and replication is supported for only the
BLOB references in the database as long as BLOB data mirror processing can stay
ahead of database (metadata) mirroring to ensure link level consistency. BLOB data in
the BLOB store is not mirrored or replicated. Many BLOB store devices can provide
mirroring and replication capabilities. These features must be supported by the RBS
provider in order for mirroring and replication of both the SQL data and the BLOB store
data to be successful. SQL mirroring can’t be used with SQL Server 2008 R2 if the
LOCAL FILESTREAM provider is used. Mirroring can be used for the client/content
database, but not on the remote BLOB store database if REMOTE FILESTREAM
provider OR a third party provider is used.
Process Flow
Now that a basic understanding of the underlying RBS entities has been established, let’s take a
look at the process flow for various RBS activities. For each of the following flow charts,
assume that RBS has been enabled for the content database.
BLOB Insert
Reference the flow chart in Figure 1-6 using the step descriptions below the flow chart.
Figure 1-6
Ap p lic a tio n S e r ve r
11 S QL S e rve r
12
Ap p lic a tio n (Ap p lic a tio n Da ta b a s e )
End Us e r 10
1 RBS Au x
Re s o ur c e s
2 9
8
RBS Clie n t
Lib ra r y 7
BLOB S to r e
3 6
P r o vid e r 5
Lib r a r y
4
15
SQL Server 2008 R2 Remote BLOB Storage
3. The client library invokes the provider library in order to write the BLOB data to the
BLOB store.
4. The provider library writes the BLOB stream to the BLOB store. The BLOB store
generates the store_blob_id which is used as all or part of a file name as the BLOB data
is stored in the BLOB store.
5. The BLOB may return a StoreBlobId. This is typical of CAS device, cloud storage, or
other similar BLOB store.
6. The StoreBlobId is returned to the client library and stored in the RBS auxiliary tables.
7. The client library registers the BLOB in the RBS auxiliary tables in the content database
using a BLOB Registration stored procedure. The CollectionId, BLOBStoreId,
StorePoolId, StoreBlobId, CreatedTime, and BlobSize are passed into a stored
procedure.
8. The registration stored procedure returns the BlobNumber to the client library. The client
library uses the BlobNumber, CollectionId, and additional flags to construct a byte array
that represents the BlobId.
9. The BlobId is returned to application.
10. The application sends the document metadata, including the BlobId, to the database.
The BlobId is stored in the registered RBS column and table.
11. The success or failure of the document insert is returned to the calling application
method.
12. The success or failure of the upload operation to the application is returned to the end
user.
BLOB Retrieval
Reference the flow chart in Figure 1-7 using the step descriptions below the flow chart.
Figure 1-7
Ap p lic a tio n S e r ve r
2 S QL S e rve r
1
Ap p lic a tio n (Ap p lic a tio n Da ta b a s e )
End Us e r 3
12 RBS Au x
Re s o ur c e s
11 4
5
RBS Clie n t
Lib ra r y 6
7 BLOB S to r e
10
P r o vid e r 8
Lib r a r y
9
16
SQL Server 2008 R2 Remote BLOB Storage
3. The client database returns the document metadata, including values from the registered
RBS column which contains the BlobId.
4. Because the registered RBS column value is not null, the application knows that it must
invoke the RBS client library to retrieve the BLOB data for the document. The
application uses the RBS Client Library to create an RBS Session. The RBS Session is
used to instantiate a BLOB object using the BlobId.
5. During BLOB object instantiation, the RBS Client Library passes the BlobId information
to an RBS stored procedure in the client database.
6. The RBS stored procedure returns the information necessary to construct a
BlobReference. Specifically, the StoreBlobId, which is part of the BlobReference, is
needed before the BLOB stream can be returned to the application.
7. The application calls for a readable stream through client library. The client library
invokes the provider library to retrieve the readable stream. The provider library uses
the BlobReference in order to construct a request to the BLOB store.
8. The provider library sends a request for the BLOB stream to the BLOB store using the
StoreBlobId from the BlobReference.
9. The BLOB store returns a BLOB stream to the provider library.
10. The provider library forwards the readable BLOB stream to the client library.
11. The client library returns the readable BLOB stream to the calling application method.
12. The application streams the document data to the end user.
BLOB Delete
Document BLOB data should not be deleted immediately when a document in an RBS enabled
application is deleted. RBS must conform to SLA requirements that support a defined
document restoration window. If BLOB data is removed immediately and a restore operation
returns metadata for a deleted document to the content database, then the end user would not
be able to retrieve the document because the BLOB data does not exist in the BLOB store.
For this reason, deleting a document in an RBS enabled application is the same regardless of
whether or not RBS is enabled.
At this point, all application metadata regarding the document has been deleted from the
database. However, a BlobReference still exists in the RBS ancillary tables. This
BlobReference will be used when a scheduled task launches the Maintainer application and
initiates Delete Propagation which will finally remove the BLOB from the BLOB store.
17
SQL Server 2008 R2 Remote BLOB Storage
column in the application tables. The deleted items are then stored in the RBS auxiliary tables
for delete propagation by the Maintainer after the Garbage Collection Time Window has
elapsed.
Reference the flow chart in Figure 1-8 using the step descriptions below the flow chart for an
explanation of the Delete Propagation Phase processing by the Maintainer.
Figure 1-8
S QL S e r ve r
1
Ma in ta in e r
2 RBS Au x
Re s o ur c e s
3 10
9
RBS Clie n t
Lib ra ry 8
7 BLOB S to re
4 6
P r ovid e r
Lib r a r y
5
1. Maintainer calls a stored procedure to request a list of BlobReference values for BLOBs
that need to be deleted from the BLOB store.
2. The stored procedure returns a list of BlobReference values that have been deleted for a
period of time that has exceeded the garbage collection time window.
3. Maintainer calls the client library in order to initiate a BLOB delete operation.
4. The client library invokes the appropriate provider library to initiate the BLOB delete
operation.
5. The provider library commands the BLOB store to delete the BLOB.
6. The BLOB store returns the success or failure of the delete operation to the provider
library.
7. The provider library passes the result of the delete operation to the client library.
8. Upon successful deletion from the BLOB store, the client library calls an RBS stored
procedure which removes the BlobReference from the appropriate RBS auxiliary tables.
9. The result of the BlobReference delete stored procedure is returned to the client library.
10. The client library returns the result of the delete operation to the Maintainer.
11. Steps 3 through 10 are repeated until the entire list of BLOBs has been deleted, the time
limit specified by TimeLimit parameter has elapsed, or the Maintainer application is
forcibly terminated.
18
SQL Server 2008 R2 Remote BLOB Storage
1. Click Start => All Programs => SQL Server 2008 R2 => Configuration Tools => SQL
Server Configuration Manager.
2. Under SQL Server Configuration Manager in the left pane, select SQL Server Services.
3. Locate the instance of the SQL Server that needs to be enabled. (see Figure 1-9)
Figure 1-9
19
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-10
Any changes to FILESTREAM configuration will not be implemented until the SQL Server
service is restarted.
1. Open SQL Management Studio and click New Query to launch the Query Editor
2. Execute the following commands using the Query Editor:
3. To verify that the configuration has been enabled, execute the following command using
the Query Editor:
20
SQL Server 2008 R2 Remote BLOB Storage
Regardless of the RBS provider that is implemented, be sure to test storage and retrieval
latency as this can have a dramatic impact to the usability of the RBS enabled application. This
can be of particular concern with cloud based strategies and certain extreme scale CAS storage
systems.
Implementation Guidance
There are a few possible pitfalls that can cause problems in an RBS implementation.
Understand these considerations when deploying RBS:
Maintainer Scheduling. When executing the RBS Feature Pack installer, do not use
the installer UI to schedule the Maintainer application. This installation task can fail
which can cause the entire RBS Feature Pack installation to roll back. It is better to
manually schedule the Maintainer execution after the RBS Feature Pack has been
installed.
Client Logging Configuration. When executing the RBS Feature Pack installer using
the installer UI, do not change the logging options unless directed to do so by a support
technician. Verbose logging can have a negative impact on the performance of an RBS
enabled application.
Database Preparation
Before the RBS Feature Pack installer can be executed, the database must first be prepared.
First, you must ensure that a database master key is present as this is required for RBS
installation. The master key is used for RBS credential encryption and the module signing /
schema separation of the RBS internal tables and external views / stored procedures. More
information on the master key requirement can be found in this blog post from the SQL RBS
Team.
Second, in the case of the FILESTREAM provider, the FILESTREAM file group must be
created. This TechNet topic addresses the process for properly creating a FILESTREAM file
group.
21
SQL Server 2008 R2 Remote BLOB Storage
When running the installer, the user will first be presented with the Welcome screen followed by
standard License Agreement and Registration screens. The screen definitions below describe
relevant information for each of the remaining configuration screens.
For each of the screens, the configuration information will be described and the related
command line options will be defined.
The features listed in this screen have already been described in detail in the Component
Overview section above. All selected feature components listed on this screen will be deployed
and/or executed during the installation process.
The configuration options on this screen coincide with the ADDLOCAL command line parameter
in the following way:
22
SQL Server 2008 R2 Remote BLOB Storage
[1] ServerScript
[2] EnableRbs
[3] Client
[4] Filestream
[5] FilestreamClient
[6] FilestreamServer
[7] FilestreamRunScript
[8] Maintainer
[9] Docs
When executing the installer package by command line and using the ADDLOCAL command
line parameter, one or more of these features can be installed. In order to install more than one
feature, separate multiple feature names using a comma. An example of the ADDLOCAL
command line parameter is provided:
ADDLOCAL="Client,Docs,Maintainer,ServerScript,FilestreamClient"
If the ADDLOCAL command line parameter is omitted, all features are installed by default.
The database connection screen provides configuration options that identify the client database
for which RBS will be enabled. These options are:
Server\Instance: This is the name of the SQL Server Instance that services the client
database. This field coincides with the DBINSTANCE command line parameter value.
For example:
23
SQL Server 2008 R2 Remote BLOB Storage
Database name: This is the name of the client database for which RBS will be enabled.
This field coincides with the DBNAME command line parameter. For example:
DBNAME="[Database_Name]"
File group for internal tables: This is the name of the file group in the client database
where the RBS auxiliary tables will be stored. This field coincides with the FILEGROUP
command line parameter. For example:
FILEGROUP="PRIMARY"
Windows / SQL Server Authentication: This flag determines whether or not integrated
security will be used when connecting to the client database. This field coincides with
the INTEGRATEDSECURITY command line parameter. When using the command line,
a value of [1] should be provided when integrated security should be used. A value of
[0] should be provided when SQL Server Authentication should be used. For example:
INTEGRATEDSECURITY=1
SQL Server Authentication => User Name and Password: This is the user name and
password of the SQL Server security account that should be used to connect to the
client database. These values are only valid when SQL Server Authentication is being
used.
NOTE: SQL Server Authentication is disabled and should not be used when the
FILESTREAM provider is being installed. The FILESTREAM provider does not support
SQL Server Authentication.
These fields coincide with the DBUSERNAME and DBPASSWORD command line
parameter. When using the command line and SQL Server Authentication is being
used, these parameters are required. For example:
The install user can use the “Test Connection” button to ensure that the installer is able to
properly connect to the configured database using the provided credentials.
24
SQL Server 2008 R2 Remote BLOB Storage
The FILESTREAM database connection screen allows for the configuration of the connection to
the database that contains the FILESTREAM file group that will be used as the BLOB store.
This configuration only applies when the FILESTREAM provider is being used. The
configuration options are:
Store blobs in a separate database: This flag determines if the file groups for the
internal FILESTREAM provider tables and the FILESTREAM BLOB store will exist in the
same database as the client database or if they will exist in a different database. When
the FILESTREAM provider file groups are designated for the same for the same
database, this is considered to be a Local FILESTREAM provider deployment.
When the FILESTREAM provider file groups are designated to be stored in a database
that is not the client database, this is considered to be a Remote FILESTREAM provider
deployment.
This flag coincides with the REMOTEFSSTORE command line parameter. Possible
values are [0] which represents a Local FILESTREAM provider deployment or [1] which
represents a Remote FILESTREAM provider deployment. For example:
REMOTEFSSTORE=0
25
SQL Server 2008 R2 Remote BLOB Storage
File group for internal tables: This is the name of the file group where the
FILESTREAM provider specific tables will be deployed. This field coincides with the
FILESTREAMDATAFILEGROUP command line parameter. For example:
FILESTREAMDATAFILEGROUP=”PRIMARY”
FILESTREAM BLOB store file group: This is the name of the FILESTREAM file group
that will be used by the FILESTREAM provider as the BLOB store. The destination
FILESTREAM file group must be created before the installer is executed. This field
coincides with the FILESTREAMFILEGROUP command line parameter. For example:
FILESTREAMFILEGROUP=RBSFilestreamProvider
The install user can use the “Test Connection” button to ensure that the installer is able to
properly connect to the configured database using the provided credentials.
This flag indicates whether or not connecting clients will be requested to trust the self-signed
certificates for encrypted connections initiated by RBS. This means that an SSL channel can be
set up without requiring the server to have a certificate chain that terminates in a root Certificate
Authority (CA). This flag relates to the TrustServerCertificate keyword for SQL Server
connection strings and should generally be enabled. This flag coincides with the
26
SQL Server 2008 R2 Remote BLOB Storage
TRUSTSERVERCERTIFICATE=1
The FILESTREAM BLOB Store configuration screen allows for the configuration of the BLOB
store name and schema suffix in order to allow for the installation of more than one provider
instance into the same database without conflicting schemas in the database. It also provides a
flag that determines if the installation UI will present the advanced configuration options on the
subsequent screen in the wizard.
Store Name: This is the name of the BLOB store that is used to distinguish different
BLOB stores both internally and externally. This field coincides with the
FILESTREAMSTORENAME command line parameter. For example:
FILESTREAMSTORENAME=FilestreamProvider_1
Schema Suffix: When provided, this suffix will be appended to the name of the internal
FILESTREAM provider schema in order to ensure that the instance of the FILESTREAM
provider is unique in the database. This allows more than one provider instance to be
deployed in the same database. This field coincides with the SCHEMASUFFIX
command line parameter. For example:
SCHEMASUFFIX=samplesuffix1
27
SQL Server 2008 R2 Remote BLOB Storage
The FILESTREAM BLOB Store Advanced Configuration screen allows the installer to
manipulate a more advanced set of parameters. In general, the default values represent the
best value to ensure the best possible RBS performance. However, there may be times when it
makes sense to adjust these values.
Transaction pool size: This number represents the size of the internal “read”
transaction pool. A read transaction is necessary for BLOB retrieval. Read transactions
are opened on demand and then pooled for the transaction lifetime. The default value of
5 should be used unless instructed otherwise by Microsoft support. This field coincides
with the FILESTREAMTRANPOOLSIZE command line parameter. For example:
FILESTREAMTRANPOOLSIZE=5
Pool transaction lifetime: This is the length of time that “read” transactions (described
above) are allowed to live before they are drained of any open handles and closed. The
default value of 1 minute should be used unless instructed otherwise by Microsoft
support. This field coincides with the FILESTREAMTRANPOOLTRANLIFETIME
command line parameter. The value for this parameter is expressed as a text value that
represents a duration expression. For example:
FILESTREAMTRANPOOLTRANLIFETIME=”time 00:01:00”
28
SQL Server 2008 R2 Remote BLOB Storage
Pool Capacity: This is number of BLOBs that constitute a BLOB store pool that is “full”.
Once the pool is full, RBS creates a new pool for the storage of additional BLOBs. The
size of the pool is important because it defines the maximum number of documents that
can be processed by the Maintainer application during a garbage collection session.
Smaller pools decrease maintenance time and result in fewer documents being stored in
a pool folder in the file system. However, the FILESTREAM provider creates a table for
every pool in the database. So it is important to seek balance when determining the size
of the pool. The 200,000 default value is a good start. It might be worth decreasing this
value if the documents being stored are generally very large but fewer in numbers such
as large graphics or video files that might be stored in a Digital Asset Management
application.
FILESTREAMMAXPOOLSIZE=200000
Maximum BLOB size for in-band write operations: This value will determine, based
on the number of bytes in the file being stored, whether the FILESTREAM provider will
use SQL FILESTREAM (in-band) using TDS protocol or Win32 streaming APIs (out-of-
band) to write the BLOB to the BLOB store. The default value of 1258290 should
generally remain as the default. If write performance is less than optimal, testing file
uploads using a higher or lower value may yield improved performance. This field
coincides with the FILESTREAMMAXSIZEINBANDWRITE command line parameter.
For example:
FILESTREAMMAXSIZEINBANDWRITE=1258290
Maximum BLOB size for in-band read operations: This value will determine, based
on the number of bytes in the file being retrieved, whether the FILESTREAM provider
will use SQL FILESTREAM (in-band) using TDS protocol or Win32 streaming APIs (out-
of-band) to read the BLOB data from the BLOB store. The default value of 1258290
should generally remain as the default. If read performance is less than optimal, testing
file retrievals using a higher or lower value may yield improved performance. This field
coincides with the FILESTREAMMAXSIZEINBANDREAD command line parameter. For
example:
FILESTREAMMAXSIZEINBANDREAD=1258290
Maximum BLOB size for inline storage: This value will determine, based on the
number of bytes in the file being stored, whether the BLOB will be stored “inline” as a
varbinary(max) value in the mdf file of the FILESTREAM provider database or as a
29
SQL Server 2008 R2 Remote BLOB Storage
FILESTREAM value in the file system. The SQL FILESTREAM feature operates more
efficiently with larger files. Storing a large number of extremely small files can degrade
performance. This value ensures that a minimum file size is present before the BLOB is
written to the SQL FILESTREAM column. It is possible to ensure that ALL BLOBs are
written to SQL FILESTREAM column by setting this field to a value of zero (0). This field
coincides with the FILESTREAMMAXSIZEINLINEBLOB command line parameter. For
example:
FILESTREAMMAXSIZEINLINEBLOB=61140
Write allocation size: This value determines the initial size of the file that is created in
the NTFS file system when a new BLOB file is being created. The default value of zero
(0) should not be changed unless instructed to do so by Microsoft Support. This field
coincides with the FILESTREAMWRITEALLOCATIONSIZE command line parameter.
For example:
FILESTREAMWRITEALLOCATIONSIZE=0
The Maintainer task configuration screen facilitates the scheduling of the Maintainer in order to
ensure that garbage collection is performed. Selecting the “Schedule to run the maintainer” will
cause the installer UI to launch a scheduled task window. The installer will pre-configure some
aspects of the task including task duration and the command line parameters that are present
based on the options selected in this screen.
30
SQL Server 2008 R2 Remote BLOB Storage
Detailed information regarding the configuration options of the Maintainer application will be
defined in detail in a later section.
The Client Configuration screen allows the installer to configure the logging options for the RBS
client library. Each of the log configuration values can be expressed in a coinciding command
line parameter numeric value ranging from 1 to 7. They are:
1. No Logging
2. Critical Error
3. Error
4. Warning
5. Information
6. Developer
7. Verbose
Text File Log: This value will determine the log level of the client library text file log.
This field coincides with the TEXTFILEVALUE command line parameter. For example:
TEXTFILEVALUE=1
Console Log: This value will determine the log level when console commands invoke
the client library. This field value affects the verbosity of command results when using
the command console or PowerShell. This field coincides with the CONSOLEVALUE
command line parameter. For example:
31
SQL Server 2008 R2 Remote BLOB Storage
CONSOLEVALUE=1
Database Log: This value will determine the log level for log entries stored in the RBS
auxiliary table. This field coincides with the DBTABLEVALUE command line parameter.
For example:
DBTABLEVALUE=1
Windows Event Log: This value will determine the log level for log entries stored in the
Windows Event Log. This field coincides with the EVENTLOGVALUE command line
parameter. For example:
EVENTLOGVALUE=4
32
SQL Server 2008 R2 Remote BLOB Storage
o ServerScript: Installs the server script. This script can be executed manually at
a later time to create the RBS auxiliary resources to other content databases.
o FilestreamClient: Installs the FilestreamClient library
(Microsoft.Data.BLOBStores.FilestreamBLOBStore.dll) and deploys it to the
GAC.
o FilestreamServer: Installs the necessary scripts that construct the
FILESTREAM provider tables and resources in the content database. These
scripts can be executed manually at a later time to install the FILESTREAM
provider server resources to other content databases.
Essentially, this command does not execute any server scripts for creating a new BLOB store.
It simply deploys the necessary libraries and configuration to allow a second server that hosts
the client application to communicate with a client database that has already been RBS
enabled.
Configuring RBS
The RBS Feature Pack exposes little in the way of an administrative interface for configuring
RBS components. However, there are quite a few knobs and buttons that can be tweaked,
allowing for further control over RBS functionality.
For the FILESTREAM provider, several of the advanced configuration (see Figure 1-16) values
as well as the schema suffix value (see Figure 1-15) are stored in this field:
schema_suffix
max_size_inband_read
tran_pool_size
tran_pool_tran_lifetime
For the FILESTREAM provider, the BLOB store connection information (See Figure 1-13)
values as well as several of the advanced configuration (see Figure 1-16) values are stored in
this field:
filegroup_name
data_filegroup_name
33
SQL Server 2008 R2 Remote BLOB Storage
max_pool_size
max_size_inband_write
max_size_inline_blob
34
SQL Server 2008 R2 Remote BLOB Storage
35
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-19
Executing this uninstaller with both options checked will cause the RBS Feature Pack installer
application to execute a couple of stored procedures:
NOTE: It will not be possible to execute the rbs_sp_uninstall_rbs and rbs_fs_sp_uninstall stored
procedures if there are existing BLOBs registered in the BLOB store.
Continue with the uninstallation wizard to completely remove all RBS components from the local
server. If the FILESTREAM and RBS database configuration components have already been
removed during the uninstallation process of another server, it is not necessary to select the
removal options during subsequent uninstallations. (see Figure 1-19)
36
SQL Server 2008 R2 Remote BLOB Storage
After all RBS and FILESTREAM components have been removed, the final step is to manually
remove the FILESTREAM file group that was manually created during installation. Open a
query window in SQL Management Studio and execute the following command to completely
remove the FILESTREAM file group:
TechNet has recently provided comprehensive information for scheduling and executing the
Maintainer application in this TechNet topic. This document is not intended to replace the
TechNet guidance however there are three RBS configuration settings that have a significant
effect on Maintainer processing.
RBS is enabled and all document binary data is stored in the BLOB store.
A user deletes a document from the client application on Monday which (in this scenario)
deletes the corresponding binary data from the BLOB store.
On Tuesday, the user determines that the document must be restored.
SQL administrators work to restore the database to Monday morning, just before the
document was deleted.
In this scenario, even after the database is restored, the document can’t be retrieved because
even though the database contains a reference to the BLOB, the binary data has been
irreversibly deleted from the BLOB store. This violates link-level consistency.
In order to prevent this scenario, RBS provides a time window parameter called
garbage_collection_time_window which ensures that even after a document record has been
deleted from the client application database, the BLOB data will not be removed from the BLOB
37
SQL Server 2008 R2 Remote BLOB Storage
store until the restore SLA window has passed. When RBS is deployed to a client application
database, the administrator should set the garbage_collection_time_window value based on the
restore SLA requirement for the organization. The default garbage collection time window is 30
days. Use the following example to set the default garbage collection time window to 14 days:
However, the size of the pool also reflects the size of the work unit that Maintainer uses to
perform garbage collection phases. So a very high maximum pool size can result in the
maintainer taking a very long time to complete a work unit.
It is important to monitor the number of pools being created in the client database and also
Maintainer application performance, then adjust pool size up or down if necessary.
38
SQL Server 2008 R2 Remote BLOB Storage
is important to keep an eye on the rate that storage is being consumed. If storage is beginning
to run out, it is possible to add a new BLOB store to the client database. The new BLOB store
would be located on an additional storage volume or CAS location.
Performance Counters
After the RBS Feature Pack is installed, several counters are made available in the Remote
BLOB Storage counter category. The following performance metrics can be tracked using
Performance Monitor or other monitoring tool:
Database Resources
Each of the RBS Auxiliary tables, views, and stored procedures in the client (content) are a
member of either the Application Interface or the Administrative Interface. The Administrative
Interface consists of one table and multiple views that can be accessed (read only) and multiple
stored procedures that may be executed by administrators or custom code. The Application
Interface consists of tables, views, and stored procedures that are used by the client library and
Maintainer application for internal RBS operations. They should not be modified or directly
accessed by administrators or custom code.
Administration View
Only the rbs_log table is exposed for read only access by administrators and custom code. The
following views in the mssqlrbs schema are exposed for read only access by administrators and
custom code:
rbs_blob_details rbs_consistency_issues
rbs_blob_references rbs_counters
rbs_blob_stores rbs_dictionary
rbs_collections rbs_history
rbs_columns rbs_pools
rbs_config
The following functions and stored procedures in the mssqlrbs schema are exposed for
execution by administrators and custom code:
rbs_fn_get_rbs_state rbs_sp_modify_blob_store
rbs_sp_enable_rbs rbs_sp_delete_blob_store
39
SQL Server 2008 R2 Remote BLOB Storage
rbs_sp_uninstall_rbs rbs_sp_set_blob_store_credential
rbs_sp_set_config_value rbs_sp_get_all_blob_store_credentials
rbs_sp_delete_config_value rbs_sp_delete_blob_store_credential
rbs_sp_register_column rbs_sp_reset_counter
rbs_sp_unregister_column rbs_sp_mark_pool_as_full
rbs_sp_add_blob_store rbs_sp_register_blob
rbs_sp_add_pool rbs_sp_cleanup_unmaintained_collection *
rbs_sp_modify_collection * Being added in SQL 2008 R2 PCU1
Most of the stored procedures above will be used by utility and configuration applications during
RBS deployment. However the rbs_sp_set_config_value stored procedure and the rbs_config
view are particularly useful. Administrators can use these to fine tune the configuration of RBS.
Application View
The following tables from the mssqlrbs_resources schema are INTERNAL and should not be
accessed or modified by administrators or end users:
rbs_internal_blob_store_credentials rbs_internal_deleted_blobs
rbs_internal_blob_stores rbs_internal_dictionary
rbs_internal_blobs rbs_internal_history
rbs_internal_collections rbs_internal_indices
rbs_internal_columns rbs_internal_pools
rbs_internal_config rbs_work_blob_store_blobs
rbs_internal_consistency_issues rbs_work_units
rbs_internal_counters
The following views from the mssqlrbs_resources schema are INTERNAL and should not be
accessed or modified by administrators or end users:
rbs_all_counters rbs_work_all_blobs_used_view
rbs_all_history rbs_work_blobs_used_view
Essentially all remaining stored procedures that are not mentioned in the Administration
Interface are called by the client library, provider libraries, or the Maintainer application. They
should not be modified or executed by administrators or custom code.
40
SQL Server 2008 R2 Remote BLOB Storage
In this scenario, link level consistency is broken because the restored application database will
have a reference to the document that the user submitted during the BLOB store backup. Since
the BLOB store will not have that document, the user is unable to open the document. In this
scenario, the order of the backup and restore operations is not correct and inconsistent content
retrieval could be experienced by end users.
Prescriptive Guidance
Backup and restore operations should always be performed in this order:
Backup:
Restore:
NOTE: If LOCAL RBS FILESTREAM Provider is being used, content database backup
operations will also backup the BLOBs at the same time which simplifies the backup and restore
process.
41
SQL Server 2008 R2 Remote BLOB Storage
Once the backup and restore SLA has been determined, the Garbage Collection Time Window,
Delete Scan Period, and Orphan Scan Period should be appropriately set using the procedures
defined above. Then the Maintainer application should be scheduled to execute in harmony
with the garbage collection parameters and with respect to backup and restore processing
windows.
EBS providers do not support transaction RBS supports transactional consistency which
consistency or cancellation support. If a Write guarantees that if a link/pointer to a BLOB exists in
Once Read Many (WORM) storage device elects to the database, the BLOB will be guaranteed to exist
“VETO” a delete operation, the delete operation is in the BLOB store in a fully written/committed
not halted. The SharePoint row would be deleted state. If the BLOB store fails to write the BLOB and
and the BLOB would be orphaned. throws an exception, the entire upload operation
will fail and the record will not be written to the
client database.
There is no support for maintenance or migration The RBS Feature Pack includes the Maintainer
operations in the EBS API. Provider developers application in an effort to provide efficient and
must build tools that perform orphan cleanup and consistent lazy garbage collection capabilities that
manage the externalization of any BLOB data that independent of any RBS provider development.
exists in the content database before EBS was SharePoint provides Management Shell support for
enabled. migrating BLOB data between the BLOB store and
the content database.
EBS must be enabled at the scope of the farm RBS is enabled at the scope of the content
(SPFarm). database. So by creating site collection in different
42
SQL Server 2008 R2 Remote BLOB Storage
Support for EBS is not guaranteed past SharePoint RBS will be supported in future versions of
2010 SharePoint.
Once the RBS feature pack is installed and deployed to a given content database, PowerShell
can be used to enable an RBS provider on that database. TechNet describes PowerShell
commands that should be executed to enable an RBS provider in this topic. These PowerShell
commands are part of the SharePoint 2010 command shell. They are unique to the SharePoint
implementation of RBS. It is beyond the scope of this document to duplicate that information.
However, it is important to understand what each of the commands accomplishes.
The first statement instantiates a reference to the SPWebApplication using the root url. The
second statement stores the SPContentDatabase object reference from the SPWebApplication
in the $rbss variable.
There are other ways to acquire a reference to the SPContentDatabase object. What if the
content database contains only one site collection that is not located at the web application
root? The commands below accommodate this situation by acquiring a reference to the content
database using the url of a Site instead:
43
SQL Server 2008 R2 Remote BLOB Storage
$rbss.Installed()
This command initiates a connection to the database and then checks to see if the RBS
Auxiliary tables and resources have been deployed to the content database. If a value of TRUE
is not returned from this call, then the RBS Feature Pack Installation (server component) did not
install successfully and an RBS Provider can’t be enabled.
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
This command uses the first provider name in the GetProviderNames() method enumeration
and sets it as the active provider BLOB store name for the content database. The
GetProviderNames() method retrieves a list of BLOB store names from the RBS auxiliary tables
in the content database.
Because a content database may have more than one BLOB store, the first BLOB store in the
enumeration may not be the desired active BLOB store. In this case, use the
GetProviderNames() method of the SPRemoteBLOBStorageSetting object ($rbss variable) to
retrieve a list of all BLOB stores associated with the content database. It is then possible to set
the active provider BLOB store name manually:
$rbss.SetActiveProviderName(“FilestreamProvider_1”)
$rbss
Enabled ActiveProviderName MinimumBLOBStorageS UpgradePersistedPr
ize operties
------- ------------------ ------------------- ---------------
True FilestreamProvid... 0 {}
44
SQL Server 2008 R2 Remote BLOB Storage
This command retrieves the status of the RBS settings for the content database. If properly
installed, Enabled should be True and the proper provider name should be listed under
ActiveProviderName.
$rbss.SetActiveProviderName(“”)
WARNING! Do not use the “Disable()” method of the RemoteBlobStorageSettings object as this
will remove RBS collection information from the database. This method should ONLY be used if
RBS is being completely uninstalled.
45
SQL Server 2008 R2 Remote BLOB Storage
First, in order to avoid code access security issues, the RBS client library is deployed to the
GAC by the RBS Feature Pack installer. Any RBS provider libraries that will be used should
also be deployed to the GAC. Not only are these libraries used by SharePoint, but they are also
used by the Maintainer console application.
Second, it is important to understand how BLOB store permission requirements can affect
SharePoint. Depending on the RBS provider being used, the RBS provider library may be
invoked by SharePoint to access content directly in the BLOB store. In this case, the provider
library is invoked in the security context of the SharePoint application pool of the web
application that hosts the related content database. So this SharePoint application pool must
have full access to the BLOB store. This is particularly important for providers that use NTFS
file shares or CAS devices for the BLOB store.
46
SQL Server 2008 R2 Remote BLOB Storage
WARNING! Disabling RBS destroys RBS collection information in the content database. It
should ONLY be used when RBS and/or the FILESTREAM provider need to be UNINSTALLED
from the content database and SharePoint. Further, the Disable() method can only be called
after all content has been migrated back inline in the content database.
However, if the goal is to ensure that all future BLOBs are stored inline in the content database,
then it is not necessary or even recommended to uninstall RBS or the FILESTREAM provider.
Follow the steps listed in this TechNet topic to disable the active BLOB store.
This section covers the steps necessary for uninstalling RBS and/or the FILESTREAM provider.
WARNING! Disabling RBS destroys RBS collection information in the content database. It
should ONLY be used when RBS and/or the FILESTREAM provider need to be UNINSTALLED
from the content database and SharePoint. Further, the Disable() method can only be called
after all content has been migrated back inline in the content database.
47
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-20
Executing this uninstaller with both options checked will cause the RBS Feature Pack installer
application to execute a couple of stored procedures:
NOTE: It will not be possible to execute the rbs_sp_uninstall_rbs and rbs_fs_sp_uninstall stored
procedures if there are existing BLOBs registered in the BLOB store.
Continue with the uninstallation wizard to completely remove all RBS components from the local
server. If the FILESTREAM and RBS database configuration components have already been
removed during the uninstallation process of another server, it is not necessary to select the
removal options during subsequent WFE uninstallations. (see Figure 1-20)
After all RBS and FILESTREAM components have been removed, the final step is to manually
remove the FILESTREAM file group that was manually created during installation. Open a
48
SQL Server 2008 R2 Remote BLOB Storage
query window in SQL Management Studio and execute the following command to completely
remove the FILESTREAM file group:
With the FILESTREAM provider implemented, users experience a UI error similar to the
one below when uploading a document to site in an RBS enabled content database:
There are two possible causes to this error. Check the SharePoint ULS logs and the
Application log in the Event Viewer. The following RBS exception text may be
discovered:
49
SQL Server 2008 R2 Remote BLOB Storage
SharePoint is a prime example of a client application. The SharePoint 2010 code base has the
ability to interact with the client library in order to take advantage of the benefits of RBS.
The Maintainer application is another example application. It uses the client library to facilitate
garbage collection operations that ensure that the client database, the RBS auxiliary tables, and
the BLOB store all remain consistent.
Class Description
BlobStoreCredentials Stores the credential information that is used to access a BLOB store.
For SharePoint, the BLOB store uses the credentials of the application
pool for the web application that hosts the content database with RBS
enabled.
BlobStoreCredentialsList Stores the list of credentials used to access a BLOB store.
BlobStoreException The base class of exceptions thrown by BLOB store providers. Each
BlobStoreException object must have a valid exception code set, which
can be used by applications to handle the exception.
ConfigItem Stores a (key, value) pair that is used in RBS to pass configuration and
command options.
ConfigItemList Represents a list of configuration items. This is used by applications and
RBS client library to pass configuration and command options.
RemoteBlobClientException The exception that is thrown for an error involving RBS client library
operation. It usually indicates a runtime error and needs to be handled
by the application.
RemoteBlobConfigurationException The exception that is thrown for a configuration or installation issue.
RemoteBlobException The base class for exceptions thrown by the RBS client library.
RemoteBlobStoreException The exception that is associated with errors from the BLOB store
provider.
50
SQL Server 2008 R2 Remote BLOB Storage
RemoteBlobUsageException The exception that is thrown for errors in the database configuration or
application.
SqlRemoteBlob Represents a BLOB created using the RBS feature. This is the primary
BLOB object used for streaming BLOB data.
SqlRemoteBlobCollectionManager Represents a logical collection that contains BLOBs created using RBS
feature.
SqlRemoteBlobContext Provides database context for the BLOB. A SqlRemoteBlobContext
must be established before BLOB data can be submitted or retrieved.
Environment Configuration
Of course, before code can be executed against an RBS provider, the provider and the RBS
Feature Pack must be installed on the machine. The RBS client library uses information in the
machine.config to instantiate the RBS provider. During installation, the information necessary to
load the provider library is added to the machine.config, typically in this location:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
However, when developing with Visual Studio 2010, even on a 64-bit operating system, it is
possible that in the context of the custom client application, the client library may attempt to read
the machine.config from this location:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
Since the RBS provider information was not loaded to this machine.config, it may result in the
following error during custom client execution:
“No provider of type <Filestream> found. Check the server configuration or install
the provider on the client.”
If this happens, copy the RBS provider information from the “Framework64” machine.config to
the “Framework” machine.config. There are two sections that must be copied.
First, copy the RemoteStorage SectionGroup definition. It should be pasted into the destination
machine.config file just before the </configsections> tag. (see Figure 1-21)
51
SQL Server 2008 R2 Remote BLOB Storage
Figure 1-21
Second, copy the entire contents of the <RemoteBlobStorage> configuration section and paste
it into the destination machine.config just before the </configuration> tag. (see Figure 1-22)
Figure 1-22
52
SQL Server 2008 R2 Remote BLOB Storage
blob.WriteFromStream(inStreamObject);
blob.Commit();
53
SQL Server 2008 R2 Remote BLOB Storage
Deleting a BLOB
Deleting a BLOB is as simple as deleting the BlobId from the registered RBS column in the
application database. Deleting the entire record will also accomplish the same effect. The
actual deletion of the BLOB will take place later based on the Garbage Collection Time Window
which should be based on the backup and restore Service Level Agreement (SLA) of the
organization. This concept is known as Delete Propagation.
54
SQL Server 2008 R2 Remote BLOB Storage
BlobReference vs BlobId
When using the OpenBlob() method of the SqlRemoteBlobContext object, the client application
has the option of passing in either a BlobId or a BlobReference. A BlobReference contains all
of the information necessary for retrieving the BLOB from the BLOB store. However, if a BlobId
is passed in, an additional trip to the database is necessary to retrieve a BlobReference before
the SqlRemoteBLOB object can be constructed. Whenever possible, the client application
should provide a BlobReference as opposed to a BlobId.
The RBS auxiliary resources in the client database provide a function for converting a BlobId to
a BlobReference. Instead of this query…
Implementation Guidance
There a couple of points that should be considered when developing an RBS provider.
OptimizationSpecifiedIds
While this property is mentioned a few times in the Provider Implementation Specification, it was
not included in the released version of the client library in the RBS Feature Pack. Any
statements including a reference to OptimizationSpecifiedIds should be disregarded.
55
SQL Server 2008 R2 Remote BLOB Storage
Summary
Remote BLOB Storage is a powerful feature of SQL Server that can facilitate the separation of
BLOB data from the client application database. By using the RBS client library, client
applications can take advantage of RBS without having to worry about the code that is
necessary to access a specific BLOB store. Responsible development departments and
Independent Software Vendors (ISVs) can develop RBS provider libraries that can provide client
applications with the ability to store BLOB data in a specific BLOB store. The Maintainer
application, included in the RBS Feature Pack, is provider agnostic and provides standardized
garbage collection capabilities. Together, these RBS components combine to provide a
powerful feature set that can improve scalability, increase functionality, and reduce long term
storage costs for any client application that needs to store a high volume of file content.
Did this paper help you? Please give us your feedback. Tell us on a scale of 1 (poor) to 5
(excellent), how would you rate this paper and why have you given it this rating? For example:
Are you rating it high due to having good examples, excellent screen shots, clear writing,
or another reason?
Are you rating it low due to poor examples, fuzzy screen shots, or unclear writing?
This feedback will help us improve the quality of white papers we release.
Send feedback.
56