Freigeben über


RBS and SharePoint 2010

 Note: This Post is applicable only to SQL server 2008, 2008 R2 with SharePoint 2010 only.

The user account that you use to perform the procedures that are described in this document must have the following memberships:

1)       Administrators group on the Web servers and application servers.

2)       SQL Server dbcreator and securityadmin fixed server roles on the computer that is running SQL Server 2008.

Note: Logon to SQL and Webserver with user account of SharePoint not local admin.

  

A) Enable FILESTREAM on the database server

  1. On the Start menu, point to All Programs, point to Microsoft SQL Server 2008 R2, point to Configuration Tools, and then click SQL Server Configuration Manager.

  2. In the list of services, right-click SQL Server Services, and then click Open.

  3. In the SQL Server Configuration Manager snap-in, locate the instance of SQL Server on which you want to enable FILESTREAM.

  4. Right-click the instance and then click Properties.

  5. In the SQL Server Properties dialog box, click the FILESTREAM tab.

  6. Select the Enable FILESTREAM for Transact-SQL access check box.

  7. If you want to read and write FILESTREAM data from Windows, click Enable FILESTREAM for file I/O streaming access. Enter the name of the Windows share in the Windows Share Name box.

  8. If remote clients must access the FILESTREAM data that is stored on this share, select Allow remote clients to have streaming access to FILESTREAM data. 

  9. Click Apply. See below:

  10. In SQL Server Management Studio, click New Query to display the Query Editor.

  11. In Query Editor, enter the following Transact-SQL code:
    EXEC sp_configure filestream_access_level, 2
             RECONFIGURE

  12. Click Execute.

    Link: https://technet.microsoft.com/en-us/library/ee663474.aspx

B)       Provision a BLOB store for each content database

  1. Click Start, click All Programs, click Microsoft SQL Server 2008, and then click SQL Server Management Studio.

  2. Connect to the instance of SQL Server that hosts the content database.

  3. Expand Databases.

  4. Click the content database for which you want to create a BLOB store, and then click New Query.

  5. Paste the following SQL queries in Query pane, and then execute them in the sequence listed.

    use [WSS_Content]
    if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')create master key encryption by password = N'Admin Key Password !2#4'

    use [WSS_Content]
    if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')alter database [WSS_Content] add filegroup RBSFilestreamProvider contains filestream

    use [WSS_Content]
    alter database [WSS_Content] add file (name = RBSFilestreamFile, filename = 'C:\Blobstore') to filegroup RBSFilestreamProvider

Note: In All the three queries replace [WSS_Content] with the content database name, and replace c:\BlobStore with the volume\directory in which you want the BLOB store created. The provisioning process creates a folder in the location that you specify. Be aware that you can provision a BLOB store only one time. If you attempt to provision the same BLOB store multiple times, you will receive an error.

             Commands should be successfully completed.

Verify:
Blobstore folder would be created under the path given. There would be a folder and a file in it.

  

C) Install the RBS provider components on each server (SQL and Web Server)

Note: First install RBS on SQL server then First Web server then additional Servers.

To install RBS on SQL server and then First Web server follow the below steps.

  1. Browse to https://www.microsoft.com/download/en/details.aspx?id=16978 find rbs.msi download X64 Package.
    Note: Do not download the rbs_x64 link given in TechNet article https://technet.microsoft.com/en-us/library/ee663474.aspx

  2. Run cmd prompt as Administrator and then click OK.
    Change the directory to the place where rbs.msi is downloaded on the machine.

  3. Copy and paste the following command into the Command Prompt window.

    msiexec /qn /lvx* rbs_install_log.txt /i RBS.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="WSS_Content" DBINSTANCE="DBInstance Name" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1

    Note:
    Replace WSS_Content and DBInstance Name in the above command.

    rbs_install_log.txt is the installation log file generated in the same path where rbs.msi is located.

    Verify:
    1) The process of installation finishes in 1 min. See task manager, there would be two processes “msiexec.exe ” running with the SharePoint user account that you logged in. You can see these processes only if you enable show processes from all users.

                    

             2)  Verify if the Tables were created for the database WSS_Content. If there were no folders then the installation is not success. Verify Log file.

                      

            3)  Verify the programs installed in control panel, SQL Server 2008 R2 Remote Blob Store is installed.

                         

            4)  The size of the log file rbs_install_log.txt should be more than 1 MB. If you have less size then there should be some problem in the installation.
 

