Wednesday, February 09, 2011

SharePoint Remote Blob Store with FILESTREAM Provider

To provision a Remote Blob Storage with FILESTREAM Provider provided by Microsoft, you have to follow instructions in this article:

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

Things to NOTE:

1. For me, the tables with prefix mssqlrbs in the content database somehow didn’t appear by running the following command so I had to use wizard to create those tables in the content database instead of following command:

msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="<ContentDbName>" DBINSTANCE="<DBInstanceName>" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1

Where:


  • <ContentDbName> is the database name.
  • <DBInstanceName> is the SQL Server instance name.

2. To Migrate all the data from Database to newly provisioned Blob Store, just execute following cmdlets in SharePoint Powershell:



$cdb = Get-SPContentDatabase -WebApplication <http://SiteName>
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
$rbss.Migrate()


To reverse the process, execute following:



$rbss.SetActiveProviderName(“”)
$rbss.Migrate()


Upon running 1st Migrate Command, notice that in the “AllDocStreams” table in content database, the content is removed from the “Content” column and “Rbsid” is populated with IDs of content on file system. When we set the “active provider” back to none and then run the migrate command, the Rbsid column is emptied and “Content” column is populated with content.


3. FILESTREAM Provider Limitations: It doesn’t allow you to use anything other than local disk space. To use any other network storage, you have to write your own provider. Go to http://sqlrbs.codeplex.com to get a basic version of custom RBS provider.


4. The SQLRemoteBlobs.dll path should be following after the installation of RBS: C:\Windows\assembly\GAC_MSIL\Microsoft.Data.SqlRemoteBlobs\10.50.0.0__89845dcd8080cc91\Microsoft.Data.SqlRemoteBlobs.dll


5. Must read following before customizing it (Specifications):


http://msdn.microsoft.com/en-us/library/cc905212(v=SQL.100).aspx


6. Garbage Collection:


http://www.sqlskills.com/BLOGS/PAUL/post/FILESTREAM-garbage-collection.aspx


http://technet.microsoft.com/en-us/library/ff943566.aspx


C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation GarbageCollection -GarbageCollectionPhases r


With above command, the table “rbs_internal_blobs” is cleaned up. But the duplicated resources are not yet deleted from file system.

1 comment:

  1. Blocker : while executing

    $rbss.SetActiveProviderName($rbss.GetProviderNames()[0])

    I got this exception:

    Exception calling "GetProviderNames" with "0" argument(s): "SQL remote blob sto
    rage must be installed on each web front end server and on the content database
    before it may be used."
    At line:1 char:51
    + $rbss.SetActiveProviderName($rbss.GetProviderNames <<<< ()[0])
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    ReplyDelete

Feel free to give constructive feedback or let me know if it was helpful.