Maintain RBS in SharePoint Server 2013

We are in the process of combining the SharePoint Server 2013 and SharePoint Server 2016 content into a single content set. We appreciate your patience while we reorganize things. See the Applies To tag at the top of each article to find out which version of SharePoint an article applies to.

Applies to: SharePoint Foundation 2010, SharePoint Server 2010

Topic Last Modified: 2016-12-16

Summary: Learn how to perform maintenance tasks that are associated with Remote BLOB Storage (RBS) in SharePoint 2013.

You perform most of the maintenance tasks associated with RBS in SharePoint 2013 by using the RBS Maintainer, which is a tool in SQL Server. The RBS Maintainer performs periodic garbage collection and other maintenance tasks for a SharePoint 2010 RBS deployment. You can schedule these tasks for each database that uses RBS by using Windows Task Scheduler or SQL Server Agent. You must provision the RBS Maintainer by using command-line parameters or through an XML file. In the case of mirrored or replicated databases, you can run the RBS Maintainer against any single instance.

Important:

The steps in this article apply to both SharePoint Foundation 2013 and SharePoint Server 2013, except for the Upgrade service application databases section, which applies only to SharePoint Server 2013.

Because SharePoint 2013 runs as websites in Internet Information Services (IIS), administrators and users depend on the accessibility features that browsers provide. SharePoint 2013 supports the accessibility features of supported browsers. For more information, see the following resources:

SharePoint 2013 automatically marks unreferenced or deleted BLOB data for removal. SharePoint 2013 counts references to BLOBs by looking at the list of BLOB IDs stored by SharePoint 2013 in its content databases at the time of removal. Any BLOB references that are present in the RBS store tables but absent in the content database are assumed to be deleted by SharePoint 2013 and will be marked for removal. BLOBs that are not present in the content database and were created before the orphan cleanup time window, described later in this article, are also assumed to be deleted by SharePoint 2013 and will be marked for removal.

Because SharePoint 2013 tabulates BLOB references from the RBS columns of the content database, every RBS column must have a valid index before it can be registered in RBS.

The SQL Server RBS Maintainer tool removes the items marked by SharePoint 2013 for removal. You should schedule the clean-up tasks to be run during off-peak hours to reduce the effect on regular database operations.

RBS garbage collection is performed in the following three steps:

Reference scan. The first step compares the contents of the RBS tables in the SharePoint 2013 content database that has RBS's own internal tables and determines which BLOBs are no longer referenced. Any unreferenced BLOBs are marked for deletion.

Delete propagation. The next step determines which BLOBs were marked for deletion for some time longer than the garbage_collection_time_window value and deletes them from the BLOB store.

Orphan cleanup. The final step determines whether any BLOBs are present in the BLOB store but absent in the RBS tables. These orphaned BLOBs are then deleted.

You can configure garbage collection by specifying the following RBS Maintainer settings and database settings:

Maintainer schedule. This setting determines how often the RBS Maintainer will be run.

Task Duration. This setting determines the maximum length that a single RBS Maintainer task can run. The default setting is two hours.

You should configure the RBS Maintainer so that its activity has minimal effect on regular activity. For information about database garbage collection settings, such as how to configure the settings, see Running RBS Maintainer.

The RBS Maintainer verifies the integrity of RBS BLOB references and corrects any errors that are found. It performs several consistency checks for the database, such as verifying that indexes exist for the RBS columns, and verifying that all BLOBs that are referenced by SharePoint 2013 exist in RBS.

The Auxiliary Table Consistency Check verifies that the RBS auxiliary tables are in a consistent state. The checks performed are the following:

Verify that each RBS table column has a valid index.

Verify that RBS table columns exist; have enabled, valid indexes; and have the correct column type.

Although you can disable the following consistency checks, we recommend that you do not disable them because they help ensure the consistency of your RBS store. By default, the following consistency checks are enabled:

Verify that all BLOBs that are referenced by SharePoint 2013 are present in the RBS tables.

Verify that no BLOBs are marked as both in use and deleted.

Any discovered problems are logged and the RBS Maintainer attempts to fix them by creating missing index entries, unregistering missing columns, or marking in-use BLOBs as not deleted.

