Wednesday, June 7, 2017

MSSQL RBS configuration on multiple Content databases on the same server




  1. First database RBS configuration on the server


Step 1 : Run the below SQL on the instance replace the DB name, server name, Blobstore path and the master key password.



USE [ContentDbName]
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 [ContentDbName]
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')
alter database [ContentDbName] add filegroup RBSFilestreamProvider contains filestream
USE [ContentDbName]
alter database [ContentDbName] add file (name = RBSFilestreamFile, filename = 'c:\BlobStorage_ContentDbName') to filegroup RBSFilestreamProvider
Step 2 : Download the RBS msi file depending on the SQL version built place the file on a directory and open the same path in the cmd console with admin privileges. Replace DB name, server name and execute the below command on cmd console with RBS msi file path.
msiexec /qn /lvx* rbs_install_log_ContentDbName.txt /i RBS.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME=ContentDbName DBINSTANCE=SQLSERVERNAME FILESTREAMGROUP=RBSFilestreamProvider
Note: wait until the msiexec completes its execution on the task scheduler and resource monitor, once its completed verify the logs for  successfully installed message and check the mssqlrbs tables created on the content database by using below script.
USE [ContentDbName]
select * from dbo.sysobjects
where name like 'rbs%'
  
      B. Multiple database configuration steps

Step 1 : Please execute the below SQL replacing the required content database name
USE WSS_CONTENT2
if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')
create master key encryption by password = N’Anything you like’
USE WSS_CONTENT2
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')
alter database WSS_CONTENT2 add filegroup RBSFilestreamProvider contains filestream
USE WSS_CONTENT2
alter database WSS_CONTENT add file (name = RBSFilestreamFile, filename = 'B:\MSSQL\Blobstore\WSS_CONTENT2) to filegroup RBSFilestreamProvider
 
Step 2 : For the second, or more content databases, again run the SQL script, changing the values of ContentDbName where present to reflect the Content Database.
Instead of the original msiexec command, run the following msiexec command on subsequent databases on the DB server :
msiexec /qn /lvx* rbs_install_log_WSS_CONTENT.txt /i RBS.msi REMOTEBLOBENABLE=1 FILESTREAMPROVIDERENABLE=1 DBNAME="WSS_CONTENT " ADDLOCAL="EnableRBS,FilestreamRunScript" DBINSTANCE=" Servername\Instancename "
On the secondary WFE, run:
msiexec /qn /lvx* rbs_install_log_ContentDbName.log /i RBS.msi DBNAME=” WSS_CONTENT_OTHERDEPTS” DBINSTANCE="Servername\Instancename" ADDLOCAL="EnableRBS,FilestreamRunScript"
Once the command is executed on the DB server wait for the msiexec to get terminated
 
Verification steps :
1. Log  file should be the message configuration completed successfully.
2. RBS table creation

Faced lots of issues during my first configuration. After running through the web for days collected the steps which worked for me.
Hope this helps!!!




1 comment: