SharePoint Server 中維護 RBSMaintain RBS in SharePoint Server

摘要:了解如何在 SharePoint Server 2016 和 SharePoint 2013中執行與遠端 BLOB 存放區 (RBS) 相關的維護工作。Summary: Learn how to perform maintenance tasks that are associated with Remote BLOB Storage (RBS) in SharePoint Server 2016 and SharePoint 2013.

您可以使用 RBS 維護程式 (SQL Server 中的一個工具),在 SharePoint Server 中執行與 RBS 相關的大部分維護工作。RBS 維護程式執行 SharePoint Server RBS 部署的週期性廢棄項目收集與其他維護工作。您可以使用「Windows 工作排程器服務」或「SQL Server 代理程式」,對使用 RBS 的每個資料庫排程這些工作。您必須使用命令列參數或 XML 檔案來佈建 RBS 維護程式。針對鏡像或複製資料庫,您可以根據任何單一執行個體執行 RBS 維護程式。You perform most of the maintenance tasks associated with RBS in SharePoint Server by using the RBS Maintainer, which is a tool in SQL Server. The RBS Maintainer performs periodic garbage collection and other maintenance tasks for a SharePoint Server RBS deployment. You can schedule these tasks for each database that uses RBS by using Windows Task Scheduler or SQL Server Agent. You must provision the RBS Maintainer by using command-line parameters or through an XML file. In the case of mirrored or replicated databases, you can run the RBS Maintainer against any single instance.

設定 RBS 廢棄項目收集Configure RBS Garbage collection

SharePoint Server 會將未參照或已刪除的 BLOB 資料自動標記為待移除。SharePoint Server 會查看 SharePoint Server 在移除時於內容資料庫中儲存的 BLOB 識別碼清單,以計算 BLOB 的參考。存在於 RBS 存放區表格但不存在於內容資料庫中的任何 BLOB 參考,都是假設要由 SharePoint Server 刪除,而且會標記為待移除。不存在於內容資料庫但已在「清除遺棄項目」時間間隔之前建立的 BLOB (本文稍後所述),也會假設要由 SharePoint Server 刪除,而且會標記為待移除。SharePoint Server automatically marks unreferenced or deleted BLOB data for removal. SharePoint Server counts references to BLOBs by looking at the list of BLOB IDs stored by SharePoint Server in its content databases at the time of removal. Any BLOB references that are present in the RBS store tables but absent in the content database are assumed to be deleted by SharePoint Server and will be marked for removal. BLOBs that are not present in the content database and were created before the orphan cleanup time window, described later in this article, are also assumed to be deleted by SharePoint Server and will be marked for removal.

SharePoint Server 會以表格形式列出內容資料庫之 RBS 欄中的 BLOB 參考,因此每個 RBS 欄都必須具備有效的索引,才能在 RBS 中註冊。Because SharePoint Server tabulates BLOB references from the RBS columns of the content database, every RBS column must have a valid index before it can be registered in RBS.

SQL Server RBS 維護程式工具會移除 SharePoint Server 標記要移除的項目。您應該排程在離峰期間執行清除工作,以減少對一般資料庫作業的影響。The SQL Server RBS Maintainer tool removes the items marked by SharePoint Server for removal. You should schedule the clean-up tasks to be run during off-peak hours to reduce the effect on regular database operations.

RBS 廢棄項目收集分為下列三個步驟執行:RBS garbage collection is performed in the following three steps:

  • 參考掃描。第一步是將 SharePoint Server 內容資料庫中 RBS 表格的內容與 RBS 自己內部表格的內容進行比較,並決定不再參照哪些 BLOB。任何未參照的 BLOB 都會標記為待刪除。Reference scan. The first step compares the contents of the RBS tables in the SharePoint Server content database that has RBS's own internal tables and determines which BLOBs are no longer referenced. Any unreferenced BLOBs are marked for deletion.

  • 刪除傳播。下一步是確定哪些 BLOB 被標記為待刪除的時間長於廢棄項目收集時間的值,並將其從 BLOB 存放區中刪除。Delete propagation. The next step determines which BLOBs were marked for deletion for some time longer than the garbage_collection_time_window value and deletes them from the BLOB store.

  • 清除遺棄項。最後一步確定是否有任何 BLOB 存在於 BLOB 存放區,卻不存在於 RBS 表中。如果存在這種情況,將會刪除孤立的 BLOB。Orphan cleanup. The final step determines whether any BLOBs are present in the BLOB store but absent in the RBS tables. These orphaned BLOBs are then deleted.

設定 RBS 廢棄項目收集Configuring RBS garbage collection

您可以指定下列 RBS 維護程式設定和資料庫設定,以設定廢棄項目收集:You can configure garbage collection by specifying the following RBS Maintainer settings and database settings:

  • 維護程式排程。此設定會決定 RBS 維護程式的執行頻率。Maintainer schedule. This setting determines how often the RBS Maintainer will be run.

  • 工作期間。此設定會決定單一 RBS 維護程式工作可以執行的時間上限。預設設定為兩個小時。Task Duration. This setting determines the maximum length that a single RBS Maintainer task can run. The default setting is two hours.