Troubleshoot in file size is less:

Open the log file scroll to the bottom you can see an entry that Installation Completed Successfully, but never trust that message. Find for errors and resolve the same.

Mostly the parameters passed in the above command should be wrong- check for db instance name, server name and especially spelling mistakes.

Note: Follow the same process and command for First Web server.

D) To install RBS on all additional Web and application servers

  1. Browse to https://www.microsoft.com/download/en/details.aspx?id=16978 find rbs.msi download X64 Package.
    Note: Do not download the rbs_x64 link given in TechNet article https://technet.microsoft.com/en-us/library/ee663474.aspx

  2. Run cmd prompt as Administrator and then click OK.
    Change the directory to the place where rbs.msi is downloaded on the machine.

  3. Copy and paste the following command into the Command Prompt window

    msiexec /qn /lvx* rbs_install_log.txt /i RBS.msi DBNAME="WSS_Content" DBINSTANCE="DBInstance Name" ADDLOCAL="Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer"

Note:
Replace WSS_Content and DBInstance Name in the above command.

rbs_install_log.txt is the installation log file generated in the same path where rbs.msi is located.

Verify:
The size of the log file rbs_install_log.txt should be less than 1 MB, vice versa for SQL and First Web Server.

Open the log file scroll to the bottom you can see an entry that Installation Completed Successfully, but never trust that message. Find for errors and resolve the same.

Mostly the parameters passed in the above command should be wrong- check for db instance name, server name and especially spelling mistakes .

 

E) Enable RBS for each Content Database from Web Server:
 
            Open SharePoint PowerShell as Administrator and perform the steps below:

$cdb = Get-SPContentDatabase –WebApplication <URL>
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])

Verify:
1. Executing $rbss.Installed() should return true, if false this may be due to the reason that RBS is not installed properly or RBS is not installed on other Web servers.
Verify RBS installation log on all the servers. If you think something is wrong uninstall RBS from control panel and re-install using step C or D.

2. Type $rbss and verify that ActiveProviderName is not Null. See below

F)       Test the RBS Installation:

  1. Open the Web Application where blob store is enabled.

  2. Open a library or list where we can upload documents.

  3. Upload a document whose size limit is more than 60 KB.

  4. Browse to Blob Store Folder on the SQL server and verify the latest modified folder. The document should be present in it.

 

              The other way of checking this is to run below query on SQL database.
              Select * from AllDocstreams where RBSID IS NOT NULL

Note: RBS_ID has some value indicates that the document is in Blob Store. If it is null then it indicates that the data was present in SQL database itself.

            

Note:
The Blob Threshold limit by default is 60 KB. This explains that only documents whose size is more than 60 KB are being moved to Blob Store.
This setting can be verified by running the below query on the content database and checking the value for the column “extended_configuration” for the record matching your Filestream provider name stored in the "blob_store_name" column.

Use [WSS_Content]
 select * from mssqlrbs_resources.rbs_internal_blob_stores

G) Adjust Blob Threshold:

            We can change the Blob Threshold limit for a content database my executing below commands as Powershell Administrator on any Web Sever .
             $cdb = Get-SPContentDatabase –WebApplication <URL>
$cdb.RemoteBlobStorageSettings.MinimumBlobStorageSize=1048576
$cdb.Update()

Note: 1048576 = 1MB, files size more than 1 MB would be moved to blob store.

 H)      Move Content In and Out of RBS:

            1)      Move Content from SQL to RBS:
                      The content database might be in use for many days and you have enabled RBS later, you want to move the content to RBS Blob Store. To achieve this execute the below commands as administrator of powershell on any Web
Server

$cdb = Get-SPContentDatabase –WebApplication <URL>
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Migrate()

