<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SQL Remote Blob Storage Team Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sqlrbs/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sqlrbs/feed.xml</link>
    <description>Remote Blob Storage (RBS) is a library API set that is designed to move storage of large binary data (BLOBs) from Microsoft SQL Server to external storage solutions.</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:28:56 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SQL Server Remote Blob Storage (RBS) Credential Store Symmetric Key Rotation</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/sql-server-remote-blob-storage-rbs-credential-store-symmetric-key-rotation</link>
      <pubDate>Tue, 23 Feb 2016 12:28:53 GMT</pubDate>
      <dc:creator><![CDATA[vpurohit]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2016/02/23/sql-server-remote-blob-storage-rbs-credential-store-symmetric-key-rotation/</guid>
      <description><![CDATA[The SQL Server team would like to advise RBS admins on security procedures for rotating the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Segoe UI;">The SQL Server team would like to advise RBS admins on security procedures for rotating the credential store symmetric key.&nbsp; If a provider requires the setup and use of a secret stored within the credential store (see related article), RBS uses this symmetric key to encrypt any provider secrets which a client may request to gain authorization to the provider&rsquo;s blob store.&nbsp; Currently there are a couple of security challenges: 1) RBS 2014 and prior versions use a credential store which holds secrets encrypted using the TRIPLE_DES symmetric key algorithm which is outdated and not as strong as it should be and&nbsp; 2) There is no recommended way to rotate this symmetric key.&nbsp; It is highly recommended that if you are currently using TRIPLE_DES then you should follow steps in this article to strengthen your key.&nbsp; One may also want to rotate this key if there are security policies in place to periodically rotate keys or if the policy requires certain encryption strength properties (e.g., algorithm or key length) with which the current symmetric key does not adhere.</span></p>
<p><span style="font-family: Segoe UI;">Note that RBS2016 will no longer use a credential store symmetric key that uses the TRIPLE_DES option.&nbsp; It will instead use AES_128 which addresses the first issue in the paragraph above.&nbsp; It's also worth noting that SQL Server 2016 will not even allow you&nbsp; to create a TRIPLE_DES symmetric key when using compatibility mode 130.</span></p>
<p><span style="font-family: Segoe UI;">One can determine the RBS credential store symmetric key properties by issuing the following T-SQL query on the RBS database:</span></p>
<p style="margin: 0in 0in 0pt;">&nbsp;</p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SELECT </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM </span></span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">symmetric_keys </span></span><span><span style="color: #0000ff;">WHERE</span></span></span><span><span style="font-size: 9.5pt;"> name <span><span style="color: #808080;">= </span></span><span><span style="color: #ff0000;">'mssqlrbs_encryption_skey'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p>&nbsp;&nbsp;</p>
<p><span style="font-family: Segoe UI;">If the output from the above statement shows that TRIPLE_DES is still used, then it is advised to rotate this key.</span></p>
<p><span style="font-family: Segoe UI;">To rotate the RBS credential store symmetric key, one may use the attached script on the RBS database.&nbsp; Do backup your database prior to key rotation.&nbsp; At the script&rsquo;s conclusion, it has some verification steps.</span></p>
<p><span style="font-family: Segoe UI;">If security policies require different key properties (e.g., algorithm or key length) from the ones provided, then the script may be used as a template for modification at one&rsquo;s own risk.&nbsp; One would need to simply change the key properties in two places: 1) the creation of the temporary key 2) the creation of the permanent key.</span></p>
<p><span style="font-family: Segoe UI;">The RBS credential store symmetric key rotation script is as follows:</span></p>
<p>&nbsp;&nbsp;</p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">IF </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">EXISTS (</span></span><span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM </span></span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">procedures </span></span><span><span style="color: #0000ff;">WHERE</span></span></span><span><span style="font-size: 9.5pt;"> name <span><span style="color: #808080;">= </span></span><span><span style="color: #ff0000;">'sp_rotate_rbs_symmetric_credential_key'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">)</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">DROP PROC</span></span> sp_rotate_rbs_symmetric_credential_key</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">END</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* This stored procedure will replace the currently used RBS credential store </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">symmetric key with one of your choosing.&nbsp; One may want to do this if there is</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">a security policy requiring periodic key rotation or if there are specific</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">algorithm requirements, for example.&nbsp; In this stored procedure, a symmetric</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">key using AES_256 will replace the current one.&nbsp; As a result of the symmetric </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">key replacement, secrets need to be re-encrypted with the new key.&nbsp; This stored</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">procedure will also re-encrypt the secrets.&nbsp; The database should be backed up </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">prior to key rotation. */</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CREATE PROC</span></span></span><span><span style="font-size: 9.5pt;"> sp_rotate_rbs_symmetric_credential_key</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">AS</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">BEGIN TRANSACTION</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN TRY</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CLOSE </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">ALL </span></span><span><span style="color: #0000ff;">SYMMETRIC</span></span></span><span><span style="font-size: 9.5pt;"> KEYS</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Prove that all secrets can be re-encrypted, by creating a </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">temporary key (#mssqlrbs_encryption_skey) and create a </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">temp table (#myTable) to hold the re-encrypted secrets.&nbsp; </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">Check to see if all re-encryption worked before moving on.*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CREATE TABLE</span></span></span><span><span style="font-size: 9.5pt;"> #myTable<span><span style="color: #808080;">(</span></span>sql_user_sid <span><span style="color: #0000ff;">VARBINARY</span></span><span><span style="color: #808080;">(</span></span>85</span><span><span style="color: #808080; font-size: 9.5pt;">) NOT NULL,</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; blob_store_id <span><span style="color: #0000ff;">SMALLINT </span></span></span><span><span style="color: #808080; font-size: 9.5pt;">NOT NULL,</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; credential_name <span><span style="color: #0000ff;">NVARCHAR</span></span><span><span style="color: #808080;">(</span></span>256<span><span style="color: #808080;">) </span></span><span><span style="color: #ff00ff;">COLLATE</span></span> Latin1_General_BIN2 </span><span><span style="color: #808080; font-size: 9.5pt;">NOT NULL,</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; old_secret <span><span style="color: #0000ff;">VARBINARY</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">MAX</span></span><span><span style="color: #808080;">), </span></span></span><span><span style="color: #008000; font-size: 9.5pt;">-- holds secrets while existing symmetric key is deleted</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; credential_secret <span><span style="color: #0000ff;">VARBINARY</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">MAX</span></span><span><span style="color: #808080;">)); </span></span></span><span><span style="color: #008000; font-size: 9.5pt;">-- holds secrets with the new permanent symmetric key</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Create a new temporary symmetric key with which the credential store secrets </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">can be re-encrypted. These will be used once the existing symmetric key is deleted.*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CREATE SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> #mssqlrbs_encryption_skey&nbsp; </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">WITH ALGORITHM </span></span><span><span style="color: #808080;">= </span></span></span><span><span style="color: #0000ff; font-size: 9.5pt;">AES_256 ENCRYPTION BY </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">CERTIFICATE</span></span> [cert_mssqlrbs_encryption]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">OPEN SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> #mssqlrbs_encryption_skey&nbsp; </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">DECRYPTION BY CERTIFICATE</span></span> [cert_mssqlrbs_encryption]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">INSERT INTO</span></span></span><span><span style="font-size: 9.5pt;"> #myTable </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">SELECT</span></span> cred_store<span><span style="color: #808080;">.</span></span>sql_user_sid<span><span style="color: #808080;">,</span></span> cred_store<span><span style="color: #808080;">.</span></span>blob_store_id<span><span style="color: #808080;">,</span></span> cred_store<span><span style="color: #808080;">.</span></span>credential_name</span><span><span style="color: #808080; font-size: 9.5pt;">, </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #ff00ff;">encryptbykey</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">(</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #ff00ff;">key_guid</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'#mssqlrbs_encryption_skey'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">), </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #ff00ff;">decryptbykeyautocert</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">cert_id</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'cert_mssqlrbs_encryption'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">), </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #808080;">NULL,</span></span> cred_store<span><span style="color: #808080;">.</span></span>credential_secret</span><span><span style="color: #808080; font-size: 9.5pt;">)</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span><span style="color: #808080; font-size: 9.5pt;">), </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span><span style="color: #808080; font-size: 9.5pt;">NULL</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">FROM</span></span> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials] <span><span style="color: #0000ff;">AS</span></span> cred_store</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">IF</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">( EXISTS(</span></span><span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> #myTable <span><span style="color: #0000ff;">WHERE</span></span> old_secret </span><span><span style="color: #808080; font-size: 9.5pt;">IS NULL))</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">PRINT </span></span><span><span style="color: #ff0000;">'Abort. Failed to read some values'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM</span></span> #myTable</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">ROLLBACK</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">END</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">ELSE</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Re-encryption worked, so go ahead and drop the existing RBS credential store </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">symmetric key and replace it with a new symmetric key.*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DROP SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_encryption_skey]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CREATE SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_encryption_skey] </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">WITH ALGORITHM </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">= </span></span></span><span><span style="color: #0000ff; font-size: 9.5pt;">AES_256 </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">ENCRYPTION BY CERTIFICATE</span></span></span><span><span style="font-size: 9.5pt;"> [cert_mssqlrbs_encryption]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">OPEN SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_encryption_skey] </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECRYPTION BY CERTIFICATE</span></span></span><span><span style="font-size: 9.5pt;"> [cert_mssqlrbs_encryption]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/*Re-encrypt using the new permanent symmetric key.&nbsp; </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">Verify if encryption provided a result*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #ff00ff;"><span style="font-size: 9.5pt;">UPDATE</span></span></span><span><span style="font-size: 9.5pt;"> #myTable </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SET</span></span></span><span><span style="font-size: 9.5pt;"> [credential_secret] </span><span><span style="color: #808080; font-size: 9.5pt;">= </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #ff00ff;">encryptbykey</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">key_guid</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'mssqlrbs_encryption_skey'</span></span><span><span style="color: #808080;">), </span></span><span><span style="color: #ff00ff;">decryptbykey</span></span><span><span style="color: #808080;">(</span></span>old_secret</span><span><span style="color: #808080; font-size: 9.5pt;">))</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">IF</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">( EXISTS(</span></span><span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> #myTable <span><span style="color: #0000ff;">WHERE</span></span> credential_secret </span><span><span style="color: #808080; font-size: 9.5pt;">IS NULL))</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">PRINT </span></span></span><span><span style="color: #ff0000; font-size: 9.5pt;">'Aborted. Failed to re-encrypt some values'</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM</span></span> #myTable</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span><span style="color: #0000ff; font-size: 9.5pt;">ROLLBACK</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">END</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">ELSE</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Replace the actual RBS credential store secrets with the newly </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #008000;"><span style="font-size: 9.5pt;">encrypted secrets stored in the temp table #myTable.*/</span></span></span><span><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SET NOCOUNT ON</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECLARE</span></span></span><span><span style="font-size: 9.5pt;"> @sql_user_sid <span><span style="color: #0000ff;">varbinary</span></span><span><span style="color: #808080;">(</span></span>85</span><span><span style="color: #808080; font-size: 9.5pt;">);</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECLARE</span></span></span><span><span style="font-size: 9.5pt;"> @blob_store_id <span><span style="color: #0000ff;">smallint</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECLARE</span></span></span><span><span style="font-size: 9.5pt;"> @credential_name <span><span style="color: #0000ff;">varchar</span></span><span><span style="color: #808080;">(</span></span>256</span><span><span style="color: #808080; font-size: 9.5pt;">);</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECLARE</span></span></span><span><span style="font-size: 9.5pt;"> @credential_secret <span><span style="color: #0000ff;">varbinary</span></span><span><span style="color: #808080;">(</span></span>256</span><span><span style="color: #808080; font-size: 9.5pt;">);</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DECLARE</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue </span><span><span style="color: #0000ff; font-size: 9.5pt;">CURSOR </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">FOR SELECT</span></span> sql_user_sid<span><span style="color: #808080;">,</span></span> blob_store_id<span><span style="color: #808080;">,</span></span> credential_name<span><span style="color: #808080;">,</span></span> credential_secret </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> #myTable <span><span style="color: #0000ff;">ORDER BY</span></span> sql_user_sid<span><span style="color: #808080;">,</span></span> blob_store_id<span><span style="color: #808080;">,</span></span> credential_name</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">OPEN</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">FETCH NEXT FROM</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">INTO</span></span> @sql_user_sid<span><span style="color: #808080;">,</span></span> @blob_store_id<span><span style="color: #808080;">,</span></span> @credential_name<span><span style="color: #808080;">,</span></span> @credential_secret</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">WHILE </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #ff00ff;">@@FETCH_STATUS </span></span><span><span style="color: #808080;">=</span></span></span><span><span style="font-size: 9.5pt;"> 0</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #ff00ff;">UPDATE</span></span> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials] </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">SET</span></span> [credential_secret] <span><span style="color: #808080;">=</span></span> @credential_secret </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">FROM</span></span> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials] </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">WHERE</span></span> sql_user_sid <span><span style="color: #808080;">=</span></span> @sql_user_sid <span><span style="color: #808080;">AND</span></span> blob_store_id <span><span style="color: #808080;">=</span></span> @blob_store_id </span><span><span style="color: #808080; font-size: 9.5pt;">AND </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; credential_name <span><span style="color: #808080;">=</span></span> @credential_name</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">FETCH NEXT FROM</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">INTO</span></span> @sql_user_sid<span><span style="color: #808080;">,</span></span> @blob_store_id<span><span style="color: #808080;">,</span></span> @credential_name<span><span style="color: #808080;">,</span></span> @credential_secret</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">END</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CLOSE</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DEALLOCATE</span></span></span><span><span style="font-size: 9.5pt;"> curSecretValue</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DROP TABLE</span></span></span><span><span style="font-size: 9.5pt;"> #myTable</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">CLOSE </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">ALL </span></span><span><span style="color: #0000ff;">SYMMETRIC</span></span></span><span><span style="font-size: 9.5pt;"> KEYS</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">DROP SYMMETRIC KEY</span></span></span><span><span style="font-size: 9.5pt;"> #mssqlrbs_encryption_skey</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Verify that you can decrypt all encrypted credential store entries using the certificate.*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">IF</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">( EXISTS(</span></span><span><span style="color: #0000ff;">SELECT </span></span><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials] </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">WHERE </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #ff00ff;">decryptbykeyautocert</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">cert_id</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'cert_mssqlrbs_encryption'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">), </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #808080;">NULL,</span></span> credential_secret</span><span><span style="color: #808080; font-size: 9.5pt;">) IS NULL))</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">print </span></span></span><span><span style="color: #ff0000; font-size: 9.5pt;">'Aborted. Failed to verify key rotation'</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">ROLLBACK</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">END</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">ELSE</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">COMMIT</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">END</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">END</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">END TRY</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">BEGIN CATCH</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp; <span><span style="color: #0000ff;">PRINT </span></span><span><span style="color: #ff0000;">'Exception caught: ' </span></span><span><span style="color: #808080;">+ </span></span><span><span style="color: #ff00ff;">cast</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">ERROR_NUMBER</span></span><span><span style="color: #808080;">() </span></span><span><span style="color: #0000ff;">as nvarchar</span></span><span><span style="color: #808080;">) + </span></span><span><span style="color: #ff0000;">' ' </span></span><span><span style="color: #808080;">+ </span></span><span><span style="color: #ff00ff;">ERROR_MESSAGE</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">();</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span><span><span style="color: #0000ff; font-size: 9.5pt;">ROLLBACK</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">END CATCH</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">END</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #0000ff; font-size: 9.5pt;">GO</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* Rotate the RBS credential store symmetric key, and notice that the secrets </span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">remain the same despite the key rotation. */</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SELECT </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">*, </span></span><span><span style="color: #ff00ff;">decryptbykeyautocert</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">cert_id</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'cert_mssqlrbs_encryption'</span></span><span><span style="color: #808080;">), NULL,</span></span></span><span><span style="font-size: 9.5pt;"> credential_secret</span><span><span style="color: #808080; font-size: 9.5pt;">) </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">EXEC</span></span></span><span><span style="font-size: 9.5pt;"> sp_rotate_rbs_symmetric_credential_key</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SELECT </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">*, </span></span><span><span style="color: #ff00ff;">decryptbykeyautocert</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff00ff;">cert_id</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #ff0000;">'cert_mssqlrbs_encryption'</span></span><span><span style="color: #808080;">), NULL,</span></span></span><span><span style="font-size: 9.5pt;"> credential_secret</span><span><span style="color: #808080; font-size: 9.5pt;">) </span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">FROM</span></span></span><span><span style="font-size: 9.5pt;"> [mssqlrbs_resources]<span><span style="color: #808080;">.</span></span>[rbs_internal_blob_store_credentials]</span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span><span style="font-family: Consolas;"><span style="color: #008000; font-size: 9.5pt;">/* See that the RBS credential store symmetric key properties reflect the new changes*/</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">SELECT </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #808080;">* </span></span><span><span style="color: #0000ff;">FROM </span></span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">symmetric_keys </span></span><span><span style="color: #0000ff;">WHERE</span></span></span><span><span style="font-size: 9.5pt;"> name <span><span style="color: #808080;">= </span></span><span><span style="color: #ff0000;">'mssqlrbs_encryption_skey'</span></span></span><span><span style="color: #808080; font-size: 9.5pt;">;</span></span></span></span></p>
<p style="margin: 0in 0in 0pt;">&nbsp;</p>
<p><span style="font-family: Segoe UI;">Related Articles: </span><a href="https://blogs.msdn.com/b/sqlrbs/archive/2010/08/05/rbs-security-model.aspx"><span style="font-family: Segoe UI;">https://blogs.msdn.com/b/sqlrbs/archive/2010/08/05/rbs-security-model.aspx</span></a></p>
<p><span style="font-family: Segoe UI;">RBS 2016 Documentation: </span><a href="https://msdn.microsoft.com/en-us/library/gg638709.aspx"><span style="font-family: Segoe UI;">https://msdn.microsoft.com/en-us/library/gg638709.aspx</span></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Fixing RBS/Provider version mismatch issues</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/fixing-rbsprovider-version-mismatch-issues</link>
      <pubDate>Thu, 23 Sep 2010 16:10:00 GMT</pubDate>
      <dc:creator><![CDATA[vpurohit]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2010/09/23/fixing-rbsprovider-version-mismatch-issues/</guid>
      <description><![CDATA[The 
problem
Release of a new RBS library will cause the 
providers developed with older...]]></description>
      <content:encoded><![CDATA[<p><base href="https://blogs.msdn.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;WeblogID=10819&amp;WeblogPostID=10067068" /></base />
<link rel="stylesheet" href="https://blogs.msdn.com/tiny_mce/themes/advanced/skins/default/content.css" />
<link rel="stylesheet" href="https://blogs.msdn.com/tiny_mce/plugins/spellchecker/css/content.css" />
</p>
<p class="MsoNormal"><b><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1;"><span style="font-family: verdana,geneva;">The 
problem</span></span></b></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">Release of a new RBS library will cause the 
providers developed with older version to not work due to version 
mismatch.</span></span></p>
<p class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><br /><span style="font-family: verdana,geneva;"></span></span></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight: normal;"><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1;"><span style="font-family: verdana,geneva;"></span></span></b></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight: normal;"><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1;"><span style="font-family: verdana,geneva;">The 
symptoms<o:p></o:p></span></span></b></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">Let&rsquo;s take an example of SharePoint to 
understand where and how the problem might appear. On a running SharePoint 
instance with the RBS client and RBS providers installed, after an upgrade of 
the RBS client (being used by SharePoint), an error is thrown as below (assuming 
the provider is a Filestream provider):<!--:o:p--></!--:o:p--></span></span></p>
<p class="MsoNormal"><span style="color: #ee2610;"><i style="mso-bidi-font-style: normal;"><span style="font-size: 9pt;"><span style="font-family: verdana,geneva;">Microsoft.Data.SqlRemoteBlobs.RemoteBlobConfigurationException: 
No provider of type &lt;Filestream&gt; found. Check the server configuration or 
install the provider on the client.<!--:o:p--></!--:o:p--></span></span></i></span></p>
<p style="text-align: justify;" class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black;"><span style="font-family: verdana,geneva;"><span style="line-height: 115%; color: black;">One 
scenario where this can happen is </span><span style="line-height: 115%; color: black;">when 
an existing setup on a machine has SharePoint front-end, RBS client (v10.5) and 
some provider (compiled using RBS client v10.5). Now, upon release of a new RBS 
client (v11), SharePoint is developed/compiled on a separate machine and simply 
deployed on this one. Thus it only copies the latest RBS client library along 
with SharePoint front-end but RBS client is not completely installed on this 
machine. So even though SharePoint can find the newer version of RBS client, 
this new RBS client will not be able to use the Provider. </span><span style="line-height: 115%; color: black;">If 
RBS is explicitly installed on the machine where the application (e.g. 
SharePoint) is used, then the installer will install appropriate files in .NET&rsquo;s 
Global Assembly Cache (<a href="https://www.codeproject.com/KB/dotnet/demystifygac.aspx"><span style="color: blue;">GAC</span></a>) to 
make things work seamlessly.</span></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black; mso-fareast-font-family: 'Times New Roman';"><span style="font-size: x-small;"><span style="font-family: arial,helvetica,sans-serif;"><span style="line-height: 115%; font-family: 'Arial','sans-serif'; color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"></span></span></span></span><span style="font-family: verdana,geneva;">&nbsp;</span></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight: normal;"><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;"><span style="font-family: verdana,geneva;">Why 
does it happen?<o:p></o:p></span></span></b></p>
<p style="text-align: justify;" class="MsoNormal"><span style="color: black;"><span style="font-family: verdana,geneva;">CLR 
uses strong names for libraries and classes (more details 
</span></span><a href="https://msdn.microsoft.com/en-us/library/wd40t7ad.aspx"><span style="font-family: 'Arial','sans-serif';"><span style="color: #0000ff;"><span style="font-family: verdana,geneva;"><span style="font-family: verdana,geneva;">here</span></span></span></span></a><span style="color: black;"><span style="font-family: verdana,geneva;"><span style="font-family: verdana,geneva;">). 
This strong name includes the version of the class/DLL, among other things. All 
classes in a specific DLL have the same version number as that of the DLL. Hence 
the Abstract Class (BlobStore), which providers need to implement, also has the 
version of RBS dll. And this is where the issues are. 
<!--::o:p--></!--::o:p--></span></span></span></p>
<p style="text-align: justify;" class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="font-family: verdana,geneva;">For 
RBS v10.5, this abstract class is also v10.5 and any existing provider would 
have extended this. Now, if the app starts using a newer version of RBS without 
installing it on the app machine (or recompiling the provider with newer version 
of RBS, thus marking the provider as sub-class of abstract class BlobStore 
v11.0), the RBS client will not be able to use the older provider (as CLR is 
trying to load provider v10.5 for RS v11) even though nothing has changed except 
the version number. This is because the RBS client doesn't identify provider as 
a subclass of BlobStore v11.0. <!--::o:p--></!--::o:p--></span></span></span></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight: normal;"><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;"><span style="font-family: verdana,geneva;"></span></span></b></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;">&nbsp;</span></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight: normal;"><span style="color: #4f81bd; font-size: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial; mso-themecolor: accent1; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;"><span style="font-family: verdana,geneva;">How 
to fix it?<o:p></o:p></span></span></b></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;"><span style="color: black;">There are a couple of ways this issue can be 
fixed without installing RBS completely on the application machine. Users can 
either compile the provider with new RBS version or install a couple of Policy 
files to Global Assembly Cache (GAC) on the 
system.<!--::o:p--></!--::o:p--></span></span></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;"><span style="color: black;">In this post, I&rsquo;ll only focus on using the 
policy files for GAC. Please read </span><a href="https://support.microsoft.com/kb/891030"><span style="color: #0000ff;">this</span></a><span style="color: black;"> 
</span>and <a href="https://msdn.microsoft.com/en-us/library/dz32563a.aspx"><span style="color: #0000ff;">this</span></a><span style="color: black;"> 
</span><span style="color: black;">before 
continuing. The link has more details about using policy files.</span><span style="color: black;"> 
</span><span style="color: black;">I'd like 
to emphasize here that the most robust way is to install the new version of RBS 
on the application client machine. Following fix should only be used if this is 
not possible.<!--::o:p--></!--::o:p--></span></span></p>
<div style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-bottom: 1pt; padding-left: 0in; padding-right: 0in; border-top: medium none; border-right: medium none; padding-top: 0in; mso-element: para-border-div; mso-border-bottom-alt: solid windowtext .75pt;">
<p class="MsoNormal"><span style="color: black;"><span style="font-family: verdana,geneva;">Below is the publisher policy file that you need 
to use:<!--::o:p--></!--::o:p--></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><o:p><span style="font-family: verdana,geneva;">&nbsp;</span></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">&lt;?xml version="1.0" 
encoding="UTF-16"?&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">&lt;configuration&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp; 
</span>&lt;runtime&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; 
</span>&lt;assemblyBinding 
xmlns="urn:schemas-microsoft-com:asm.v1"&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</span>&lt;dependentAssembly&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</span>&lt;assemblyIdentity publicKeyToken="89845dcd8080cc91" 
name="Microsoft.Data.SqlRemoteBlobs" 
culture="neutral"&gt;&lt;/assemblyIdentity&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</span>&lt;bindingRedirect oldVersion="10.5.0.0" 
newVersion="11.0.0.0"&gt;&lt;/bindingRedirect&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</span>&lt;/dependentAssembly&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; 
</span>&lt;/assemblyBinding&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"><span style="mso-spacerun: yes;">&nbsp; 
</span>&lt;/runtime&gt;<o:p></o:p></span></span></p>
<div style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-bottom: 1pt; padding-left: 0in; padding-right: 0in; border-top: medium none; border-right: medium none; padding-top: 0in; mso-element: para-border-div; mso-border-bottom-alt: solid windowtext .75pt;">
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">&lt;/configuration&gt;<o:p></o:p></span></span></p>
</div>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;"></span></span></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;">&nbsp;</span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">Please save this in an xml file. The file need 
to have a specific name <b style="mso-bidi-font-weight: normal;"><span style="background: yellow; mso-highlight: yellow;">Policy.10.5.Microsoft.Data.SqlRemoteBlobs.config</span><!--::o:p--></!--::o:p--></b></span></span></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;"><span style="color: black; mso-fareast-font-family: 'Times New Roman';">Now, 
u<span style="mso-bidi-font-weight: bold;">se Assembly Linker (Al.exe) to create 
the publisher policy assembly.</span></span><span style="color: black;"> 
</span><span style="color: black; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold;">The 
Assembly Linker is included with the .NET Framework SDK. To create the publisher 
policy assembly that redirects a binding from version 10.0 of 
Microsoft.Data.SqlRemoteBlobs.dll to version 11.0 using a publisher policy file 
named as above, run the following command:<!--::o:p--></!--::o:p--></span></span></p>
<p class="MsoNormal"><span style="color: #0082a3;"><i style="mso-bidi-font-style: normal;"><span style="font-size: 9pt;"><span style="font-family: verdana,geneva;"><span style="color: #00485b;">al.exe 
/link:Policy.10.5.Microsoft.Data.SqlRemoteBlobs.config 
/out:Policy.10.5.Microsoft.Data.SqlRemoteBlobs.dll</span><!--::o:p--></!--::o:p--></span></span></i></span></p>
<p class="MsoNormal"><span style="color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: verdana,geneva;">This should create the publisher policy 
assembly. Copy this file to <b style="mso-bidi-font-weight: normal;"><i style="mso-bidi-font-style: normal;"><span style="background: aqua; mso-highlight: aqua;">C:\Windows\Assembly</span></i>.</b> 
It should install the policy file to GAC. Now, the app should be able to find 
and use the appropriate provider.<!--::o:p--></!--::o:p--></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><o:p><span style="font-family: verdana,geneva;"></span></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"><o:p><span style="font-family: verdana,geneva;"></span></o:p></span></p>
<p class="MsoNormal"><span style="font-family: verdana,geneva;">&nbsp;</span></p>
<p>
<script type="text/javascript"><!--
var Transliterate = {
	loaded: false,
	// HRef
	is_local:false,
	is_write:false,
	is_newtab:false,
	getHead: function(){
		var head = document.getElementsByTagName('head')[0];
		if (!head) {
			return document.body;
		}
		return head;
	},
	addGlobalStyle: function(css) {
		var head = Transliterate.getHead();
		var style = document.createElement('style');
		style.type = 'text/css';
		style.innerHTML = css;
		head.appendChild(style);
	},

	addScript: function(scriptSrc, callback){
		var head = Transliterate.getHead();
		var script = document.createElement('script');
		script.language = "JavaScript";
		script.src = scriptSrc;
		script.type = 'text/javascript';
		if(callback){
			script.onload = function(){
								callback();
								script.onload = null;
							};
		}
		head.appendChild(script);
	},

	addStyles: function(){
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menu {position: absolute;background-color: #EFEFEF;border: 1px outset #7F7F7F;cursor: default;font: small arial, helvetica, sans-serif;margin: 0px;padding: 0px;outline: none;z-index: 20000;}');
		//Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {background-color: #C3D9FF;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem {position: relative;padding: 1px 1em;margin: 0px;list-style: none;}');
		Transliterate.addGlobalStyle('.fnts, .combo119922{font-family:arial,sans-serif;font-size:10px !important;}.lab{cursor: pointer;}');
		//Transliterate.addGlobalStyle('.cbut{background: #C3D9FF;border: 1px solid #5F9DFF;}');
		// HRef
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {font-size: 14px;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.opt0, .opt1{font-size: 14px;font-weight:normal;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		Transliterate.addGlobalStyle('.opt0:hover, .opt1:hover{background:#FF6D00;}');
		if ((this.is_local) || (this.is_write)) {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #000000;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#00000;background:#CDCDCD; height: 15px; width: 80px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		} else {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #8A8384;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#8A8384;background:#CDCDCD; height: 15px; width: 60px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		}
		//Transliterate.addGlobalStyle('.opt1{color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		//Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; background-color: #C3D9FF; height: 15px; width: 50px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		Transliterate.addGlobalStyle('.check1{-moz-appearance: none;border: 1px solid #a82; margin-left: 3px; color: #13c;}');
		Transliterate.addGlobalStyle('.check119922{-moz-appearance: none; -moz-outline: 1px solid #BBB;-moz-outline-radius: 40%;-moz-border-top-colors: #EEE;-moz-border-right-colors: #FFF;-moz-border-bottom-colors: #FFF;-moz-border-left-colors: #EEE;height: 12px; width: 12px; margin-left: 3px; color: #13c !important;background: none;}');
	},

	transliterationControl: undefined,
	initialized: false,
	defaultLanguage: 'HINDI',
	currentLanguage: null,
	supportTextBoxes: false,
	enabledElements: [],

	init: function() {
		if(Transliterate.initialized){
			return;
		}
		var lang = Transliterate.getCookie('Transliterate_LANG');
		lang = (lang)?lang: google.elements.transliteration.LanguageCode[Transliterate.defaultLanguage];
		var enabled = Transliterate.getCookie('Transliterate_ENABLED');
		if(!enabled || enabled == 'false'){
			enabled = false;
		}
		var options = {
					sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
					destinationLanguage: lang,
					transliterationEnabled: enabled,
					shortcutKey: 'ctrl+g',
		};
		Transliterate.transliterationControl = new google.elements.transliteration.TransliterationControl(options);
		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.STATE_CHANGED, Transliterate.transliterateStateChangeHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_UNREACHABLE,
				Transliterate.serverUnreachableHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_REACHABLE,
				Transliterate.serverReachableHandler);
		if (this.is_local) {
			document.getElementById('checkboxId').checked = true;
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', true);		
		} else {
			document.getElementById('checkboxId').checked = Transliterate.transliterationControl.isTransliterationEnabled();
		}
		Transliterate.populateLanguageBox();
		//google.language.getBranding('poweredby');
		Transliterate.initialized = true;
	},

	transliterateStateChangeHandler: function(e) {
		document.getElementById('checkboxId').checked = e.transliterationEnabled;
	},
	serverUnreachableHandler: function(e) {
	},

	serverReachableHandler: function(e) {
	},
	checkboxClickHandler : function() {
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			}
		}
		Transliterate.transliterationControl.toggleTransliteration();
		Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
	},
	populateLanguageBox: function(){
		var destinationLanguage = Transliterate.transliterationControl.getLanguagePair().destinationLanguage;
		var languageSelect = document.getElementById('languageDropDown');
		var supportedDestinationLanguages = google.elements.transliteration.getDestinationLanguages(google.elements.transliteration.LanguageCode.ENGLISH);
		var oc = 0;
		if (!this.is_local) {
			var opt = document.createElement('option');
			opt.className = "opt0";
			languageSelect.add(opt, null);
		}

		for (var lang in supportedDestinationLanguages) {
			// HRef
			if (lang == "AMHARIC" || lang == "TIGRINYA" || lang == "SERBIAN") continue;
			
			var opt = document.createElement('option');
			var langStr = Transliterate.getCamelizedStr(lang);
			var locLang = langStr.substring(0, 1);
			var langCode = supportedDestinationLanguages[lang];
			opt.text = langStr;//Transliterate.getTransliterationStr(locLang, langCode, opt, function(res){opt.text=res;});
			opt.title = langStr;
			var f = function(ele, res){
						ele.title = res+' ('+ele.title+')';
					};
			Transliterate.getTransliterationStr(langStr, langCode, opt, f);
			opt.value = langCode;
			opt.className = "opt"+((oc++)%2);
			if (destinationLanguage == opt.value) {
				opt.selected = true;
				Transliterate._controlDiv.title = 'Type in '+opt.title;
			}
			try {
				languageSelect.add(opt, null);
			} catch (ex) {
				languageSelect.add(opt);
			}
		}
		if (!this.is_local) {
			var opt = languageSelect.options[0];
			var currLang = languageSelect.options[languageSelect.selectedIndex].text;
			if (document.getElementById("checkboxId").checked) {
				opt.text = "Turn " + currLang + " OFF";
				opt.title = "Turn " + currLang + " OFF";
			} else {
				opt.text = "Turn " + currLang + " ON";
				opt.title = "Turn " + currLang + " ON";
			}
		}		
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
		}		
	},
	getTransliterationStr: function(str, lang, ele, callback){
	google.language.transliterate([str], "en", lang, function(result) {
	 if (!result.error) {
		 if (result.transliterations &amp;&amp; result.transliterations.length &gt; 0 &amp;&amp;
			result.transliterations[0].transliteratedWords.length &gt; 0) {
			var res = result.transliterations[0].transliteratedWords[0];
			if(callback){
				return callback(ele, res);
			}
			ele.innerHTML = res;
		 }
	   }
	 });
	},
	getLang: function(code){
		for (l in google.language.Languages) {
			if(google.language.Languages[l] == code){
				return l;
			}
		}
	},
	getLanguageForCode: function(code){
		var lang = Transliterate.getLang(code);
		if(lang){
			lang = Transliterate.getCamelizedStr(lang);
		}
		return lang;
	},

	getCamelizedStr: function(str){
		str = str.toLowerCase();
		str = str.substring(0, 1).toUpperCase()+str.substring(1, str.length);
		return str;
	},

	languageChangeHandler: function(defaultev) {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (!selectedLang.match("Turn")) {
			Transliterate.transliterationControl.setLanguagePair(google.elements.transliteration.LanguageCode.ENGLISH, selectedLang);
			Transliterate._controlDiv.title = 'Type in '+selOpt.title + '. Click on the checkbox to turn on/off the language setting.';
			if(!defaultev){
				Transliterate.setCookie('Transliterate_LANG', selectedLang);
			}
			Transliterate.currentLanguage = selectedLang;
		}
	},
	
	afterChange: function() {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (selectedLang.match("Turn")) {
			for (var i = 0; i &lt; dropdown.options.length; i++) {
				if (dropdown.options[i].value == Transliterate.currentLanguage) {
					dropdown.selectedIndex = i;
					var lang = dropdown.options[i].text;
				}
			}

			if (document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").checked = false;
				document.getElementById("languageDropDown").style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.color = "#8A8384";
				document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.fontWeight = "normal";
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			} else {
				document.getElementById("checkboxId").checked = true;
				document.getElementById("languageDropDown").style.background = "#92C166";
				document.getElementById("languageDropDown").style.color = "#000000";
				document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
				document.getElementById("languageDropDown").style.fontWeight = "bold";
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
			
		} else {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			} else {
				if (!this.is_local) {
					var currLang = dropdown.options[dropdown.selectedIndex].text;
					if (document.getElementById("checkboxId").checked) {
						dropdown.options[0].text = "Turn " + currLang + " OFF";
						dropdown.options[0].title = "Turn " + currLang + " OFF";
						dropdown.options[0].value = "Turn " + currLang + " OFF";
					} else {
						dropdown.options[0].text = "Turn " + currLang + " ON";
						dropdown.options[0].title = "Turn " + currLang + " ON";
						dropdown.options[0].value = "Turn " + currLang + " ON";
					}			
				}
			}			
		}		
	},
	
	toggleLanguage: function(event) {
		var dropdown = document.getElementById('languageDropDown');
		if (event.target.innerHTML == dropdown.options[dropdown.selectedIndex].text) {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			}
		}
	},

	_controlDiv: undefined,
	createComponents: function(){
		// HRef
		var controlHTML = "&lt;div id='translControl' style='position: absolute; left: -100px; top: -100px;'&gt;"+
							"&lt;div style='float: left; font-size: 13px'&gt;"+
								"&lt;span class='cbut' style='padding-bottom: 1px; -moz-border-radius: 5px;'&gt;"+
									"&lt;input type='checkbox' id='checkboxId' onclick='Transliterate.checkboxClickHandler()' class='check119922'&gt;&lt;/input&gt;&lt;/label&gt;"+
									 "&lt;select class='combo119922' id='languageDropDown' onchange='Transliterate.languageChangeHandler();Transliterate.afterChange();' onclick='Transliterate.toggleLanguage(event);'&gt;&lt;/select&gt;"+
								"&lt;/span&gt;"+
							"&lt;/div&gt;"+
						  "&lt;div class='poweredBy' id='poweredby' style='float: right;padding-top: 5px; display: none;'&gt;&lt;/div&gt;"+
						 "&lt;/div&gt;";
		var dDiv = document.createElement('div');
		dDiv.innerHTML = controlHTML;
		Transliterate._controlDiv = dDiv.firstChild;
		//document.importNode(Transliterate._controlDiv, true);
		document.body.appendChild(Transliterate._controlDiv);
		Transliterate._controlDiv.dimension = {'width': Transliterate._controlDiv.offsetWidth, 'height': Transliterate._controlDiv.offsetHeight};
		
		if (this.is_local) {
			Transliterate._controlDiv.style.display = 'block';
		} else {
			Transliterate._controlDiv.style.display = 'none';
		}
	},
	parentWin: undefined,
	performAction: function(){
		google.load('language', "1");
		google.load("elements", "1", {
			packages: ["transliteration"],
		});
		google.setOnLoadCallback(Transliterate.init);
	},
	setCookie: function(cookieName, cookieValue, nDays) {
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) nDays=30;
		expire.setTime(today.getTime() + 3600000*24*nDays);
		document.cookie = cookieName+"="+escape(cookieValue)
			+ ";expires="+expire.toGMTString();
	},

	getCookie: function(name) {
		var theCookies = document.cookie.split(/[; ]+/);
		for (var i = 0 ; i &lt; theCookies.length; i++) {
			var aName = theCookies[i].substring(0,theCookies[i].indexOf('='));
			if (aName == name) {
				var c = theCookies[i];
				var index = c.lastIndexOf('=');
				c = c.substring(index+1, c.length);
				return c;
			}
		}
	},

	eventAdded: false,
	onLoad: function(loadCallback){
					if(Transliterate.loaded){
						return loadCallback();
					}
					document.write = function(scr){
						var d = document.createElement('div');
						d.innerHTML = scr;
						document.body.appendChild(d.firstChild);
					};
					var callBack = function(){
										Transliterate.addStyles();
										Transliterate.createComponents();
										Transliterate.performAction();
										loadCallback();
								   };
					Transliterate.addScript('https://www.google.com/jsapi', callBack);
					Transliterate.loaded = true;
	},
	addEvents: function(){
		if(Transliterate.eventAdded){
			return;
		}
		Transliterate.eventAdded = true;
		document.addEventListener('mousedown', Transliterate.handleEvent, true);
		document.addEventListener('focus', Transliterate.handleEvent, true);
		/*document.addEventListener('blur', function(ev){
										var tar = ev.target;
										tar.removeEventListener('click', Transliterate.handleEvent, false);
										tar.removeEventListener('focus', Transliterate.handleEvent, false);
										}, false);*/
	},
	autoIdCntr: 1,
	isEditableElement: function(el){
		var tag = el.tagName;
		if(!tag || el.disabled == true || el.readOnly == true){
			return false;
		}
		if(tag.toLowerCase() == 'textarea'){
			return true;
		}
		if(Transliterate.supportTextBoxes &amp;&amp; tag.toLowerCase() == 'input' &amp;&amp; el.type.toLowerCase() == 'text'){
			return true;
		}
		if(tag.toLowerCase() == 'div' &amp;&amp; el.contentEditable.toLowerCase() == 'true'){
			return true;
		}
		if(tag.toLowerCase() == 'iframe'){
			var iframedoc = el.contentWindow.document;
			if(iframedoc.designMode.toLowerCase() == "on" || iframedoc.body.contentEditable.toLowerCase() == "true") {
				return true;
			}		
		}
	},
	handleEvent: function(event){
		try{
			// HRef
			if (this.is_local) {
				var el = document.getElementById('myTextarea');
			} else {
				var el = event.target;
			}
			if(Transliterate.isEditableElement(el)){
				var lazyLoader = function(){
									Transliterate.lazyLoadObjects(el);
								 };
				var initer = function(){
								 Transliterate.checkAndWaitTillInit(lazyLoader);
							 };
				Transliterate.onLoad(initer);
				return;
			}
			if(!Transliterate.isCntrlsDiv(el)){
				Transliterate.showControl(el, true);
			}
		}catch(e){
		}
	},
	waitCounter: 0,
	checkAndWaitTillInit: function(callback){
		try{
			Transliterate.init();
		}catch(e){
			if(Transliterate.waitCounter == 15){	
				return;
			}
			Transliterate.waitCounter++;
			var f = function(){
						Transliterate.checkAndWaitTillInit(callback);
					};
			setTimeout(f, 200);
			return;
		}
		callback();
	},
	isInTheList: function(el){
		for(var i=0; i&lt;Transliterate.enabledElements.length; i++){
			if(Transliterate.enabledElements[i] === el){
				return true;
			}
		}
		return false;
	},
	addToList: function(el){
		Transliterate.enabledElements[Transliterate.enabledElements.length] = el;
	},
	lazyLoadObjects: function(el){
		if(Transliterate.isEditableElement(el)){
				if(!Transliterate.isInTheList(el)){
					var eles = [el];
					Transliterate.addToList(el);
					var options = {
						adjustTextareaStyle: false,
						adjustTextareaDirection: true
					};
					Transliterate.transliterationControl.makeTransliteratable(eles, options);
				}
				Transliterate.languageChangeHandler(true);
				return Transliterate.showControl(el);
		}
	},

	isCntrlsDiv: function(el){
		var p = el;
		while((p = p.parentNode)){
			if(p == Transliterate._controlDiv){
				return true;
			}
		}
		return false;
	},
	findPos: function(obj){
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			}while (obj = obj.offsetParent);
			return {'left': curleft, 'top': curtop};
		}
	},
	showControl: function(ele, hide){
		if(hide){
			if (this.is_local) {
				Transliterate._controlDiv.style.display = 'block';
			} else {
				Transliterate._controlDiv.style.display = 'none';
			}
			return;
		}
		var pos = Transliterate.findPos(ele);
		var dim = Transliterate._controlDiv.dimension;
		var etop = pos.top-dim.height;
		var eleft = pos.left+ele.offsetWidth-dim.width;
		var cssTxt = 'position: absolute; opacity: 0.8; left: '+eleft+'px; top: '+etop+'px; display: block; z-index: 20000;';
		Transliterate._controlDiv.style.cssText = cssTxt;
	},
	setPref: function(defaultLang, textBoxSupport){
		Transliterate.defaultLanguage = defaultLang;
		Transliterate.supportTextBoxes =  textBoxSupport;
	},
	// HRef
	checkElement: function() {
		if (window.location.href == "chrome://epic/content/xml/hrefindic.html") {
			// Original logic by google indic for the sidebar. We return because we do not want to set the regular interval timer
			Transliterate.addEvents();
			return;
		} else {
			// For all other pages
			var activeElement = window.document.activeElement;
			if(Transliterate.isEditableElement(activeElement)){
				if ((activeElement.ownerDocument.defaultView.Transliterate) || (Transliterate.is_newtab)){
					Transliterate.eventAdded = true;
					var el = activeElement;
					var lazyLoader = function(){
										Transliterate.lazyLoadObjects(el);
									 };
					var initer = function(){
									 Transliterate.checkAndWaitTillInit(lazyLoader);
								 };
					Transliterate.onLoad(initer);
				} else {
					//alert('no');
				}
			} else {
				if ((Transliterate._controlDiv) &amp;&amp; (!Transliterate.isCntrlsDiv(activeElement))) {
					Transliterate.showControl(activeElement, true);
				}
			}
		}
		setTimeout(Transliterate.checkElement, 1000);
	}
};
Transliterate.checkElement();
document.addEventListener("click", Transliterate.checkElement, true);Transliterate.setPref('HINDI', true);
// --></!--
var></script>
</p>
<p>
<script type="text/javascript"><!--
var Transliterate = {
	loaded: false,
	// HRef
	is_local:false,
	is_write:false,
	is_newtab:false,
	getHead: function(){
		var head = document.getElementsByTagName('head')[0];
		if (!head) {
			return document.body;
		}
		return head;
	},
	addGlobalStyle: function(css) {
		var head = Transliterate.getHead();
		var style = document.createElement('style');
		style.type = 'text/css';
		style.innerHTML = css;
		head.appendChild(style);
	},

	addScript: function(scriptSrc, callback){
		var head = Transliterate.getHead();
		var script = document.createElement('script');
		script.language = "JavaScript";
		script.src = scriptSrc;
		script.type = 'text/javascript';
		if(callback){
			script.onload = function(){
								callback();
								script.onload = null;
							};
		}
		head.appendChild(script);
	},

	addStyles: function(){
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menu {position: absolute;background-color: #EFEFEF;border: 1px outset #7F7F7F;cursor: default;font: small arial, helvetica, sans-serif;margin: 0px;padding: 0px;outline: none;z-index: 20000;}');
		//Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {background-color: #C3D9FF;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem {position: relative;padding: 1px 1em;margin: 0px;list-style: none;}');
		Transliterate.addGlobalStyle('.fnts, .combo119922{font-family:arial,sans-serif;font-size:10px !important;}.lab{cursor: pointer;}');
		//Transliterate.addGlobalStyle('.cbut{background: #C3D9FF;border: 1px solid #5F9DFF;}');
		// HRef
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {font-size: 14px;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.opt0, .opt1{font-size: 14px;font-weight:normal;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		Transliterate.addGlobalStyle('.opt0:hover, .opt1:hover{background:#FF6D00;}');
		if ((this.is_local) || (this.is_write)) {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #000000;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#00000;background:#CDCDCD; height: 15px; width: 80px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		} else {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #8A8384;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#8A8384;background:#CDCDCD; height: 15px; width: 60px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		}
		//Transliterate.addGlobalStyle('.opt1{color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		//Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; background-color: #C3D9FF; height: 15px; width: 50px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		Transliterate.addGlobalStyle('.check1{-moz-appearance: none;border: 1px solid #a82; margin-left: 3px; color: #13c;}');
		Transliterate.addGlobalStyle('.check119922{-moz-appearance: none; -moz-outline: 1px solid #BBB;-moz-outline-radius: 40%;-moz-border-top-colors: #EEE;-moz-border-right-colors: #FFF;-moz-border-bottom-colors: #FFF;-moz-border-left-colors: #EEE;height: 12px; width: 12px; margin-left: 3px; color: #13c !important;background: none;}');
	},

	transliterationControl: undefined,
	initialized: false,
	defaultLanguage: 'HINDI',
	currentLanguage: null,
	supportTextBoxes: false,
	enabledElements: [],

	init: function() {
		if(Transliterate.initialized){
			return;
		}
		var lang = Transliterate.getCookie('Transliterate_LANG');
		lang = (lang)?lang: google.elements.transliteration.LanguageCode[Transliterate.defaultLanguage];
		var enabled = Transliterate.getCookie('Transliterate_ENABLED');
		if(!enabled || enabled == 'false'){
			enabled = false;
		}
		var options = {
					sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
					destinationLanguage: lang,
					transliterationEnabled: enabled,
					shortcutKey: 'ctrl+g',
		};
		Transliterate.transliterationControl = new google.elements.transliteration.TransliterationControl(options);
		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.STATE_CHANGED, Transliterate.transliterateStateChangeHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_UNREACHABLE,
				Transliterate.serverUnreachableHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_REACHABLE,
				Transliterate.serverReachableHandler);
		if (this.is_local) {
			document.getElementById('checkboxId').checked = true;
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', true);		
		} else {
			document.getElementById('checkboxId').checked = Transliterate.transliterationControl.isTransliterationEnabled();
		}
		Transliterate.populateLanguageBox();
		//google.language.getBranding('poweredby');
		Transliterate.initialized = true;
	},

	transliterateStateChangeHandler: function(e) {
		document.getElementById('checkboxId').checked = e.transliterationEnabled;
	},
	serverUnreachableHandler: function(e) {
	},

	serverReachableHandler: function(e) {
	},
	checkboxClickHandler : function() {
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			}
		}
		Transliterate.transliterationControl.toggleTransliteration();
		Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
	},
	populateLanguageBox: function(){
		var destinationLanguage = Transliterate.transliterationControl.getLanguagePair().destinationLanguage;
		var languageSelect = document.getElementById('languageDropDown');
		var supportedDestinationLanguages = google.elements.transliteration.getDestinationLanguages(google.elements.transliteration.LanguageCode.ENGLISH);
		var oc = 0;
		if (!this.is_local) {
			var opt = document.createElement('option');
			opt.className = "opt0";
			languageSelect.add(opt, null);
		}

		for (var lang in supportedDestinationLanguages) {
			// HRef
			if (lang == "AMHARIC" || lang == "TIGRINYA" || lang == "SERBIAN") continue;
			
			var opt = document.createElement('option');
			var langStr = Transliterate.getCamelizedStr(lang);
			var locLang = langStr.substring(0, 1);
			var langCode = supportedDestinationLanguages[lang];
			opt.text = langStr;//Transliterate.getTransliterationStr(locLang, langCode, opt, function(res){opt.text=res;});
			opt.title = langStr;
			var f = function(ele, res){
						ele.title = res+' ('+ele.title+')';
					};
			Transliterate.getTransliterationStr(langStr, langCode, opt, f);
			opt.value = langCode;
			opt.className = "opt"+((oc++)%2);
			if (destinationLanguage == opt.value) {
				opt.selected = true;
				Transliterate._controlDiv.title = 'Type in '+opt.title;
			}
			try {
				languageSelect.add(opt, null);
			} catch (ex) {
				languageSelect.add(opt);
			}
		}
		if (!this.is_local) {
			var opt = languageSelect.options[0];
			var currLang = languageSelect.options[languageSelect.selectedIndex].text;
			if (document.getElementById("checkboxId").checked) {
				opt.text = "Turn " + currLang + " OFF";
				opt.title = "Turn " + currLang + " OFF";
			} else {
				opt.text = "Turn " + currLang + " ON";
				opt.title = "Turn " + currLang + " ON";
			}
		}		
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
		}		
	},
	getTransliterationStr: function(str, lang, ele, callback){
	google.language.transliterate([str], "en", lang, function(result) {
	 if (!result.error) {
		 if (result.transliterations &amp;&amp; result.transliterations.length &gt; 0 &amp;&amp;
			result.transliterations[0].transliteratedWords.length &gt; 0) {
			var res = result.transliterations[0].transliteratedWords[0];
			if(callback){
				return callback(ele, res);
			}
			ele.innerHTML = res;
		 }
	   }
	 });
	},
	getLang: function(code){
		for (l in google.language.Languages) {
			if(google.language.Languages[l] == code){
				return l;
			}
		}
	},
	getLanguageForCode: function(code){
		var lang = Transliterate.getLang(code);
		if(lang){
			lang = Transliterate.getCamelizedStr(lang);
		}
		return lang;
	},

	getCamelizedStr: function(str){
		str = str.toLowerCase();
		str = str.substring(0, 1).toUpperCase()+str.substring(1, str.length);
		return str;
	},

	languageChangeHandler: function(defaultev) {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (!selectedLang.match("Turn")) {
			Transliterate.transliterationControl.setLanguagePair(google.elements.transliteration.LanguageCode.ENGLISH, selectedLang);
			Transliterate._controlDiv.title = 'Type in '+selOpt.title + '. Click on the checkbox to turn on/off the language setting.';
			if(!defaultev){
				Transliterate.setCookie('Transliterate_LANG', selectedLang);
			}
			Transliterate.currentLanguage = selectedLang;
		}
	},
	
	afterChange: function() {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (selectedLang.match("Turn")) {
			for (var i = 0; i &lt; dropdown.options.length; i++) {
				if (dropdown.options[i].value == Transliterate.currentLanguage) {
					dropdown.selectedIndex = i;
					var lang = dropdown.options[i].text;
				}
			}

			if (document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").checked = false;
				document.getElementById("languageDropDown").style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.color = "#8A8384";
				document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.fontWeight = "normal";
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			} else {
				document.getElementById("checkboxId").checked = true;
				document.getElementById("languageDropDown").style.background = "#92C166";
				document.getElementById("languageDropDown").style.color = "#000000";
				document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
				document.getElementById("languageDropDown").style.fontWeight = "bold";
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
			
		} else {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			} else {
				if (!this.is_local) {
					var currLang = dropdown.options[dropdown.selectedIndex].text;
					if (document.getElementById("checkboxId").checked) {
						dropdown.options[0].text = "Turn " + currLang + " OFF";
						dropdown.options[0].title = "Turn " + currLang + " OFF";
						dropdown.options[0].value = "Turn " + currLang + " OFF";
					} else {
						dropdown.options[0].text = "Turn " + currLang + " ON";
						dropdown.options[0].title = "Turn " + currLang + " ON";
						dropdown.options[0].value = "Turn " + currLang + " ON";
					}			
				}
			}			
		}		
	},
	
	toggleLanguage: function(event) {
		var dropdown = document.getElementById('languageDropDown');
		if (event.target.innerHTML == dropdown.options[dropdown.selectedIndex].text) {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			}
		}
	},

	_controlDiv: undefined,
	createComponents: function(){
		// HRef
		var controlHTML = "&lt;div id='translControl' style='position: absolute; left: -100px; top: -100px;'&gt;"+
							"&lt;div style='float: left; font-size: 13px'&gt;"+
								"&lt;span class='cbut' style='padding-bottom: 1px; -moz-border-radius: 5px;'&gt;"+
									"&lt;input type='checkbox' id='checkboxId' onclick='Transliterate.checkboxClickHandler()' class='check119922'&gt;&lt;/input&gt;&lt;/label&gt;"+
									 "&lt;select class='combo119922' id='languageDropDown' onchange='Transliterate.languageChangeHandler();Transliterate.afterChange();' onclick='Transliterate.toggleLanguage(event);'&gt;&lt;/select&gt;"+
								"&lt;/span&gt;"+
							"&lt;/div&gt;"+
						  "&lt;div class='poweredBy' id='poweredby' style='float: right;padding-top: 5px; display: none;'&gt;&lt;/div&gt;"+
						 "&lt;/div&gt;";
		var dDiv = document.createElement('div');
		dDiv.innerHTML = controlHTML;
		Transliterate._controlDiv = dDiv.firstChild;
		//document.importNode(Transliterate._controlDiv, true);
		document.body.appendChild(Transliterate._controlDiv);
		Transliterate._controlDiv.dimension = {'width': Transliterate._controlDiv.offsetWidth, 'height': Transliterate._controlDiv.offsetHeight};
		
		if (this.is_local) {
			Transliterate._controlDiv.style.display = 'block';
		} else {
			Transliterate._controlDiv.style.display = 'none';
		}
	},
	parentWin: undefined,
	performAction: function(){
		google.load('language', "1");
		google.load("elements", "1", {
			packages: ["transliteration"],
		});
		google.setOnLoadCallback(Transliterate.init);
	},
	setCookie: function(cookieName, cookieValue, nDays) {
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) nDays=30;
		expire.setTime(today.getTime() + 3600000*24*nDays);
		document.cookie = cookieName+"="+escape(cookieValue)
			+ ";expires="+expire.toGMTString();
	},

	getCookie: function(name) {
		var theCookies = document.cookie.split(/[; ]+/);
		for (var i = 0 ; i &lt; theCookies.length; i++) {
			var aName = theCookies[i].substring(0,theCookies[i].indexOf('='));
			if (aName == name) {
				var c = theCookies[i];
				var index = c.lastIndexOf('=');
				c = c.substring(index+1, c.length);
				return c;
			}
		}
	},

	eventAdded: false,
	onLoad: function(loadCallback){
					if(Transliterate.loaded){
						return loadCallback();
					}
					document.write = function(scr){
						var d = document.createElement('div');
						d.innerHTML = scr;
						document.body.appendChild(d.firstChild);
					};
					var callBack = function(){
										Transliterate.addStyles();
										Transliterate.createComponents();
										Transliterate.performAction();
										loadCallback();
								   };
					Transliterate.addScript('https://www.google.com/jsapi', callBack);
					Transliterate.loaded = true;
	},
	addEvents: function(){
		if(Transliterate.eventAdded){
			return;
		}
		Transliterate.eventAdded = true;
		document.addEventListener('mousedown', Transliterate.handleEvent, true);
		document.addEventListener('focus', Transliterate.handleEvent, true);
		/*document.addEventListener('blur', function(ev){
										var tar = ev.target;
										tar.removeEventListener('click', Transliterate.handleEvent, false);
										tar.removeEventListener('focus', Transliterate.handleEvent, false);
										}, false);*/
	},
	autoIdCntr: 1,
	isEditableElement: function(el){
		var tag = el.tagName;
		if(!tag || el.disabled == true || el.readOnly == true){
			return false;
		}
		if(tag.toLowerCase() == 'textarea'){
			return true;
		}
		if(Transliterate.supportTextBoxes &amp;&amp; tag.toLowerCase() == 'input' &amp;&amp; el.type.toLowerCase() == 'text'){
			return true;
		}
		if(tag.toLowerCase() == 'div' &amp;&amp; el.contentEditable.toLowerCase() == 'true'){
			return true;
		}
		if(tag.toLowerCase() == 'iframe'){
			var iframedoc = el.contentWindow.document;
			if(iframedoc.designMode.toLowerCase() == "on" || iframedoc.body.contentEditable.toLowerCase() == "true") {
				return true;
			}		
		}
	},
	handleEvent: function(event){
		try{
			// HRef
			if (this.is_local) {
				var el = document.getElementById('myTextarea');
			} else {
				var el = event.target;
			}
			if(Transliterate.isEditableElement(el)){
				var lazyLoader = function(){
									Transliterate.lazyLoadObjects(el);
								 };
				var initer = function(){
								 Transliterate.checkAndWaitTillInit(lazyLoader);
							 };
				Transliterate.onLoad(initer);
				return;
			}
			if(!Transliterate.isCntrlsDiv(el)){
				Transliterate.showControl(el, true);
			}
		}catch(e){
		}
	},
	waitCounter: 0,
	checkAndWaitTillInit: function(callback){
		try{
			Transliterate.init();
		}catch(e){
			if(Transliterate.waitCounter == 15){	
				return;
			}
			Transliterate.waitCounter++;
			var f = function(){
						Transliterate.checkAndWaitTillInit(callback);
					};
			setTimeout(f, 200);
			return;
		}
		callback();
	},
	isInTheList: function(el){
		for(var i=0; i&lt;Transliterate.enabledElements.length; i++){
			if(Transliterate.enabledElements[i] === el){
				return true;
			}
		}
		return false;
	},
	addToList: function(el){
		Transliterate.enabledElements[Transliterate.enabledElements.length] = el;
	},
	lazyLoadObjects: function(el){
		if(Transliterate.isEditableElement(el)){
				if(!Transliterate.isInTheList(el)){
					var eles = [el];
					Transliterate.addToList(el);
					var options = {
						adjustTextareaStyle: false,
						adjustTextareaDirection: true
					};
					Transliterate.transliterationControl.makeTransliteratable(eles, options);
				}
				Transliterate.languageChangeHandler(true);
				return Transliterate.showControl(el);
		}
	},

	isCntrlsDiv: function(el){
		var p = el;
		while((p = p.parentNode)){
			if(p == Transliterate._controlDiv){
				return true;
			}
		}
		return false;
	},
	findPos: function(obj){
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			}while (obj = obj.offsetParent);
			return {'left': curleft, 'top': curtop};
		}
	},
	showControl: function(ele, hide){
		if(hide){
			if (this.is_local) {
				Transliterate._controlDiv.style.display = 'block';
			} else {
				Transliterate._controlDiv.style.display = 'none';
			}
			return;
		}
		var pos = Transliterate.findPos(ele);
		var dim = Transliterate._controlDiv.dimension;
		var etop = pos.top-dim.height;
		var eleft = pos.left+ele.offsetWidth-dim.width;
		var cssTxt = 'position: absolute; opacity: 0.8; left: '+eleft+'px; top: '+etop+'px; display: block; z-index: 20000;';
		Transliterate._controlDiv.style.cssText = cssTxt;
	},
	setPref: function(defaultLang, textBoxSupport){
		Transliterate.defaultLanguage = defaultLang;
		Transliterate.supportTextBoxes =  textBoxSupport;
	},
	// HRef
	checkElement: function() {
		if (window.location.href == "chrome://epic/content/xml/hrefindic.html") {
			// Original logic by google indic for the sidebar. We return because we do not want to set the regular interval timer
			Transliterate.addEvents();
			return;
		} else {
			// For all other pages
			var activeElement = window.document.activeElement;
			if(Transliterate.isEditableElement(activeElement)){
				if ((activeElement.ownerDocument.defaultView.Transliterate) || (Transliterate.is_newtab)){
					Transliterate.eventAdded = true;
					var el = activeElement;
					var lazyLoader = function(){
										Transliterate.lazyLoadObjects(el);
									 };
					var initer = function(){
									 Transliterate.checkAndWaitTillInit(lazyLoader);
								 };
					Transliterate.onLoad(initer);
				} else {
					//alert('no');
				}
			} else {
				if ((Transliterate._controlDiv) &amp;&amp; (!Transliterate.isCntrlsDiv(activeElement))) {
					Transliterate.showControl(activeElement, true);
				}
			}
		}
		setTimeout(Transliterate.checkElement, 1000);
	}
};
Transliterate.checkElement();
document.addEventListener("click", Transliterate.checkElement, true);Transliterate.setPref('HINDI', true);
// --></!--
var></script>
</p>
<p>&nbsp;</p>
<p>
<script type="text/javascript">var Transliterate = {
	loaded: false,
	// HRef
	is_local:false,
	is_write:false,
	is_newtab:false,
	getHead: function(){
		var head = document.getElementsByTagName('head')[0];
		if (!head) {
			return document.body;
		}
		return head;
	},
	addGlobalStyle: function(css) {
		var head = Transliterate.getHead();
		var style = document.createElement('style');
		style.type = 'text/css';
		style.innerHTML = css;
		head.appendChild(style);
	},

	addScript: function(scriptSrc, callback){
		var head = Transliterate.getHead();
		var script = document.createElement('script');
		script.language = "JavaScript";
		script.src = scriptSrc;
		script.type = 'text/javascript';
		if(callback){
			script.onload = function(){
								callback();
								script.onload = null;
							};
		}
		head.appendChild(script);
	},

	addStyles: function(){
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menu {position: absolute;background-color: #EFEFEF;border: 1px outset #7F7F7F;cursor: default;font: small arial, helvetica, sans-serif;margin: 0px;padding: 0px;outline: none;z-index: 20000;}');
		//Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {background-color: #C3D9FF;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem {position: relative;padding: 1px 1em;margin: 0px;list-style: none;}');
		Transliterate.addGlobalStyle('.fnts, .combo119922{font-family:arial,sans-serif;font-size:10px !important;}.lab{cursor: pointer;}');
		//Transliterate.addGlobalStyle('.cbut{background: #C3D9FF;border: 1px solid #5F9DFF;}');
		// HRef
		Transliterate.addGlobalStyle('.goog-transliterate-indic-suggestion-menuitem-highlight {font-size: 14px;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;border-color: #70a0b0;}');
		Transliterate.addGlobalStyle('.opt0, .opt1{font-size: 14px;font-weight:normal;color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		Transliterate.addGlobalStyle('.opt0:hover, .opt1:hover{background:#FF6D00;}');
		if ((this.is_local) || (this.is_write)) {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #000000;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#00000;background:#CDCDCD; height: 15px; width: 80px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		} else {
			Transliterate.addGlobalStyle('.cbut{background: #CDCDCD;border: 1px solid #8A8384;}');
			Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; font-size: 14px;color:#8A8384;background:#CDCDCD; height: 15px; width: 60px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		}
		//Transliterate.addGlobalStyle('.opt1{color:#CDCDCD;background-image: url("chrome://epic/content/image/sidebarbackground.png");background-repeat: repeat-x;}');
		//Transliterate.addGlobalStyle('.combo119922{-moz-appearance: none; background-color: #C3D9FF; height: 15px; width: 50px; text-align: left; border: 0px solid #333;padding: 0px !important; margin: 0px !important;}');
		Transliterate.addGlobalStyle('.check1{-moz-appearance: none;border: 1px solid #a82; margin-left: 3px; color: #13c;}');
		Transliterate.addGlobalStyle('.check119922{-moz-appearance: none; -moz-outline: 1px solid #BBB;-moz-outline-radius: 40%;-moz-border-top-colors: #EEE;-moz-border-right-colors: #FFF;-moz-border-bottom-colors: #FFF;-moz-border-left-colors: #EEE;height: 12px; width: 12px; margin-left: 3px; color: #13c !important;background: none;}');
	},

	transliterationControl: undefined,
	initialized: false,
	defaultLanguage: 'HINDI',
	currentLanguage: null,
	supportTextBoxes: false,
	enabledElements: [],

	init: function() {
		if(Transliterate.initialized){
			return;
		}
		var lang = Transliterate.getCookie('Transliterate_LANG');
		lang = (lang)?lang: google.elements.transliteration.LanguageCode[Transliterate.defaultLanguage];
		var enabled = Transliterate.getCookie('Transliterate_ENABLED');
		if(!enabled || enabled == 'false'){
			enabled = false;
		}
		var options = {
					sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
					destinationLanguage: lang,
					transliterationEnabled: enabled,
					shortcutKey: 'ctrl+g',
		};
		Transliterate.transliterationControl = new google.elements.transliteration.TransliterationControl(options);
		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.STATE_CHANGED, Transliterate.transliterateStateChangeHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_UNREACHABLE,
				Transliterate.serverUnreachableHandler);

		Transliterate.transliterationControl.addEventListener(
				google.elements.transliteration.TransliterationControl.EventType.SERVER_REACHABLE,
				Transliterate.serverReachableHandler);
		if (this.is_local) {
			document.getElementById('checkboxId').checked = true;
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', true);		
		} else {
			document.getElementById('checkboxId').checked = Transliterate.transliterationControl.isTransliterationEnabled();
		}
		Transliterate.populateLanguageBox();
		//google.language.getBranding('poweredby');
		Transliterate.initialized = true;
	},

	transliterateStateChangeHandler: function(e) {
		document.getElementById('checkboxId').checked = e.transliterationEnabled;
	},
	serverUnreachableHandler: function(e) {
	},

	serverReachableHandler: function(e) {
	},
	checkboxClickHandler : function() {
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
			if (!this.is_local) {
				var dropdown = document.getElementById('languageDropDown');
				var lang = dropdown.options[dropdown.selectedIndex].text;
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			}
		}
		Transliterate.transliterationControl.toggleTransliteration();
		Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
	},
	populateLanguageBox: function(){
		var destinationLanguage = Transliterate.transliterationControl.getLanguagePair().destinationLanguage;
		var languageSelect = document.getElementById('languageDropDown');
		var supportedDestinationLanguages = google.elements.transliteration.getDestinationLanguages(google.elements.transliteration.LanguageCode.ENGLISH);
		var oc = 0;
		if (!this.is_local) {
			var opt = document.createElement('option');
			opt.className = "opt0";
			languageSelect.add(opt, null);
		}

		for (var lang in supportedDestinationLanguages) {
			// HRef
			if (lang == "AMHARIC" || lang == "TIGRINYA" || lang == "SERBIAN") continue;
			
			var opt = document.createElement('option');
			var langStr = Transliterate.getCamelizedStr(lang);
			var locLang = langStr.substring(0, 1);
			var langCode = supportedDestinationLanguages[lang];
			opt.text = langStr;//Transliterate.getTransliterationStr(locLang, langCode, opt, function(res){opt.text=res;});
			opt.title = langStr;
			var f = function(ele, res){
						ele.title = res+' ('+ele.title+')';
					};
			Transliterate.getTransliterationStr(langStr, langCode, opt, f);
			opt.value = langCode;
			opt.className = "opt"+((oc++)%2);
			if (destinationLanguage == opt.value) {
				opt.selected = true;
				Transliterate._controlDiv.title = 'Type in '+opt.title;
			}
			try {
				languageSelect.add(opt, null);
			} catch (ex) {
				languageSelect.add(opt);
			}
		}
		if (!this.is_local) {
			var opt = languageSelect.options[0];
			var currLang = languageSelect.options[languageSelect.selectedIndex].text;
			if (document.getElementById("checkboxId").checked) {
				opt.text = "Turn " + currLang + " OFF";
				opt.title = "Turn " + currLang + " OFF";
			} else {
				opt.text = "Turn " + currLang + " ON";
				opt.title = "Turn " + currLang + " ON";
			}
		}		
		if (document.getElementById("checkboxId").checked) {
			document.getElementById("languageDropDown").style.background = "#92C166";
			document.getElementById("languageDropDown").style.color = "#000000";
			document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
			document.getElementById("languageDropDown").style.fontWeight = "bold";
		} else {
			document.getElementById("languageDropDown").style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.color = "#8A8384";
			document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
			document.getElementById("languageDropDown").style.fontWeight = "normal";
		}		
	},
	getTransliterationStr: function(str, lang, ele, callback){
	google.language.transliterate([str], "en", lang, function(result) {
	 if (!result.error) {
		 if (result.transliterations &amp;&amp; result.transliterations.length &gt; 0 &amp;&amp;
			result.transliterations[0].transliteratedWords.length &gt; 0) {
			var res = result.transliterations[0].transliteratedWords[0];
			if(callback){
				return callback(ele, res);
			}
			ele.innerHTML = res;
		 }
	   }
	 });
	},
	getLang: function(code){
		for (l in google.language.Languages) {
			if(google.language.Languages[l] == code){
				return l;
			}
		}
	},
	getLanguageForCode: function(code){
		var lang = Transliterate.getLang(code);
		if(lang){
			lang = Transliterate.getCamelizedStr(lang);
		}
		return lang;
	},

	getCamelizedStr: function(str){
		str = str.toLowerCase();
		str = str.substring(0, 1).toUpperCase()+str.substring(1, str.length);
		return str;
	},

	languageChangeHandler: function(defaultev) {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (!selectedLang.match("Turn")) {
			Transliterate.transliterationControl.setLanguagePair(google.elements.transliteration.LanguageCode.ENGLISH, selectedLang);
			Transliterate._controlDiv.title = 'Type in '+selOpt.title + '. Click on the checkbox to turn on/off the language setting.';
			if(!defaultev){
				Transliterate.setCookie('Transliterate_LANG', selectedLang);
			}
			Transliterate.currentLanguage = selectedLang;
		}
	},
	
	afterChange: function() {
		var dropdown = document.getElementById('languageDropDown');
		var selOpt = dropdown.options[dropdown.selectedIndex];
		var selectedLang = selOpt.value;
		if (selectedLang.match("Turn")) {
			for (var i = 0; i &lt; dropdown.options.length; i++) {
				if (dropdown.options[i].value == Transliterate.currentLanguage) {
					dropdown.selectedIndex = i;
					var lang = dropdown.options[i].text;
				}
			}

			if (document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").checked = false;
				document.getElementById("languageDropDown").style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.color = "#8A8384";
				document.getElementById("languageDropDown").parentNode.style.background = "#CDCDCD";
				document.getElementById("languageDropDown").style.fontWeight = "normal";
				dropdown.options[0].text = "Turn " + lang + " ON";
				dropdown.options[0].title = "Turn " + lang + " ON";
				dropdown.options[0].value = "Turn " + lang + " ON";
			} else {
				document.getElementById("checkboxId").checked = true;
				document.getElementById("languageDropDown").style.background = "#92C166";
				document.getElementById("languageDropDown").style.color = "#000000";
				document.getElementById("languageDropDown").parentNode.style.background = "#92C166";
				document.getElementById("languageDropDown").style.fontWeight = "bold";
				dropdown.options[0].text = "Turn " + lang + " OFF";
				dropdown.options[0].title = "Turn " + lang + " OFF";
				dropdown.options[0].value = "Turn " + lang + " OFF";
			}
			Transliterate.transliterationControl.toggleTransliteration();
			Transliterate.setCookie('Transliterate_ENABLED', Transliterate.transliterationControl.isTransliterationEnabled());
			
		} else {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			} else {
				if (!this.is_local) {
					var currLang = dropdown.options[dropdown.selectedIndex].text;
					if (document.getElementById("checkboxId").checked) {
						dropdown.options[0].text = "Turn " + currLang + " OFF";
						dropdown.options[0].title = "Turn " + currLang + " OFF";
						dropdown.options[0].value = "Turn " + currLang + " OFF";
					} else {
						dropdown.options[0].text = "Turn " + currLang + " ON";
						dropdown.options[0].title = "Turn " + currLang + " ON";
						dropdown.options[0].value = "Turn " + currLang + " ON";
					}			
				}
			}			
		}		
	},
	
	toggleLanguage: function(event) {
		var dropdown = document.getElementById('languageDropDown');
		if (event.target.innerHTML == dropdown.options[dropdown.selectedIndex].text) {
			if (!document.getElementById("checkboxId").checked) {
				document.getElementById("checkboxId").click();
			}
		}
	},

	_controlDiv: undefined,
	createComponents: function(){
		// HRef
		var controlHTML = "&lt;div id='translControl' style='position: absolute; left: -100px; top: -100px;'&gt;"+
							"&lt;div style='float: left; font-size: 13px'&gt;"+
								"&lt;span class='cbut' style='padding-bottom: 1px; -moz-border-radius: 5px;'&gt;"+
									"&lt;input type='checkbox' id='checkboxId' onclick='Transliterate.checkboxClickHandler()' class='check119922'&gt;&lt;/input&gt;&lt;/label&gt;"+
									 "&lt;select class='combo119922' id='languageDropDown' onchange='Transliterate.languageChangeHandler();Transliterate.afterChange();' onclick='Transliterate.toggleLanguage(event);'&gt;&lt;/select&gt;"+
								"&lt;/span&gt;"+
							"&lt;/div&gt;"+
						  "&lt;div class='poweredBy' id='poweredby' style='float: right;padding-top: 5px; display: none;'&gt;&lt;/div&gt;"+
						 "&lt;/div&gt;";
		var dDiv = document.createElement('div');
		dDiv.innerHTML = controlHTML;
		Transliterate._controlDiv = dDiv.firstChild;
		//document.importNode(Transliterate._controlDiv, true);
		document.body.appendChild(Transliterate._controlDiv);
		Transliterate._controlDiv.dimension = {'width': Transliterate._controlDiv.offsetWidth, 'height': Transliterate._controlDiv.offsetHeight};
		
		if (this.is_local) {
			Transliterate._controlDiv.style.display = 'block';
		} else {
			Transliterate._controlDiv.style.display = 'none';
		}
	},
	parentWin: undefined,
	performAction: function(){
		google.load('language', "1");
		google.load("elements", "1", {
			packages: ["transliteration"],
		});
		google.setOnLoadCallback(Transliterate.init);
	},
	setCookie: function(cookieName, cookieValue, nDays) {
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) nDays=30;
		expire.setTime(today.getTime() + 3600000*24*nDays);
		document.cookie = cookieName+"="+escape(cookieValue)
			+ ";expires="+expire.toGMTString();
	},

	getCookie: function(name) {
		var theCookies = document.cookie.split(/[; ]+/);
		for (var i = 0 ; i &lt; theCookies.length; i++) {
			var aName = theCookies[i].substring(0,theCookies[i].indexOf('='));
			if (aName == name) {
				var c = theCookies[i];
				var index = c.lastIndexOf('=');
				c = c.substring(index+1, c.length);
				return c;
			}
		}
	},

	eventAdded: false,
	onLoad: function(loadCallback){
					if(Transliterate.loaded){
						return loadCallback();
					}
					document.write = function(scr){
						var d = document.createElement('div');
						d.innerHTML = scr;
						document.body.appendChild(d.firstChild);
					};
					var callBack = function(){
										Transliterate.addStyles();
										Transliterate.createComponents();
										Transliterate.performAction();
										loadCallback();
								   };
					Transliterate.addScript('https://www.google.com/jsapi', callBack);
					Transliterate.loaded = true;
	},
	addEvents: function(){
		if(Transliterate.eventAdded){
			return;
		}
		Transliterate.eventAdded = true;
		document.addEventListener('mousedown', Transliterate.handleEvent, true);
		document.addEventListener('focus', Transliterate.handleEvent, true);
		/*document.addEventListener('blur', function(ev){
										var tar = ev.target;
										tar.removeEventListener('click', Transliterate.handleEvent, false);
										tar.removeEventListener('focus', Transliterate.handleEvent, false);
										}, false);*/
	},
	autoIdCntr: 1,
	isEditableElement: function(el){
		var tag = el.tagName;
		if(!tag || el.disabled == true || el.readOnly == true){
			return false;
		}
		if(tag.toLowerCase() == 'textarea'){
			return true;
		}
		if(Transliterate.supportTextBoxes &amp;&amp; tag.toLowerCase() == 'input' &amp;&amp; el.type.toLowerCase() == 'text'){
			return true;
		}
		if(tag.toLowerCase() == 'div' &amp;&amp; el.contentEditable.toLowerCase() == 'true'){
			return true;
		}
		if(tag.toLowerCase() == 'iframe'){
			var iframedoc = el.contentWindow.document;
			if(iframedoc.designMode.toLowerCase() == "on" || iframedoc.body.contentEditable.toLowerCase() == "true") {
				return true;
			}		
		}
	},
	handleEvent: function(event){
		try{
			// HRef
			if (this.is_local) {
				var el = document.getElementById('myTextarea');
			} else {
				var el = event.target;
			}
			if(Transliterate.isEditableElement(el)){
				var lazyLoader = function(){
									Transliterate.lazyLoadObjects(el);
								 };
				var initer = function(){
								 Transliterate.checkAndWaitTillInit(lazyLoader);
							 };
				Transliterate.onLoad(initer);
				return;
			}
			if(!Transliterate.isCntrlsDiv(el)){
				Transliterate.showControl(el, true);
			}
		}catch(e){
		}
	},
	waitCounter: 0,
	checkAndWaitTillInit: function(callback){
		try{
			Transliterate.init();
		}catch(e){
			if(Transliterate.waitCounter == 15){	
				return;
			}
			Transliterate.waitCounter++;
			var f = function(){
						Transliterate.checkAndWaitTillInit(callback);
					};
			setTimeout(f, 200);
			return;
		}
		callback();
	},
	isInTheList: function(el){
		for(var i=0; i&lt;Transliterate.enabledElements.length; i++){
			if(Transliterate.enabledElements[i] === el){
				return true;
			}
		}
		return false;
	},
	addToList: function(el){
		Transliterate.enabledElements[Transliterate.enabledElements.length] = el;
	},
	lazyLoadObjects: function(el){
		if(Transliterate.isEditableElement(el)){
				if(!Transliterate.isInTheList(el)){
					var eles = [el];
					Transliterate.addToList(el);
					var options = {
						adjustTextareaStyle: false,
						adjustTextareaDirection: true
					};
					Transliterate.transliterationControl.makeTransliteratable(eles, options);
				}
				Transliterate.languageChangeHandler(true);
				return Transliterate.showControl(el);
		}
	},

	isCntrlsDiv: function(el){
		var p = el;
		while((p = p.parentNode)){
			if(p == Transliterate._controlDiv){
				return true;
			}
		}
		return false;
	},
	findPos: function(obj){
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			}while (obj = obj.offsetParent);
			return {'left': curleft, 'top': curtop};
		}
	},
	showControl: function(ele, hide){
		if(hide){
			if (this.is_local) {
				Transliterate._controlDiv.style.display = 'block';
			} else {
				Transliterate._controlDiv.style.display = 'none';
			}
			return;
		}
		var pos = Transliterate.findPos(ele);
		var dim = Transliterate._controlDiv.dimension;
		var etop = pos.top-dim.height;
		var eleft = pos.left+ele.offsetWidth-dim.width;
		var cssTxt = 'position: absolute; opacity: 0.8; left: '+eleft+'px; top: '+etop+'px; display: block; z-index: 20000;';
		Transliterate._controlDiv.style.cssText = cssTxt;
	},
	setPref: function(defaultLang, textBoxSupport){
		Transliterate.defaultLanguage = defaultLang;
		Transliterate.supportTextBoxes =  textBoxSupport;
	},
	// HRef
	checkElement: function() {
		if (window.location.href == "chrome://epic/content/xml/hrefindic.html") {
			// Original logic by google indic for the sidebar. We return because we do not want to set the regular interval timer
			Transliterate.addEvents();
			return;
		} else {
			// For all other pages
			var activeElement = window.document.activeElement;
			if(Transliterate.isEditableElement(activeElement)){
				if ((activeElement.ownerDocument.defaultView.Transliterate) || (Transliterate.is_newtab)){
					Transliterate.eventAdded = true;
					var el = activeElement;
					var lazyLoader = function(){
										Transliterate.lazyLoadObjects(el);
									 };
					var initer = function(){
									 Transliterate.checkAndWaitTillInit(lazyLoader);
								 };
					Transliterate.onLoad(initer);
				} else {
					//alert('no');
				}
			} else {
				if ((Transliterate._controlDiv) &amp;&amp; (!Transliterate.isCntrlsDiv(activeElement))) {
					Transliterate.showControl(activeElement, true);
				}
			}
		}
		setTimeout(Transliterate.checkElement, 1000);
	}
};
Transliterate.checkElement();
document.addEventListener("click", Transliterate.checkElement, true);Transliterate.setPref('HINDI', true);</script>
</p>]]></content:encoded>
    </item>
    <item>
      <title>RBS Security Model</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/rbs-security-model</link>
      <pubDate>Thu, 05 Aug 2010 13:29:00 GMT</pubDate>
      <dc:creator><![CDATA[Mike Warmington]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2010/08/05/rbs-security-model/</guid>
      <description><![CDATA[RBS stores blob data in external blob stores which often use a differing security method from SQL...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">RBS stores blob data in external blob stores which often use a differing security method from SQL Server. This blog post details the RBS security model for administrators and provider developers.<o:p></o:p></span></span></p>
<h2 style="margin: 10pt 0in 0pt;"><span style="font-size: large;"><span style="color: #4f81bd;"><span style="font-family: Cambria;">Master Key Requirement<o:p></o:p></span></span></span></h2>
<p class="MsoNormal"><span style="font-size: small; font-family: Calibri;">As part of the RBS installation a database master key is required to be set. This is used for RBS credential encryption and the module signing / schema separation of the RBS internal tables and external views / stored procedures. Detailed information on the specifics of this are below. The database administrator should back up the master key by using&nbsp;</span><a href="https://technet.microsoft.com/en-us/library/ms174387.aspx"><span style="color: windowtext; text-decoration: none; text-underline: none;"><span style="font-size: small; font-family: Calibri;">BACKUP MASTER KEY</span></span></a><span style="font-size: small;"><span style="font-family: Calibri;">&nbsp;and store the backup in a secure, off-site location.<o:p></o:p></span></span></p>
<h2 style="margin: 10pt 0in 0pt;"><span style="font-size: large;"><span style="color: #4f81bd;"><span style="font-family: Cambria;">Provider Security<o:p></o:p></span></span></span></h2>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">There are 4 ways of integrating blob store provider security with RBS and SQL Server. Use of each is dependent on the type and support included in each provider.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpFirst"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">The blob store supports Windows integrated security.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Application specifies credentials to access blob store, while opening an RBS Connection. Credentials are managed by the application.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">A mapping of SQL Principals to Blob Store Principals is maintained by the administrator using RBS auxiliary tables. RBS manages this mapping and automatically flows credentials to the blob store after performing SQL security check.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">The blob store supports the SQL security model. This allows treating security for RBS blobs in a very similar way to traditional varbinary(max) blobs. Such a level of integration is possible with providers that use SQL Server, such as the RBS FILESTREAM provider.<o:p></o:p></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><a name="_Toc195605038"><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Windows Integrated Security</span></a><o:p></o:p></h3>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Some blob stores such as the sample File Server provider support windows integrated security and ACL blobs based on windows user identity. For such blob stores, RBS doesn&rsquo;t have to do anything specifically to provide security to blobs. The blob store can be secured independently from RBS, using the mechanisms provided by the blob store. RBS client library guarantees that the provider is called in the same user context that the application uses to call into RBS client library.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">When an RBS call is made to access a blob, it can be accessed on the blob store if the windows user in whose context the call was made has permissions to access the blob in the blob store. Such a call can be made after the blob ID, blob reference or blob locator has been retrieved from the database, which are secured using database security and RBS roles. The granularity of the permissions (read/write blob, create pool etc.) is specific to the blob store and is configured by the administrator on the blob store independent of RBS.<o:p></o:p></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><a name="_Toc195605039"><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Credentials Managed by Application</span></a><o:p></o:p></h3>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">RBS APIs provide a very flexible way of passing config options at various places. The application can provide credentials to access the blob store by setting CommandOptions on a RemoteBlob or RemoteBlobCollectionManager object before performing an operation. These credentials are not cached and need to be passed whenever needed to connect to the blob store.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">This is a very simple approach, but requires the application to store and manage credentials, which adds complexity at the application layer. A better approach is for the credentials to be managed by the administrator, which the following two options provide.<o:p></o:p></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><a name="_Toc195605040"><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Mapping SQL Principals to Blob Store Principals</span></a><o:p></o:p></h3>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">A mapping from SQL Principals to Blob Store Principals can be setup and the blob store credentials can be stored in the database. This allows the credentials to be managed by the administrator. The administrator has the responsibility of making sure that the access rights to the user tables are reflected in this mapping to maintain consistency.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The credential management is exposed through a series of stored procedures:<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;">-- Adds a credential to the credential table.</span><span style="font-size: 9.5pt; font-family: Consolas;"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: blue; font-family: Consolas;">create</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">procedure</span> <span style="color: teal;">[mssqlrbs]</span><span style="color: gray;">.</span><span style="color: teal;">[rbs_sp_set_blob_store_credential]</span><span style="color: blue;"> </span><span style="color: gray;">(</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@sql_user_sid</span> <span style="color: blue;">varbinary</span><span style="color: gray;">(</span>85<span style="color: gray;">),</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@blob_store_id</span> <span style="color: blue;">smallint</span><span style="color: gray;">,</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@credential_name</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">),</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@credential_secret</span> <span style="color: blue;">varbinary</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">))<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;">-- Retrieve all the decrypted credentials owned by the current user.</span><span style="font-size: 9.5pt; font-family: Consolas;"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: blue; font-family: Consolas;">create</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">procedure</span> <span style="color: teal;">[mssqlrbs]</span><span style="color: gray;">.</span><span style="color: teal;">[rbs_sp_get_blob_store_credentials]</span><span style="color: blue;"> </span><span style="color: gray;">()</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;">-- Retrieves a list of all the credentials in the table. Does not decrypt any secrets.</span><span style="font-size: 9.5pt; font-family: Consolas;"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: blue; font-family: Consolas;">create</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">procedure</span> <span style="color: teal;">[mssqlrbs]</span><span style="color: gray;">.</span><span style="color: teal;">[rbs_sp_get_all_blob_store_credentials]</span><span style="color: blue;"> </span><span style="color: gray;">(</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@sql_user_sid</span> <span style="color: blue;">varbinary</span><span style="color: gray;">(</span>85<span style="color: gray;">))</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: green; font-family: Consolas;">-- Removes a credential from the credential table.</span><span style="font-size: 9.5pt; font-family: Consolas;"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: blue; font-family: Consolas;">create</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">procedure</span> <span style="color: teal;">[mssqlrbs]</span><span style="color: gray;">.</span><span style="color: teal;">[rbs_sp_delete_blob_store_credential]</span><span style="color: blue;"> </span><span style="color: gray;">(</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@sql_user_sid</span> <span style="color: blue;">varbinary</span><span style="color: gray;">(</span>85<span style="color: gray;">),</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@blob_store_id</span> <span style="color: blue;">smallint</span><span style="color: gray;">,</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp; <span style="color: teal;">@credential_name</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">))</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: Consolas;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">For each SQL user that has access to RBS blobs, there will be one or more rows in the credential store: one per blob store (represented by the blob_store_id) the user has access to. This row stores the credentials to use to connect to the blob store. There will be one row per user per provider. To create a default credential the sql_user_sid can be specified as 0x. This credential will be used by any user that does not have a specific user credential added to the credential store.<o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605042"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Blob Store Credential Name</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The credential name is an unencrypted credential identifier used by the store library to distinguish a credential without requiring the decryption of the credential secret. This may be a username or other non-protected information.<o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605043"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Blob Store Credential Secret</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The credential secret is a byte array protected using SQL Server symmetric encryption. The exact internal format of the binary fragment is decided by the provider, e.g. it may contain a password, profile name / secret combination or any other important information that should be protected. The provider will need to provide a tool or instructions to generate the Credential Secret fragment that the administrator can then insert into this table through a stored procedure. <o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605044"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">SQL User SID Representation</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">A SQL user is represented by the SQL user SID (which can be retrieved using SUSER_SID function). SID is chosen because it is guaranteed to be unique for every user and cannot be repeated unlike user IDs and login names. This offers better protection in case a user is deleted and another is added with the same name.<o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605045"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Steps to Access a Blob</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">With this scheme, the sequence of steps for accessing the blob store is:<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpFirst"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Application calls RBS client library to initialize a new RemoteBlob or RemoteBlobCollectionManager object. It passes in a SqlConnection object.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="font-size: small;"><span style="font-family: Calibri;">Based on this SqlConnection&rsquo;s (DataSource, Database, User), a RemoteBlobSession object is associated with this RemoteBlob or RemoteBlobCollectionManager object.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small; font-family: Calibri;">RBS client library uses the provided SqlConnection and calls a stored procedure to get Provider Credentials &ndash; </span><span style="font-size: 10pt; color: #a31515; line-height: 115%; font-family: 'Courier New';">rbs_sp_get_blob_store_credentials</span><span style="font-size: small;"><span style="font-family: Calibri;">.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Stored procedure finds the user associated with the current connection using SUSER_SID, performs a lookup on the rbs_blob_store_credentials table and retrieves all the credentials corresponding to this user.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">RBS Client library stores the Provider Credentials in the RemoteBlobSession object.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Application calls RBS client library to perform an operation that communicates with the blob store (e.g. blob store / fetch).<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">RBS calls provider library, passing in any matching cached BlobStoreCredentials[] along with other configuration options.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-size: small; font-family: Calibri;">7.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Using the given Blob Store Credential, the blob is accessed on the store. Provider library is responsible for managing connections to the blob store. It may maintain a pool of connections if needed.<o:p></o:p></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><a name="_Toc195605046"><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Credential Encryption</span></a><o:p></o:p></h3>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Provider credentials need to be protected using encryption. Two things can be encrypted: column in which the credentials are stored and channel over which the credentials are transmitted.<o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605047"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Column Encryption</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The Credential column is encrypted using symmetric encryption available on SQL Server, and requires a master key to be present on the database at the time RBS is enabled. A single symmetric key is created during RBS installation and used to encrypt / decrypt all the credential secrets in the table. <o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605048"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Channel Encryption</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">RBS opens a new encrypted SqlConnection in order to retrieve credentials based on the original connection string with the encrypted flag set, and optionally setting the TrustServerCertificate flag if the option has been specified during setup. <o:p></o:p></span></span></p>
<h4 style="margin: 10pt 0in 0pt 0.5in;"><a name="_Toc195605049"><span style="mso-fareast-font-family: 'Times New Roman';"><em><span style="font-size: small; color: #4f81bd; font-family: Cambria;">In-Memory Encryption</span></em></span></a><span style="mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></h4>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">When credentials are cached on the client, they are kept in encrypted form so that a memory dump does not contain the credentials in clear text. This is done using the ProtectedMemory class which internally calls the DPAPI OS encryption APIs.<o:p></o:p></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><a name="_Toc195605052"><span style="font-size: small; color: #4f81bd; font-family: Cambria;">Blob Store supports SQL Security Model</span></a><o:p></o:p></h3>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">A tightly integrated solution allows using SQL Principals to secure access to the blob store directly. This can be done if the provider uses SQL server, e.g. the SQL RBS FILESTREAM provider. When using a provider that is not located on the same SQL Server as the RBS metadata store, for example the RBS FILESTREAM provider in the remote configuration this may not be possible.</span></span></p>
<h2 style="margin: 10pt 0in 0pt;"><a name="_Toc195605053"><span style="font-size: large; color: #4f81bd; font-family: Cambria;">Module Signing and Schema</span></a><span style="font-size: large;"><span style="color: #4f81bd;"><span style="font-family: Cambria;"> <o:p></o:p></span></span></span></h2>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The RBS metadata is split between two schemas, mssqlrbs and mssqlrbs_resources.&nbsp; Externally facing modules such as user and admin stored procedures, views and functions are located in the main mssqlrbs schema. Internal tables and stored procedures are located in the mssqlrbs_resources schema.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">A master key in the database is required to create a signing certificate and certificate account, along with the symmetric key used to encrypt the credential data. The modules in the mssqlrbs schema are signed with the certificate, and the certificate account is granted various permissions to the tables in the mssqlrbs_resources schema. When a user executes a module in the mssqlrbs schema that has been signed with the RBS certificate, during the execution of the module further privileges are granted to access mssqlrbs_resources that have been explicitly granted to the certificate user. This allows the admin to control user access using the db_rbs_reader, db_rbs_writer and db_rbs_maintainer SQL roles without requiring in depth knowledge of RBS internals.</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>RBS Filestream Provider Small Blob Optimization Settings</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/rbs-filestream-provider-small-blob-optimization-settings</link>
      <pubDate>Wed, 31 Mar 2010 10:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Mike Warmington]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2010/03/31/rbs-filestream-provider-small-blob-optimization-settings/</guid>
      <description><![CDATA[The RBS Filestream Provider has a number of configuration options designed to ensure optimal read...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>The RBS Filestream Provider has a number of configuration options designed to ensure optimal read and write performance across a range of blob sizes. The defaults were chosen after performance testing on various hardware and should be left as-is unless there are specific circumstances that require modification. The term in-band refers to T-SQL access through the SQL Server engine, and out-of-band refers to Win32 streaming access via the Filestream feature provided UNC path and standard streaming APIs.<?xml:namespace prefix = o /><o:p></o:p></FONT></P>
<H4 style="MARGIN: 12pt 0in 3pt 0.6in"><SPAN style="mso-fareast-font-family: 'Times New Roman'"><FONT size=2><FONT color=#000080><FONT face=Verdana>Inline Storage (max_size_inline_blob)<o:p></o:p></FONT></FONT></FONT></SPAN></H4>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>For very small blobs, the overhead required to store these in Filestream files may be significant. The time required to create a new Filestream file or open a handle to a Filestream file can be substantially more than that required to store small blobs in internal SQL Server data structures in the user’s database. If the incoming blob is at or below the max_size_inline_blob size threshold it will be directly stored in the blob_data_inline varbinary(max) column of the internal RBS data table. During a read request the blob ID is checked and the read request dealt with by returning a T-SQL in-band stream. The max_size_inline_blob configuration value can be changed at any time for new blob inserts, however blobs that have already been stored inline will not be moved or migrated. The default value of the max_size_inline_blob parameter is set to 61140 bytes which was determined as the break-even point where creating a new file or opening a handle to a file outside of the database is more expensive than the slower data access when stored internally. <o:p></o:p></FONT></P>
<H4 style="MARGIN: 12pt 0in 3pt 0.6in"><SPAN style="mso-fareast-font-family: 'Times New Roman'"><FONT size=2><FONT color=#000080><FONT face=Verdana>In-Band Read (max_size_inband_read) and Write (max_size_inband_write)<o:p></o:p></FONT></FONT></FONT></SPAN></H4>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>There is a performance penalty for setting up an out-of-band handle to access a Filestream file. If the blob to be stored or retrieved is small it can be faster to stream using in-band T-SQL access rather than spinning up an out-of-band stream even if they are stored in a Filestream column. This applies for both read and write scenarios. The default value of the max_size_inband_read and max_size_inband_write parameters are set to 1258290 bytes. As this value is used dynamically it can be changed in the blob store configuration and subsequent read and writes will honor the new value.<o:p></o:p></FONT></P>
<H4 style="MARGIN: 12pt 0in 3pt 0.6in"><SPAN style="mso-fareast-font-family: 'Times New Roman'"><FONT size=2><FONT color=#000080><FONT face=Verdana>Out-of-band Read and Write<o:p></o:p></FONT></FONT></FONT></SPAN></H4>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>If the blob size is greater than the configuration setting values a Filestream share path is generated and the data is streamed in or out of the Filestream data file using Win32 streaming APIs. The streaming performance is much greater than going through T-SQL or directly using varbinary(max) however the initial cost to set up the streaming handle can be greater. Performance testing suggests the break-even point for SQL Server 2008 Filestream operations is around 1.2 MB, hence the default upper limits for the in-band read configuration settings.<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><o:p><FONT face=Verdana>&nbsp;</FONT></o:p></P>
<TABLE class=MsoNormalTable style="WIDTH: 393.75pt; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in" cellSpacing=0 cellPadding=0 width=525 border=0 class="MsoNormalTable">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #4f81bd 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #4f81bd 1pt solid; WIDTH: 130.4pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 2.25pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=174>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><B><FONT face=Verdana>Configuration Item<o:p></o:p></FONT></B></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #4f81bd 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 55.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 2.25pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=74>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><B><FONT face=Verdana>Config Type<o:p></o:p></FONT></B></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #4f81bd 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 143pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 2.25pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=191>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><B><FONT face=Verdana>Extended Description<o:p></o:p></FONT></B></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #4f81bd 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 64.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 2.25pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=86>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><STRONG><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'">Default<o:p></o:p></SPAN></STRONG></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #4f81bd 1pt solid; WIDTH: 130.4pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=174>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>max_size_inband_write<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 55.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=74>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>Extended<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 143pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=191>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>Maximum size in bytes for a blob to be written using in-band access only.<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 64.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=86>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 'Verdana','sans-serif'">1258290</SPAN></STRONG><FONT face=Verdana> bytes<o:p></o:p></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #4f81bd 1pt solid; WIDTH: 130.4pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=174>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>max_size_inband_read<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 55.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=74>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>Core<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 143pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=191>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>Maximum size in bytes for a blob to be returned using in-band access only rather than utilizing Filestream Win32 streaming access.<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 64.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid; BACKGROUND-COLOR: transparent" vAlign=top width=86>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 'Verdana','sans-serif'">1258290</SPAN></STRONG><FONT face=Verdana> bytes<o:p></o:p></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #4f81bd 1pt solid; WIDTH: 130.4pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=174>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>max_size_inline_blob<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 55.8pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=74>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt; TEXT-ALIGN: center" align=center><FONT face=Verdana>Extended<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 143pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=191>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><FONT face=Verdana>Maximum size in bytes for a blob to be stored directly in the varbinary(max) column rather than stored in the Filestream column. Typically this should be set to a very small value. While this value can be changed at any time, any existing blobs that have been stored inline will not be moved.<o:p></o:p></FONT></P></TD>
<TD class="" style="BORDER-RIGHT: #4f81bd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; BACKGROUND: #d3dfee; PADDING-BOTTOM: 0in; BORDER-LEFT: #d4d0c8; WIDTH: 64.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: #4f81bd 1pt solid" vAlign=top width=86>
<P class=MsoNormal style="MARGIN: 0in 0in 3pt"><STRONG><SPAN style="FONT-WEIGHT: normal; FONT-FAMILY: 'Verdana','sans-serif'">61140 </SPAN></STRONG><FONT face=Verdana>bytes<o:p></o:p></FONT></P></TD></TR></TBODY></TABLE>
<P>- mike</P>]]></content:encoded>
    </item>
    <item>
      <title>Running RBS Maintainer</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/running-rbs-maintainer</link>
      <pubDate>Fri, 19 Mar 2010 17:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Pradeep Madhavarapu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2010/03/19/running-rbs-maintainer/</guid>
      <description><![CDATA[We are getting some questions on this through this blog and our codeplex site and I thought that...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>We are getting some questions on this through this blog and our codeplex site and I thought that this subject needs a detailed blog post, so here is some information on running RBS maintainer.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><FONT face=Calibri>Connection Strings<o:p></o:p></FONT></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>RBS maintainer takes connection strings from a CLR config file (Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config) that is present in the same directory as the maintainer executable. You will need to add your connection strings to this file. You will need to add one connection string per database that you want to run RBS maintainer on. It is recommended that the connection strings be encrypted in case you are using SQL authentication (since the password is part of the connection string). If you are using Windows Authentication, you dont need to encrypt your connection strings. <o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>The config file created by RBS installer contains the connection string in encrypted form. CLR config files have the limitation that all the connection strings need to be either encrypted or plaintext - you cannot have a combination of some connection strings encrypted and some plaintext. So, if you want to add more connection strings to the config file already created by RBS installer, you will need to either write a program to encrypt them or use a utility (aspnet_regiis.exe) to do it for you. See [1] for more details on how to do this. If you do not want to encrypt your connection strings, feel free to delete the encrypted connection string already present in the config file and add your connection strings in plaintext.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><FONT face=Calibri>Command Line Parameters<o:p></o:p></FONT></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Once you have all the connection strings in the config file, you can run maintainer executable with command line parameters telling it which database to run on and what set of tasks to do. Here is a brief description of the command-line parameters that you can get by running maintainer without any parameters:<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">Usage (Available Options):<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">ConnectionStringName&nbsp;&nbsp;&nbsp; - This parameter is the name of the connection string.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It takes a single argument: &lt;Connection String Name&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The connection string needs to be present in the CLR xml config file.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">Operation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - This parameter is the operation(s) to perform.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The parameter takes between 1 and 4 arguments: &lt;Operation1 [Operation2 [Operation3 [Operation4]]]&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Operations must be &lt;ConsistencyCheck, GarbageCollection, Maintenance, ConsistencyCheckForStores, ForceFinalize&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ForceFinalize cannot be specified in combination with any other operation.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">GarbageCollectionPhases - This parameter is the phase(s) of garbage collection to run or finalize.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;The parameter takes a single argument: &lt;Phase(s) of garbage collection to run or finalize&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This argument needs to be 1 or more letters from &lt;r, d, o&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r: Reference Scan, d: Delete Propagation, o: Orphan Cleanup.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">ConsistencyCheckMode&nbsp;&nbsp;&nbsp; - This parameter is the mode for consistency checks.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The parameter takes a single argument: &lt;Consistency Check Mode&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This argument needs to be &lt;c, r, b&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c: Check only, r: Check and attempt to repair any issues found,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b: Check, repair and re-build RBS internal information without losing customizations.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">ConsistencyCheckExtent&nbsp; - This parameter is the extent for consistency checks.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The parameter takes a single argument: &lt;Consistency Check Extent&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This argument needs to be &lt;m, c&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m: Metadata only, c: Complete check.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">TimeLimit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - This parameter is the limit on the amount of time to run specified operation(s).<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The parameter takes a single argument: &lt;Time Limit in Minutes&gt;.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This argument needs to be a positive integer.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">ConsistencyCheckForStores - This parameter enables selecting blob stores on which to run store specific consistency check operations.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This parameter has a default value of All, and can take the following blob store arguments: &lt;BlobStoreName1 [BlobStoreName2 [...]] Default:All&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Takes the names of blob stores as arguments.</SPAN><SPAN style="COLOR: #00b050; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>The different operations available in maintainer are:<o:p></o:p></FONT></FONT></B></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>GarbageCollection. See [2] for details on the different phases of garbage collection. Pool Slicing is a new feature added in RBS 2008 R2 that allows GC of pools to happen incrementally, i.e. one slice at a time instead of the whole pool at one go. The slicing is done based on the create timestamp of the blob. This allows making incremental progress on garbage collecting huge pools that contain hundreds of millions of blobs without requiring a long maintenance window. Slicing applies only to the Orphan Cleanup phase and is used only if the provider implements time filtered enumeration (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt">EnumerationOptimizationLevel</SPAN><FONT size=3 face=Calibri> is higher than </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">Basic</SPAN><FONT size=3 face=Calibri>). The RBS Filestream provider implements this. Config keys that can be used to tune Garbage Collection operation are: </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">delete_scan_period, orphan_scan_period, garbage_collection_time_window</SPAN><FONT face=Calibri><FONT size=3>. If you want to completely remove all deleted blobs immediately, set all the 3 config items above to&nbsp;<EM>'time 00:00:00'</EM> and run maintainer for GC phases RS and DP (rd). This is useful if you want to unregister a blob store / uninstall a provider.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoListParagraph><FONT face=Calibri><FONT size=3>The command line switch GarbageCollectionPhases is required for this operation. Examples (these examples assume that you have a connection string in your config file named RBSMaintainerConnection, whch is the default string added by the RBS installer): <o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l3 level1 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection&nbsp;&nbsp; -Operation GarbageCollection -GarbageCollectionPhases rdo<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l3 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>This runs the 3 phases of garbage collection.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>ConsistencyCheck. This does a consistency check on the RBS internal tables and can optionally try to repair any issues found. If you specify this operation, you also need to specify ConsistencyCheckMode. Optionally, you can also specify ConsistencyCheckExtent to choose whether to check metadata only or check for the validity of each BlobID (default is metadata). Config keys that can be used to tune it are: </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">max_consistency_issues_found, max_consistency_issues_returned</SPAN><FONT face=Calibri><FONT size=3>. Examples:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l3 level1 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation ConsistencyCheck -ConsistencyCheckMode c<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l3 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This does consistency check only (no repair) on the RBS metadata.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l3 level1 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation ConsistencyCheck -ConsistencyCheckMode r -ConsistencyCheckExtent c<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l3 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>This does consistency check and attempts repair on RBS metadata as well as each BlobId.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>3.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>ConsistencyCheckForStores. This does consistency check on blob stores associated with the RBS database. For this option to work, the provider needs to implement consistency checks (its </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt">ConsistencyCheckLevel</SPAN><FONT size=3 face=Calibri> must not be </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">None</SPAN><FONT face=Calibri><FONT size=3>). This is a new feature added in RBS 2008 R2 and has been implemented by the RBS Filestream Provider. Config keys that can be used to tune it are: . Examples:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l1 level1 lfo3" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation ConsistencyCheckForStores<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l1 level2 lfo3" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This runs consistency check on all the registered stores if their providers support it.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l1 level1 lfo3" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation ConsistencyCheckForStores -ConsistencyCheckForStores MyBlobStore1 MyBlobStore2<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l1 level2 lfo3" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>This runs consistency check on the two specified blob stores (if their providers support it).<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 1in" class=MsoListParagraph><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>4.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>Maintenance. This does some maintenance on RBS internal tables, which mainly consists of reorganizing indexes. It is a good idea to run maintainer with this operation once in a while to ensure good performance. Examples:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation Maintenance<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>This does maintenance of RBS indexes.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoListParagraph><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>5.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>ForceFinalize. RBS Maintainer is designed to make incremental progress on garbage collection operations. If a phase of GC is not completed before the allotted time is up, the progress is saved and it is picked up again the next time RBS Maintainer is run for that operation. This mechanism is explained in [2] below as well. Sometimes it may be desired to “forget” this saved information about in-progress garbage collections and start fresh. The ForceFinalize operation serves that purpose: it removes saved information about one or more GC phases. The next time maintainer is run with those GC phases, they start from the beginning. The command line switch GarbageCollectionPhases is required for this operation. Examples:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection -Operation ForceFinalize -GarbageCollectionPhases rd<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This does ForceFinalize for the RS and DP phases of garbage collection.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT face=Calibri><FONT size=3>Options:<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>TimeLimit. Currently this is the only option available. If this is specified, RBS maintainer will try to stop after the specified duration even if all its tasks are not complete. If it is not specified, maintainer will continue to run until all the specified tasks (operations) are completed. This option allows scheduling RBS maintainer to run during regular maintenance windows (e.g. from midnight to 2 AM) and stop at a predictable time. If maintainer had to stop before the tasks were completed, they will be picked up the next time maintainer is run with those operations specified. [2] talks about how this option interacts with some config keys.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>You can combine multiple operations from above in one command line. You can specify upto 3 operations at one time (the usage message pasted above says upto 4, but there is a bug currently which limits it to 3) Examples:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>-Operation GarbageCollection ConsistencyCheck<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>-GarbageCollectionPhases rdo -ConsistencyCheckMode r<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This does the 3 phases of garbage collection and consistency check on RBS metadata only with attempt to repair.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>-Operation GarbageCollection ConsistencyCheck ConsistencyCheckForStores<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>-GarbageCollectionPhases rdo -ConsistencyCheckMode r<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This does the 3 phases of garbage collection, consistency check on RBS metadata only with attempt to repair and consistency check on all registered stores whose providers support consistency check.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>-Operation GarbageCollection ConsistencyCheck Maintenance<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>-GarbageCollectionPhases rdo -ConsistencyCheckMode r<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>This does the 3 phases of garbage collection, consistency check on RBS metadata only with attempt to repair and maintenance of RBS indexes.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.75in; mso-list: l2 level1 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; COLOR: #0070c0; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #0070c0"><FONT size=3>Microsoft.Data.SqlRemoteBlobs.Maintainer.exe -ConnectionStringName RBSMaintainerConnection<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>-Operation GarbageCollection ConsistencyCheck Maintenance<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>-GarbageCollectionPhases rdo -ConsistencyCheckMode r -TimeLimit 120<o:p></o:p></FONT></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1.25in; mso-list: l2 level2 lfo4" class=MsoListParagraph><SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore"><FONT size=3>o</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>This does the 3 phases of garbage collection, consistency check on RBS metadata only with attempt to repair and maintenance of RBS indexes and puts a time limit of 2 hours for processing all these things. If they don’t complete in approximately 2 hours, maintainer saves its progress and stops.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><FONT face=Calibri>Monitoring Progress<o:p></o:p></FONT></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>The view </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">mssqlrbs.rbs_blob_details</SPAN><FONT size=3 face=Calibri> shows a list of all the blobs that RBS thinks are currently in use by the application. Running the Reference Scan (r) phase of GC moves blobs out of these and marks them internally for deletion during the Delete Propagation (d) phase after the backup/restore SLA time window (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">garbage_collection_time_window</SPAN><FONT size=3 face=Calibri>) has elapsed. The view </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">mssqlrbs.rbs_consistency_issues</SPAN><FONT size=3 face=Calibri> shows the list of consistency issues found by the maintainer. For measuring performance, troubleshooting or just for curiosity, you can look at views</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> mssqlrbs.rbs_history</SPAN><FONT size=3 face=Calibri> and </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">mssqlrbs.rbs_counters</SPAN><FONT size=3><FONT face=Calibri> to see the progress of maintainer tasks. <o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><FONT face=Calibri>Scheduling RBS Maintainer<o:p></o:p></FONT></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>RBS does not come with its own way of scheduling maintainer. RBS maintainer is a standalone executable and you will need to schedule it yourself. One way to do that is to use Window Task Scheduler - this is what the RBS installer brings up if you select that option while installing RBS. [1] has some sample steps to schedule it using Windows Task Scheduler. Another way to schedule it is to have a job in SQL Server Agent. You are also free to use your own mechanisms to do the scheduling.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><FONT face=Calibri>References<o:p></o:p></FONT></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-SIZE: 12pt"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></B></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>[1] </FONT><A href="https://sqlrbs.codeplex.com/Thread/View.aspx?ThreadId=204627" mce_href="https://sqlrbs.codeplex.com/Thread/View.aspx?ThreadId=204627"><FONT color=#0000ff size=3 face=Calibri>https://sqlrbs.codeplex.com/Thread/View.aspx?ThreadId=204627</FONT></A><FONT size=3><FONT face=Calibri> - this thread has sample steps to add encrypted connection strings to the maintainer config file and to schedule maintainer task using Windows Task Scheduler. Running maintainer once will only perform the tasks on one database. So if you have multiple databases, you will need to run maintainer multiple times (once for each database).<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>[2] </FONT><A href="https://blogs.msdn.com/sqlrbs/archive/2008/08/08/rbs-garbage-collection-settings-and-rationale.aspx" mce_href="https://blogs.msdn.com/sqlrbs/archive/2008/08/08/rbs-garbage-collection-settings-and-rationale.aspx"><FONT size=3 face=Calibri>https://blogs.msdn.com/sqlrbs/archive/2008/08/08/rbs-garbage-collection-settings-and-rationale.aspx</FONT></A><FONT size=3><FONT face=Calibri> has more information on the different phases of garbage collection and the TimeLimit option.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>As always, feel free to ask questions if you have any – either through comments on this blog or by creating a new discussion thread on the </FONT><A href="https://sqlrbs.codeplex.com/Thread/List.aspx" mce_href="https://sqlrbs.codeplex.com/Thread/List.aspx"><FONT color=#0000ff size=3 face=Calibri>discussions</FONT></A><FONT size=3><FONT face=Calibri> page on our codeplex site.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>- Pradeep.<o:p></o:p></FONT></FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Multiple Blob Stores in RBS – Defaults and Explicit Store Selection</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/multiple-blob-stores-in-rbs-defaults-and-explicit-store-selection</link>
      <pubDate>Mon, 04 Jan 2010 16:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Pradeep Madhavarapu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2010/01/04/multiple-blob-stores-in-rbs-defaults-and-explicit-store-selection/</guid>
      <description><![CDATA[Recently I got a question on how a blob store is chosen for storing new blobs when multiple blob...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Recently I got a question on how a blob store is chosen for storing new blobs when multiple blob stores are present, and how to influence that choice. This might be of interest to many others and so I am writing this blog post. Please feel free to ask questions (using the contact features on this blog site or by posting comments) and we will be happy to answer them.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>A blob store can be identified using Blob Store Name or Blob Store ID; there is a 1:1 correspondence between these and there is a different name/ID for each instance of blob store registered with the DB. Blob Store Name is different from Blob Store Type. Blob Store Type indicates a class of blob stores, e.g. “Filestream”, “File” or “Centera” – this is fixed by the provider developer and cannot be changed by the admin or application writer. Blob Store Name is associated with an instance of a blob store, usually by the admin who deploys RBS. The list of blob stores registered with a DB can be found using the view <B><I>mssqlrbs.rbs_blob_stores</I></B>.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Here is the logic (in priority order) that determines which blob store is used to store a new blob.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>If the application specifies a blob store name in </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">CreateNewBlob()</SPAN><FONT face=Calibri><FONT size=3> call, that blob store is used. This has the highest priority and all defaults are ignored. The blob store name needs to be specified inside the config parameter.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">SqlRemoteBlobContext.CreateNewBlob(int collectionId, ConfigItemList config)</SPAN><FONT size=3 face=Calibri>: set the </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">BlobStoreName</SPAN><FONT size=3><FONT face=Calibri> parameter in config.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Otherwise, if there is a default blob store associated with the collection to which the new blob belongs, that blob store is used. The default blob store for a collection can be specified while creating a collection and can also be modified later. [Note: If the </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">CreateNewBlob()</SPAN><FONT size=3 face=Calibri> call doesn’t specify a </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">collectionId</SPAN><FONT size=3 face=Calibri>, the default collection with </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">collectionId</SPAN><FONT face=Calibri><FONT size=3> 0 is used. A default blob store can be associated with that collection as well.]<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">SqlRemoteBlobContext.CreateNewCollection(ConfigItemList config)</SPAN><FONT size=3 face=Calibri>: set the </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">DefaultBlobStoreName</SPAN><FONT face=Calibri><FONT size=3> parameter in config.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">SqlRemoteBlobCollectionManager.ModifyConfig(ConfigItemList config)</SPAN><FONT size=3 face=Calibri>: set the </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">DefaultBlobStoreName</SPAN><FONT face=Calibri><FONT size=3> parameter in config.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>To clear/remove default blob store for a collection, call </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">ModifyConfig</SPAN><FONT size=3 face=Calibri> above with an empty string (</FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">""</SPAN><FONT size=3 face=Calibri>) as the </FONT><SPAN style="FONT-FAMILY: Consolas; COLOR: #9bbb59; FONT-SIZE: 10pt">DefaultBlobStoreName</SPAN><FONT face=Calibri><FONT size=3>. Note that not specifying an item in the config structure means retaining the old value, so you need to explicitly pass in some value to change the default blob store. The value that indicates removal/clearing is the empty string.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>You can see the current default blob store for a collection from the view <B><I>mssqlrbs.rbs_collections</I></B>: <I>select blob_store_name from mssqlrbs.rbs_blob_stores as b join mssqlrbs.rbs_collections as c on c.default_blob_store_id = b.blob_store_id where c.collection_id =</I> &lt;Collection you are interested in&gt;.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>3.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>Otherwise, if there is a default blob store for the DB, that blob store is used.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>To set a default blob store for the DB, call Stored Procedure: <B><I>mssqlrbs.rbs_sp_set_config_value</I></B><I>(@config_key sysname, @config_value nvarchar(max))</I> with <I>@config_key = N'default_blob_store_name'</I> and <I>@config_value = </I>&lt;name of the blob store you want to set as default&gt;. Repeated calls to this SP will overwrite the default blob store and only the latest setting will be retained.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri><FONT size=3>To clear/remove default blob store for the DB, call SP: <B><I>mssqlrbs.rbs_sp_delete_config_value</I></B><I>(N'<B>default_blob_store_name</B>')</I>.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>You can see the current default blob store for the DB from the view <B><I>mssqlrbs.rbs_config</I></B>: <I>select * from mssqlrbs.rbs_config where config_key = N'default_blob_store_name'</I>.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>4.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Otherwise, an error is returned that no blob store has been specified.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>- Pradeep<o:p></o:p></FONT></FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server Remote BLOB Store and FILESTREAM feature comparison</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/sql-server-remote-blob-store-and-filestream-feature-comparison</link>
      <pubDate>Wed, 18 Nov 2009 11:23:00 GMT</pubDate>
      <dc:creator><![CDATA[Mike Warmington]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2009/11/18/sql-server-remote-blob-store-and-filestream-feature-comparison/</guid>
      <description><![CDATA[&nbsp;
With the recent refresh of the RBS Feature Pack a brief comparison between RBS and the SQL...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"></SPAN>&nbsp;</P><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">With the recent refresh of the RBS Feature Pack a brief comparison between RBS and the SQL Server FILESTREAM feature may be useful.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">FILESTREAM and RBS are complementary approaches for storage and management of BLOBs and we see them both continuing to evolve.<o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">FILESTREAM provides a storage option that allows storage, efficient streaming and integrated management of large BLOBs in a SQL database by utilizing the underlying NTFS file system for BLOB storage/streaming. It offers fully transactional access and compatible operations as varbinary(max).<o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">RBS is a set of &nbsp;standardized APIs that allow storage/retrieval of BLOBs outside of your main SQL database where a dedicated BLOB store is desirable for various reasons. This uses a provider model for plugging in any dedicated BLOB store that implements these RBS APIs.<o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore">o<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">We have also built an out-of-the-box RBS FILESTREAM provider that allows a deployment to use a SQL Database (local or remote) as a dedicated BLOB store. This provider utilizes the FILESTREAM as the BLOB storage mechanism and ties the two technologies together.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Both FILESTREAM and RBS will have continued investment over future releases of SQL Server. These are SQL Server features that application developers should feel comfortable taking dependencies on.</SPAN></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Remote Blob Storage November CTP Refresh Available</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/remote-blob-storage-november-ctp-refresh-available</link>
      <pubDate>Fri, 13 Nov 2009 16:15:00 GMT</pubDate>
      <dc:creator><![CDATA[MPlazaMSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2009/11/13/remote-blob-storage-november-ctp-refresh-available/</guid>
      <description><![CDATA[The SQL Server 2008 R2 November Community Technology Preview Feature Pack is available for...]]></description>
      <content:encoded><![CDATA[<SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: 'MS Mincho'; mso-bidi-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: JA; mso-bidi-language: AR-SA">
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>The SQL Server 2008 R2 November Community Technology Preview Feature Pack is available for download now. This includes a refresh of the Remote Blob Storage package.</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal mce_keep="true">&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>Significant enhancements have been made in this release for performance and integration with SharePoint 2010. These changes include implementing the <SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt"><A href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</A></SPAN> interface in the <SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SqlRemoteBlobCollectionManager</SPAN> and <SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt">SqlRemoteBlobContext</SPAN> classes. This allows RBS to manage the lifetime of resources used by these objects and reuse them through a pooling mechanism.</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>While this is not needed to ensure correctness, in order to take full advantage of the performance changes existing applications must be modified to use the <SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt">IDisposable</SPAN> pattern:<SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt">SqlRemoteBlobContext</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> context = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlRemoteBlobContext</SPAN>(conn);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">// RBS operations<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>Should be replaced with</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> (<SPAN style="COLOR: #2b91af">SqlRemoteBlobContext</SPAN> context = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlRemoteBlobContext</SPAN>(conn))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp; <SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="COLOR: green">// RBS operations<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>Note that this release contains breaking changes preventing access to data stored in FILESTREAM blob stores using previous CTP releases. Uninstalling previous versions and removing the FILESTREAM blob store data prior to installing this one is recommended for configurations using FILESTREAM stores.</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>SQL Server 2008 R2 November CTP Feature Pack link:</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><A href="https://www.microsoft.com/downloads/details.aspx?familyid=020EE0D5-BCE4-4A45-9D64-B0C49C8831E5&amp;displaylang=en" mce_href="https://www.microsoft.com/downloads/details.aspx?familyid=020EE0D5-BCE4-4A45-9D64-B0C49C8831E5&amp;displaylang=en">https://www.microsoft.com/downloads/details.aspx?familyid=020EE0D5-BCE4-4A45-9D64-B0C49C8831E5&amp;displaylang=en</A><SPAN style="FONT-FAMILY: 'Times New Roman','serif'"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal>Install and configure Remote BLOB Storage on SharePoint Foundation 2010:</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><A href="https://technet.microsoft.com/en-us/library/ee663474(office.14).aspx" mce_href="https://technet.microsoft.com/en-us/library/ee663474(office.14).aspx">https://technet.microsoft.com/en-us/library/ee663474(office.14).aspx</A></P></SPAN>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2008 R2 Remote Blob Store August CTP Available</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/sql-server-2008-r2-remote-blob-store-august-ctp-available</link>
      <pubDate>Fri, 14 Aug 2009 11:49:00 GMT</pubDate>
      <dc:creator><![CDATA[Mike Warmington]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2009/08/14/sql-server-2008-r2-remote-blob-store-august-ctp-available/</guid>
      <description><![CDATA[Updated RBS Packages are available as part of the SQL Server 2008 R2 August CTP release. This...]]></description>
      <content:encoded><![CDATA[<p>
<a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=adc60012-be4a-47d0-877f-ca91326939c3" mce_href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=adc60012-be4a-47d0-877f-ca91326939c3">Updated RBS Packages</a> are available as part of the <span>SQL Server 2008 R2 August CTP release. This includes the new default FILESTREAM RBS provider along with many other enhancements and bugfixes.<br></span></p>This provider is the first officially supported RBS Provider released by Microsoft and begins to bridge the gap between RBS and Filestream, allowing applications to code against the RBS API and use Filestream as the blob store. This is the default provider for RBS and will enable fast developer startup when investigating the SQL / RBS stack.<br><p>In addition to the new provider, several features were added to the core RBS client libraries. These include asynchronous provider requests, deferred deletion of collections, maintainer optimizations and support for provider specific consistency checks.<br></p><p>Administrators and developers can look forward to significant performance enhancements when these are made available in future CTP releases.</p><p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Exceptions to be Thrown by BlobStore Implementations</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlrbs/exceptions-to-be-thrown-by-blobstore-implementations</link>
      <pubDate>Mon, 29 Sep 2008 14:09:00 GMT</pubDate>
      <dc:creator><![CDATA[Pradeep Madhavarapu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlrbs/2008/09/29/exceptions-to-be-thrown-by-blobstore-implementations/</guid>
      <description><![CDATA[I recently got a question on what Exceptions a BlobStore implementation should throw and this blog...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri>I recently got a question on what Exceptions a <I style="mso-bidi-font-style: normal">BlobStore</I> implementation should throw and this blog post answers that question. <I style="mso-bidi-font-style: normal">BlobStore</I> implementations should throw either <I style="mso-bidi-font-style: normal">BlobStoreException</I> or other exceptions.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri><o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri><I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"></SPAN></I></FONT></FONT>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri><I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial">BlobStoreException</SPAN></I><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"> is meant to be used for conditions that RBS client library expects and knows how to handle (either now or in the future). For this reason, there is a defined list of cases where <I style="mso-bidi-font-style: normal">BlobStoreException</I> should be thrown. This is the list of values&nbsp;of the&nbsp;<I style="mso-bidi-font-style: normal">BlobStoreExceptionCode</I> enum.&nbsp;If a condition falls in this list, then a <I style="mso-bidi-font-style: normal">BlobStoreException</I> must be thrown.&nbsp;If a condition does not fall into this list, then a different exception must be thrown. <o:p></o:p></SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"><FONT size=3><FONT face=Calibri><o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"></SPAN></FONT></FONT>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial">So the next question is: which exception should a BlobStore implementation throw? .NET Framework guidelines say that as far as possible, we should throw system exceptions. This helps with easier handling of the error, possibly by higher level applications or by admins. In the case of RBS, the client library wraps any non-<I style="mso-bidi-font-style: normal">BlobStoreException</I> Exceptions in another exception (</SPAN><I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">RemoteBlobStoreException</SPAN></I><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> with <I style="mso-bidi-font-style: normal">ExceptionCode</I> = <I style="mso-bidi-font-style: normal">BlobStoreUnhandledException</I>) and sets the InnerException to the original exception thrown by the BlobStore. So applications will need to catch and handle this new exception. If LogLevel is configured to Error or higher, the log will also contain details of the exception as well.</SPAN><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"><o:p></o:p></SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri></FONT></o:p>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>In general, it would be very rare to have a condition not covered by the list in <I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial">BlobStoreExceptionCode</SPAN></I>. One example where it is not covered is present in the sample provider. The sample <I style="mso-bidi-font-style: normal">FileStoreLibrary</I> throws non-<I style="mso-bidi-font-style: normal">BlobStoreExceptions</I> such as <I style="mso-bidi-font-style: normal">ArgumentNullException</I>. In this case, if this exception gets thrown, it indicates a bug in RBS client code, and it should not be hidden by a BlobStoreException.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri></FONT></o:p>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>If other components/dlls called by a blob store provider can throw exceptions such as <I style="mso-bidi-font-style: normal">OutOfMemoryException</I>, the BlobStore implementation should be careful about letting it bubble up directly. Often times the correct thing to do is to throw a <I style="mso-bidi-font-style: normal">BlobStoreException</I> with <I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial">BlobStoreExceptionCode</SPAN></I> set to <I style="mso-bidi-font-style: normal">OperationFailedAuthoritative</I>. Remember, the list of conditions indicated by <I style="mso-bidi-font-style: normal"><SPAN style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial">BlobStoreExceptionCode</SPAN></I> are the ones that RBS client library knows how to handle, and it always takes precedence.</FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>- Pradeep.</FONT></P>]]></content:encoded>
    </item>
  </channel>
</rss>