您應該設定 RBS 維護程式,讓維護程式的活動對一般活動的影響降至最低。如需資料庫廢棄項目收集設定的資訊 (例如如何設定這些設定),請參閱<執行 RBS 維護程式>。You should configure the RBS Maintainer so that its activity has minimal effect on regular activity. For information about database garbage collection settings, such as how to configure the settings, see Running RBS Maintainer.

RBS 與 BLOB 存放區一致性檢查RBS and BLOB store consistency checks

RBS 維護程式會確認 RBS BLOB 參考的完整性,並修正任何發現的錯誤。它會執行資料庫的多項一致性檢查,例如確認 RBS 欄的索引是否存在,以及確認 SharePoint Server 參考的所有 BLOB 是否存在於 RBS 中。The RBS Maintainer verifies the integrity of RBS BLOB references and corrects any errors that are found. It performs several consistency checks for the database, such as verifying that indexes exist for the RBS columns, and verifying that all BLOBs that are referenced by SharePoint Server exist in RBS.

輔助表一致性檢查確認 RBS 輔助表是否處於一致的狀態。執行的檢查如下:The Auxiliary Table Consistency Check verifies that the RBS auxiliary tables are in a consistent state. The checks performed are the following:

  • 確認每個 RBS 表格欄是否具備有效的索引。Verify that each RBS table column has a valid index.

  • 確認 RBS 表格欄是否存在、已啟用、具備有效的索引,並且具備正確的欄類型。Verify that RBS table columns exist; have enabled, valid indexes; and have the correct column type.

雖然您可以停用下列一致性檢查,但是建議您不要停用,因為它們有助於確認 RBS 存放區的一致性。預設會啟用下列一致性檢查:Although you can disable the following consistency checks, we recommend that you do not disable them because they help ensure the consistency of your RBS store. By default, the following consistency checks are enabled:

  • 確認 SharePoint Server 所參照的所有 BLOB 存在於 RBS 表格中。Verify that all BLOBs that are referenced by SharePoint Server are present in the RBS tables.

  • 確認沒有任何 BLOB 同時標記為正在使用和已刪除。Verify that no BLOBs are marked as both in use and deleted.

會記錄任何發現的問題,RBS 維護程式會建立遺失的索引項目、取消註冊遺失的欄,或者將正在使用的 BLOB 標記為未刪除,以嘗試修復這些問題。Any discovered problems are logged and the RBS Maintainer attempts to fix them by creating missing index entries, unregistering missing columns, or marking in-use BLOBs as not deleted.

執行 RBS 維護程式Running the RBS Maintainer

RBS 需要您在執行 RBS 維護程式之前,為使用 RBS 的每個資料庫定義連接字串。此字串會儲存在 <RBS installation path>\Microsoft SQL Remote Blob Storage 10.50\Maintainer 資料夾的設定檔中,而此設定檔通常是在安裝期間建立。搭配執行 Microsoft.Data.SqlRemoteBlobs.Maintainer.exe 程式與執行 RBS 維護程式中所列的命令列參數,即可手動執行 RBS 維護程式。RBS requires you to define a connection string to each database that uses RBS before you run the RBS Maintainer. This string is stored in a configuration file in the <RBS installation path>\Microsoft SQL Remote Blob Storage 10.50\Maintainer folder that is ordinarily created during installation. The RBS Maintainer can be run manually by executing the Microsoft.Data.SqlRemoteBlobs.Maintainer.exe program together with the command line parameters that are listed in Running RBS Maintainer.

您必須排程使用 RBS 之每個資料庫的個別 RBS 維護程式工作。下列步驟說明如何排程 RBS 維護程式工作。You must schedule a separate RBS Maintainer task for every database that uses RBS. The following steps describe how to schedule an RBS Maintainer task.