Note :
1.Please note that when you run this command the server begins copying data from the database to the file system. If you've got a lot of data in the database, it may take a while.

2. The Blob Threshold apply here, all the docs whose threshold limit is more than the specified values are pushed to the Blob Store.

Verify:
Browse to Blob Store Folder on the SQL server and verify the latest modified folder, the documents should be present in it.
Execute the query select* from AllDocStreams where RBSID IS NULL it should return zero results. The data from “content” column is pushed to ”RBSID” column and the Content Column is made NULL.
 
                    

           2)       Move Content from RBS to SQL:
                     We need to disable RBS and move the content back to SQL. To achieve this execute the below commands as administrator of powershell on any Web server.

$cdb = Get-SPContentDatabase –WebApplication <URL>
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.SetActiveProviderName("")
$rbss.Migrate()

Note:
SetActiveProviderName("") disables RBS, $rbss.Migrate() migrates the content back to SQL as ActiveProviderName is Blank.

The documents were copied to SQL but they were not deleted from Blob Store, so before performing this action plans that the SQL server has more free space.

If you want to move the content to another provider execute below commands.
$rbss.SetActiveProviderName("Name of the provider")
$rbss.Migrate()

 

Verify:
Execute the query select* from AllDocStreams where RBSID IS NOT NULL it should return zero results. The data from column “RBSID” is pushed to “content” column and the RBSID column is made NULL.
   
              

To double check that this, delete any known file manually from Blob Store and try to access the same from UI.

 I) Enable RBS on another content database: You may create a new content database to the same web application and you want to enable RBS on this or you want enable RBS on another content database of a different web application. To achieve this follow the steps mentioned below:

  1. Open SQL server -> SQL Management Studio ->Databases -> Expand the content database for which you want to create a blob store -> Right Click-> New Query

  2. Execute below queries

    use [WSS_Content_NEW] if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##') create master key encryption by password = N'Admin Key Password !2#4'

    use [WSS_Content_NEW] if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider') alter database [WSS_Content_NEW] add filegroup RBSFilestreamProvider contains filestream

    use [WSS_Content_NEW] alter database [WSS_Content_NEW] add file (name = RBSFilestreamFile, filename = 'c:\RBSStore') to filegroup RBSFilestreamProvider

    Note:
    For best performance, simplified troubleshooting, and as a general best practice, recommendation is to create the RBS data store on a volume that does not contain the operating system, paging files, database data, log files, or the tempdb file.

  3. Run CMD as Administrator and navigate to the path where rbs.msi is located and execute the below command.

    msiexec /qn /i rbs.msi REMOTEBLOBENABLE=1 FILESTREAMPROVIDERENABLE=1 DBNAME=”WSS_Content_NEW” FILESTREAMSTORENAME=FilestreamProvider_1 ADDLOCAL=EnableRBS,FilestreamRunScript DBINSTANCE=”DBInstanceName”

    Note: Make sure that you use same FILESTREAMSTORENAME that you used initially to install RBS. Use this command to check the name of file stream provider “$rbss.GetProviderNames()”

  4. Login to the Webserver and run the below commands

    $cdb = Get-SPContentDatabase “WSS_Content_NEW”
    $rbss = $cdb.RemoteBlobStorageSettings
    $rbss.Installed()
    $rbss.Enable()
    $rbss.SetActiveProviderName($rbss.GetProviderNames()[0])

Verify:
1. $rbss.Installed() should return true.

2. Type $rbss and verify that ActiveProviderName is not Null. See below”

J) Uninstall RBS on a Web Server:

Note: Perform uninstall of RBS only if RBS fails during its installation.
Uninstall is achieved in 3 ways.

  1. Remove RBS from Control Panel
    Control Panel -> Add or Remove Features -> SQL Server 2008 R2 Blob Cache
        

  2. Run CMD as Administrator and navigate to the path where rbs.msi is located and execute the below command

    msiexec /qn /lvx* rbs_install_log.txt /x RBS.msi DBNAME="WSS_Content" DBINSTANCE="DBInstanceName" ADDLOCAL="Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer"

  3. Double click on RBS.msi and uninstall (not recommended)

            

  

K) Completely remove RBS on a Content database and also from server:

  1. Backup 1st: Backup site collection with stsadm, backup SQL db, backup RBS blob storage.

  2. Migrate all content off RBS to SQL and disable RBS for content db:

    On Webserver execute the below commands.

    $cdb=Get-SPContentDatabase <ContentDbName>
    $rbss=$cdb.RemoteBlobStorageSettings
    $rbss.GetProviderNames()
    $rbss.SetActiveProviderName("")
    $rbss.Migrate()
    $rbss.Disable()

Verify:
Type $rbss and you should see that Activeprovidername is NULL and Enabled is false.
 
             

 

     3.   Change the default RBS garbage collection window to 0 on your content db:

Execute the below commands in SQL server on the query editor for the content database.

                                   exec mssqlrbs.rbs_sp_set_config_value 'garbage_collection_time_window','time 00:00:00'

                                    exec mssqlrbs.rbs_sp_set_config_value 'delete_scan_period','time 00:00:00'

    4.    Change the default RBS garbage collection window to 0 on your content db:

On Sql server open CMD prompt as Administrator and navigate to the path “C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer”

            Execute the command “Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -connectionstringname RBSMaintainerConnection -operation GarbageCollection ConsistencyCheck ConsistencyCheckForStores -GarbageCollectionPhases rdo - ConsistencyCheckMode r -TimeLimit 120”

See below:
        

        5.        Uninstall RBS:

                           On the content db RUN:
exec mssqlrbs.rbs_sp_uninstall_rbs 0

Verify the below:
             Only few tables are left in the database, all other tables have been deleted.

            

                   Execute Below commands on the content database:

                   ALTER TABLE [mssqlrbs_filestream_data_1].[rbs_filestream_configuration] DROP column [filestream_value]
                  ALTER TABLE [mssqlrbs_filestream_data_1].[rbs_filestream_configuration] SET (FILESTREAM_ON = "NULL")

 Note: If you have mssqlrbs_filestream_data_2 run the below two commands as well.

                 ALTER TABLE [mssqlrbs_filestream_data_2].[rbs_filestream_configuration] DROP column [filestream_value]
                 ALTER TABLE [mssqlrbs_filestream_data_2].[rbs_filestream_configuration] SET (FILESTREAM_ON = "NULL")

  Now you can remove the file and filegroup for filestream:

                 ALTER DATABASE WSS_Content Remove file RBSFilestreamFile;
                ALTER DATABASE WSS_Content REMOVE FILEGROUP RBSFilestreamProvider;

Verify: This will remove the Blob Folder from the file system however still few tables exist as shown in the previous screen shot

Note: Perform all the above steps on other content databases if you want to remove RBS on them.

 

        6.    Perform the two steps below to completely remove RBS and file stream on SQL server.

Uninstall from add/remove SQL Remote Blob Storage from SQL and Webservers.

Disable filestream in SQL Configuration Manager for your instance (if you do not use it anywhere aside this single content db with sharepoint), run SQL reset and iis reset and test.

More Information:

1)       Site collection backup and restore and site import or export will download the file contents and upload them back to the server regardless of which RBS provider is being used. This process is known as a deep copy. However, the FILESTREAM provider is the only provider that is currently supported for SharePoint 2010 Products farm database backup and restores operations.

                 All the below scenarios works perfectly, no data loss at all.

Export / Import from RBS content db to normal content db
Export / Import from normal content db to RBS enabled content db
Export /Import from RBS enabled content db to RBS enabled content db
Backup / Restore from RBS enabled content db to Normal content db
Backup / Restore from normal content db to RBS enabled content db
Backup / Restore from RBS enabled content db to RBS enabled content db
Backup / Restore from CA
Attach / Detach Content db – After attaching using powershell Run rbss.installed() on Webserver

2)       Content stored in remote BLOB stores cannot be restored by using DPM