RBS requires you to define a connection string to each database that uses RBS before you run the RBS Maintainer. This string is stored in a configuration file in the <RBS installation path>\Microsoft SQL Remote Blob Storage 10.50\Maintainer folder that is ordinarily created during installation. The RBS Maintainer can be run manually by executing the Microsoft.Data.SqlRemoteBlobs.Maintainer.exe program together with the parameters that are listed in the following table.

Parameter name

Description

Values

Required?

ConnectionStringName <string name>

The name of the connection string for the configuration file.

RBSMaintainerConnection is the default name that is created during RBS setup.

Yes

Operation <space-separated list of operations to perform>

The garbage collection operations to perform. This parameter takes one to four arguments. The ForceFinalize value cannot be used in combination with any other operation.

ConsistencyCheck

GarbageCollection

Maintenance

ConsistencyCheckForStores

ForceFinalize

Yes

GarbageCollectionPhases <phases>

The garbage collection phases to perform. This parameter is used to run or complete the garbage collection. The value must be one or more letters without spaces.

r — Reference scan.

d — Delete propagation.

o — Orphan cleanup.

Yes, if garbage collection is to be performed.

ConsistencyCheckMode <c, r, or b>

Specifies the kind of consistency check to be performed.

c — Only a check will be performed.

r — A check will be performed and any issues found will be repaired.

b — A check, repair, and rebuild of the internal data structures.

Yes, if a consistency check is to be performed.

ConsistencyCheckExtent <m or c>

Specifies the extent of the consistency check.

m — Only metadata will be checked; individual BLOBs will remain unchecked. This is the default parameter.

c — A complete check will be performed.

If not specified, m is assumed.

ConsistencyCheckForStores <space-separated list of BLOB store names>

Lists the names of the BLOB stores that will be checked for consistency.

By default, all BLOB stores are checked.

No

TimeLimit <time in minutes>

Specifies the time that is available for the RBS Maintainer to perform its tasks. The argument must be a positive integer.

No

You must schedule a separate RBS Maintainer task for every database that uses RBS. The following steps describe how to schedule an RBS Maintainer task.

To schedule an RBS Maintainer task

Verify that you have Write permissions for the folder where you installed RBS.

Add a connection string to the <RBS installation directory>\Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config file for the RBS Maintainer task that is to be performed. The RBS installer creates one connection string that is named RBSMaintainerConnection by using the connection information that was provided during setup. However, new connection strings must be added for every additional database.

If you are using Windows authentication, the connection string does not have to be encrypted. You can add the unencrypted connection string by running the following command:

If you are using SQL authentication, the RBS Maintainer connection strings must be in an encrypted format. Therefore, to add connection strings, either the new strings must be encrypted or all the connection strings must be decrypted. Encrypted strings must be added one at a time. However all the connection strings can be decrypted at the same time by using the %windir%\Microsoft.net\Framework\<version>\Aspnet_regiis.exe tool, which is distributed as a part of the Microsoft .NET Framework.

Run the following commands to decrypt the connection strings and store the results in a Web.config file:

Create a Windows scheduler task to run the RBS Maintainer task for each applicable database. If you ran the RBS installer in GUI mode, it automatically created a Windows scheduler task. However, if you ran the RBS installer in command-line mode, you must follow these steps every time that you schedule a task to run the RBS Maintainer:

On the Start menu, click Administrative Tools, and then click Task Scheduler.

On the Action menu, click Create Task.

On the Actions tab, click New.

In the New Action dialog box, in the Action drop-down list, select Start a program.

Under Settings, in the Program/script box, browse to the Maintainer binary file <RBS installation directory>\Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe, and in the Add arguments (optional) text box, add any optional arguments. The following default values are created by the installer: <-ConnectionStringName RBSMaintainerConnection><-Operation GarbageCollection ConsistencyCheck ConsistencyCheckForStores><-GarbageCollectionPhases rdo><-ConsistencyCheckMode r><-TimeLimit 120>

Click OK.

On the Triggers tab, click New.

In the New Trigger dialog box, schedule the task, and then click OK. We recommend that you schedule the task to run during low system activity times.

On the General tab, under Security, make sure that the user account has the appropriate permissions to run the task. You can change permissions by clicking Change User or Group.

On the General tab, click Run whether user is logged on or not, and then click OK.