排程 RBS 維護程式工作To schedule an RBS Maintainer task

  1. 確認您具有已安裝 RBS 之資料夾的寫入權限。Verify that you have Write permissions for the folder where you installed RBS.

  2. 針對要執行的 RBS 維護程式工作新增連接字串至 <RBS 安裝目錄>_Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config 文件。RBS 安裝程式會使用安裝期間提供的連線資訊,建立一個名為 RBSMaintainerConnection 的連接字串。不過,您必須新增每個其他資料庫的新連接字串。Add a connection string to the <RBS installation directory>_Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config file for the RBS Maintainer task that is to be performed. The RBS installer creates one connection string that is named RBSMaintainerConnection by using the connection information that was provided during setup. However, new connection strings must be added for every additional database.

    如果您是使用 Windows 驗證,則不需要加密連接字串。您可以執行下列命令,來新增未加密連接字串:If you are using Windows authentication, the connection string does not have to be encrypted. You can add the unencrypted connection string by running the following command:

    aspnet_regiis -pef connectionStrings . -prov DataProtectionConfigurationProvideraspnet_regiis -pef connectionStrings . -prov DataProtectionConfigurationProvider

    rename web.config Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.configrename web.config Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config

    如果您是使用 SQL 驗證,則 RBS 維護程式連接字串必須為加密格式。因此,若要新增連接字串,則必須加密新字串,或必須解密所有連接字串。一次必須新增一個加密字串。不過,使用 %windir%\Microsoft.net\Framework\ <版本>\Aspnet_regiis.exe 工具,可以同時解密所有連接字串,此工具會配送為 Microsoft .NET Framework 的一部分。If you are using SQL authentication, the RBS Maintainer connection strings must be in an encrypted format. Therefore, to add connection strings, either the new strings must be encrypted or all the connection strings must be decrypted. Encrypted strings must be added one at a time. However all the connection strings can be decrypted at the same time by using the %windir%\Microsoft.net\Framework\ <version>\Aspnet_regiis.exe tool, which is distributed as a part of the Microsoft .NET Framework.

    執行下列命令以解密連接字串,並將結果儲存在 Web.config 檔案中:Run the following commands to decrypt the connection strings and store the results in a Web.config file:

    rename Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config web.configrename Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config web.config

    aspnet_regiis -pdf connectionStringsaspnet_regiis -pdf connectionStrings

    然後可以使用解密形式新增字串,並使用下列命令將檔案加密,然後重新命名 Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config:Strings can then be added in decrypted form and the file can be encrypted and renamed to Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config by using the following commands:

    aspnet_regiis -pef connectionStrings . -prov DataProtectionConfigurationProvideraspnet_regiis -pef connectionStrings . -prov DataProtectionConfigurationProvider

    rename web.config Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.configrename web.config Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config

  3. 建立 Windows 排程器工作,以執行每個可用資料庫的 RBS 維護程式工作。如果您以 GUI 模式執行 RBS 安裝程式,則會自動建立 Windows 排程器工作。不過,如果您以命令列模式執行 RBS 安裝程式,則必須在每次排程工作以執行 RBS 維護程式時執行下列步驟:Create a Windows scheduler task to run the RBS Maintainer task for each applicable database. If you ran the RBS installer in GUI mode, it automatically created a Windows scheduler task. However, if you ran the RBS installer in command-line mode, you must follow these steps every time that you schedule a task to run the RBS Maintainer:

    • 在 [開始] 功能表上按一下 [系統管理工具] 和 [工作排程器On the Start menu, click Administrative Tools, and then click Task Scheduler.

    • 在 [動作] 功能表上按一下 [建立工作On the Action menu, click Create Task.

    • 在 [動作] 索引標籤上按一下 [新增]。On the Actions tab, click New.

    • 在 [新增動作] 對話方塊的 [動作] 下拉式清單中選取 [啟動程式]。In the New Action dialog box, in the Action drop-down list, select Start a program.

    • [設定] 下的 [程式/指令碼中,瀏覽至維護程式二進位檔案_<RBS 安裝目錄>\Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe,並在新增引數 (選擇性)文字] 方塊中,新增任何選擇性的引數。安裝程式會建立下列預設值:Under Settings, in the Program/script box, browse to the Maintainer binary file <RBS installation directory>_\Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe, and in the Add arguments (optional) text box, add any optional arguments. The following default values are created by the installer:

      <-ConnectionStringName RBSMaintainerConnection>、<-Operation GarbageCollection ConsistencyCheck ConsistencyCheckForStores>、<-GarbageCollectionPhases rdo>、<-ConsistencyCheckMode r>、<-TimeLimit 120><-ConnectionStringName RBSMaintainerConnection>, <-Operation GarbageCollection ConsistencyCheck ConsistencyCheckForStores>, <-GarbageCollectionPhases rdo>, <-ConsistencyCheckMode r>, <-TimeLimit 120>

    • 按一下 [ OK ]。Click OK.

    • 在 [觸發程序] 索引標籤上按一下 [新增]。On the Triggers tab, click New.

    • 新的觸發程序] 對話方塊中,排程任務,並再按一下 [確定]。我們建議您排定要執行低系統活動的時段的任務。In the New Trigger dialog box, schedule the task, and then click OK. We recommend that you schedule the task to run during low system activity times.

    • 確定 [一般] 索引標籤的 [安全性] 下的使用者帳戶具有適當的權限來執行工作。您可以變更權限依序按一下 [變更使用者或群組On the General tab, under Security, make sure that the user account has the appropriate permissions to run the task. You can change permissions by clicking Change User or Group.

    • 在 [一般] 索引標籤上按一下 [不論使用者登入與否均執行] 和 [確定]On the General tab, click Run whether user is logged on or not, and then click OK.

另請參閱See also

概念Concepts

SharePoint Server 中的 RBS 概觀Overview of RBS in SharePoint Server

在 SharePoint Server 伺服器陣列中使用 FILESTREAM 來安裝和設定 RBSInstall and configure RBS with FILESTREAM in a SharePoint Server farm

在 SharePoint Server 中利用 FILESTREAM 設定內容資料庫以使用 RBSSet a content database to use RBS with FILESTREAM in SharePoint Server

在 SharePoint Server 中將內容移入或移出 RBSMigrate content into or out of RBS in SharePoint Server

停用 SharePoint Server 內容資料庫上的 RBSDisable RBS on content databases in SharePoint Server