3)       If you plan to store BLOB data in an RBS store that differs from your SharePoint Server 2010 content databases, you must run SQL Server 2008 with SP1 and Cumulative Update 2 or SP2
Note: Make sure you use RBS.msi for SQL server 2008 R2. Do not use SQL server 2008 RBS file

Comments

  • Anonymous
    January 01, 2003
    There are issues of RBS installation with SQL server 2012 and SharePoint 2013 following this blog. Please follow this only for SQL server 2008, 2008R2 with SharePoint 2010.

  • Anonymous
    January 01, 2003
    @KShahid: That's a common error shown when RBS is not installed with proper MSI or you can try below

    - Go to Start > Programs > Microsoft SQL Server R2 > Configuration tools > SQL Server Configuration Manager
    - Locate the appropriate SQL server instance > right-click > properties
    - Click on the 'FILESTREAM' tab.
    - De-Select the option for 'Allow remote clients to have streaming access to FILESTREAM data'.
    - Re-start SQL server Instance from SQL Server Configuration Manager
    - Select the option for 'Allow remote clients to have streaming access to FILESTREAM data'

    or

    Run the following query on the SQL server against the SharePoint content DB

    Use
    SP_CONFIGURE 'filestream access level',2
    go
    reconfigure with override

    where is the content database that is configured for RBS with FILESTREAM provider enabled.


    @Grig: There shouldn't be any issue if Web application is on a different port.

    @Kumar: Its not default behavior which is shown in RBS. To isolate the issue more upload a small office file less than the threshold set on contentdb so that document lies in the database. If that also create 3 copies then something else going on the library.

  • Anonymous
    January 01, 2003
    Very well written Promod. I've a question - can you please confirm whether installation of the RBS provider is needed on the SQL instance or not (section "C" in your article)? Following Technet article is not installing RBS.msi on the SQL also my tests also show it work without directly installing in the SQL install. Can you please confirm? technet.microsoft.com/.../ee748631.aspx. Thank you in advanced for any feedback!

  • Anonymous
    January 01, 2003
    @David : Be aware that you can provision a BLOB store only one time. If you attempt to provision the same BLOB store multiple times, you will receive an error. However there are multiple ways of changing the blob store location

  1. You can move the blob store, but only while the db is detached. Here's the steps for how to do it:    msdn.microsoft.com/.../dd283097.aspx   2.You can use SQL back-up and restore    Take a FULL back up of Content Database and while restoring the same you can restore on a different location.
  • Anonymous
    January 01, 2003
    @Steve: Clustering is no big difference, it was the same installation and command that we use of Primary Node. Repeat Section C of this article for other node in the Cluster

  • Anonymous
    January 01, 2003
    @Queshon : I have not tested the scenario Queshon. Looks like on Database server we have to use "Default Instance" and on SharePoint server we have to use "SQLSRVALIAS"

  • Anonymous
    January 01, 2003
    Yasser, I have changed the RBS download link in the "D" Section. Thanks for the Info.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    July 11, 2011
    Thank you very much for this great tutorial to BLOB! You added some bonus Info, too, which gives a deeper understanding. You did a great job here P.B.!

  • Anonymous
    July 11, 2011
    Wow !!! Pramod.. !!! it nice knowledge transfer.. thanks a lot :)

  • Anonymous
    July 15, 2011
    Really Informative Pramod... Appreciate your effort..!!

  • Anonymous
    September 08, 2011
    Finally, it was installed successfully, thanks a lot Pramod Balusu for this detailed article, however, one change I have did to the steps you mentioned because when I downloaded the RBS.msi you gave in “D” section rather than the one mentioned in Microsoft TechNet article it didn’t work for me. Rather than the two links I have download RBS.msi from the following URL www.microsoft.com/.../details.aspx  although it’s for SQL Server R2 and I am NOT using SQL Server 2008 R2, but it works fine. For more detail, when I used the RBS.msi in the link you gave the $rbss.Installed() didn’t gave me “false” for the first time it gave me true, but when I tried $rbss.Enable() it gave me an error, it require me to update the schema of the database from version 10.0.0 to 10.5.0 So this is solved by RBS.msi for SQL R2 and voila, it works fine, I have tested it by upload some files and everything was fine.

  • Anonymous
    September 29, 2011
    Hello Pramod, would you please be so kind to answer the following question, if you know the answer: Which Name for the "DBInstance Name" part of the installation of RBS.msi do I have to use on each machine when I got the following build: One SharePoint Server with an SQL-Alias configured on it with cliconfg.exe to connect to the SQL-Server (example: Alias->SQLSRVALIAS, Host/Netbios Name of the SQL-Server: SQL-01) and one SQL-Server without any Alias configuration (has only the default instance of MSSQLSERVER and its Host/Netbios Name SQL-01) Do I have to use SQLSRVALIAS as the DBInstance Name on the SharePoint machine and SQL-01 as the DBInstance Name on the SQL machine, or do I have to create an Alias on the SQL-Machine with cliconfg.exe and the name SQLSRVALIAS, too? Thanks in advance

  • Anonymous
    January 20, 2012
    This is very helpful and complete article on configuring RBS.

  • Anonymous
    January 20, 2012
    once a DB is provisioned per step B, is it possible to un-provision it. I would like to change the location from the default c:blobstore to another drive.

  • Anonymous
    April 10, 2012
    Hi Pramod, that was an awesome article/instructions. Do you also have the steps required for clustering with RBS? much appreciated. thanks.

  • Anonymous
    June 25, 2012
    hi I follow the same step.. but its not working when i saw in my icontrol panel, SQL Server 2008 R2 Remote Blob Store is installed. I have sharepopint 2010 and sql server 2008. that is issue.. how can i handle.. Thnaks Pinal

  • Anonymous
    September 19, 2012
    Hi I've done the required steps described in your article, when I come to test the RBS, I can't see the files in the blob folder that I uploaded in my document library on SharePoint 2010.  Please can you let me know where I've gone wrong?  Thanks

  • Anonymous
    March 06, 2013
    Hi, I followed your steps. I have SharePoint 2013 and SQL 2012. 1 wfe and 1 app server. I don't get any errors when I install it but when I upload the document the blob store folder remains empty. I can see GUID folders created but they are empty.

  • Anonymous
    June 26, 2013
    Nice Post Having very clear explanation. I am appreciating your effort. Thanks a ton!!!!!!!!!!!!!!

  • Anonymous
    July 03, 2013
    The comment has been removed

  • Anonymous
    May 19, 2014
    Hi,
    Ive installed and configured the RBS (SharePoint 2013 - SQL Server 2012) for a different webapp than the main one (port 80, and WSS_Content), lets say: WSS_Content_4444, but it didnt work.
    $rbss.Installed() return true, the table are created but when I`ve tried to upload a file is not put it on the filesystem.
    What can be the issue?

  • Anonymous
    September 29, 2014
    Thanks Pramod for providing a nice article. I have followed the steps and configured RBS for 3 Content databases. They are working fine except that I see an issue here. We see multiple copies of same file when
    1) We update the metadata of the file.
    2) We enable Allow management of Content types on the Library settings.

    As of now, I'm seeing 3 copies of every file after I uploaded them. And this is happening only for Microsoft Office documents and not for PDF files of Images.
    May I know why it's doing this?. Is this a default behavior of RBS? Could you please help me understand if I have done anything wrong.

  • Anonymous
    October 30, 2014
    Thanks for a great article. After following your steps everything was working as it should have, even on my SharePoint development machine running Windows 7 with SharePoint Foundation 2010 and SQL server 2012. If you are using SQL Server 2012 then download the appropriate rbs.msi from here http://www.microsoft.com/en-gb/download/details.aspx?id=29065 (located under Install Instructions).

    The only issue I had was specifying the correct DBINSTANCE, I had to use server_namesql_instance_name, e.g. MY-ComputerSHAREPOINT .

    Now off to try it on a production server.

    Thanks again.

  • Anonymous
    October 09, 2015
    This is amazing explanation to the details. Thanks