在 SharePoint Server 中備份 Search Service 應用程式Back up Search service applications in SharePoint Server

摘要: 了解如何備份 SharePoint Server 2016 和 SharePoint Server 2013 中的 Search Service 應用程式。Summary: Learn how to back up Search service applications in SharePoint Server 2016 and SharePoint Server 2013.

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來備份伺服器陣列中的 Search Service 應用程式。所使用的備份工具取決於已部署的環境類型、備份排程的需要以及您組織的服務等級協定而定。You can back up a Search service application in a farm by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. Which backup tool you use depends on what kind of environment you have deployed, what your backup schedule requires, and what service level agreements you have made with your organization.

開始之前Before you begin

建議您定期在伺服器陣列層級進行備份。但是,業務或 IT 需求可能需要您備份搜尋服務及相關的資源。定期備份搜尋系統,可減少因硬體故障、停電或其他問題時發生資料遺失的機率。雖然這只是簡單的處理程序,但有助於在必要時可確保構成搜尋系統的資料及設定能用於復原。We recommend that you regularly back up at the farm level. However, business or IT requirements might require you to back up the search service and related resources. Regularly backing up the search system reduces the possibility of data losses that might occur from hardware failures, power outages, or other problems. It is a simple process that helps make sure that data and configurations that compose the search system are available for recovery, if that is required.

開始這項作業之前,請先檢閱下列資訊:Before you begin this operation, review the following information:

  • 您必須在本機電腦或網路上建立儲存備份的資料夾。若要獲得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。You must create a folder on the local computer or the network in which to store the backups. For better performance, we recommend that you back up to the local computer and then move the backup files to a network folder.

  • 您無法使用 SQL Server 工具或 Data Protection Manager 來備份所有搜尋元件。You cannot use SQL Server tools or Data Protection Manager to back up all of the search components.

  • 備份搜尋並不會影響伺服器陣列的狀態,但它確實需要資源。因此,備份搜尋可能會影響備份執行時的伺服器陣列效能。您可以在伺服器陣列使用量最低的期間備份搜尋,以避免發生效能問題。Backing up search does not affect the state of the farm. However, it does require resources. Therefore, backing up search might affect farm performance while the backup is running. You can avoid performance issues by backing up search during hours when farm use is lowest.

備份同義字檔案Back up a thesaurus file

同義字檔案可用來指定出現在搜尋查詢中之單字或片語的同義字。您可以先在 SharePoint Server 的外部系統中建立及維護同義字檔案,然後再將其匯入 SharePoint Server,以供搜尋系統使用。這樣同義字檔案就不會包含在以下說明的 SharePoint Server 搜尋備份程序中。Thesaurus files are used to specify synonyms for words or phrases that occur in search queries. You create and maintain the thesaurus files in systems external to SharePoint Server before you import them into SharePoint Server to make them available to the search system. The thesaurus files are therefore not included in the SharePoint Server search backup procedures outlined below.

若要備份同義字檔案,請確定其內含在用來建立及維護同義字檔案外部系統的備份程序中。To back up your thesaurus files, you need to make sure that they are included in the backup procedures for the external system you are using to create and maintain the thesaurus files.

在 SharePoint Server 中使用 PowerShell 來備份搜尋Use PowerShell to back up search in SharePoint Server

您可以使用 PowerShell 來手動備份搜尋,或透過可以依排程間隔執行的指令碼備份搜尋。此程序會備份所有搜尋元件,包括資料庫、Search Service 設定及所有索引檔。You can use PowerShell to back up search manually or as part of a script that can be run at scheduled intervals. This procedure backs up all of the search components including the databases, the search service configuration, and all of the index files.

若要使用 PowerShell 來備份搜尋To back up search by using PowerShell

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。securityadmin fixed server role on the SQL Server instance.

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。db_owner fixed database role on all databases that are to be updated.

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。Administrators group on the server on which you are running the PowerShell cmdlets.

    • SharePoint 伺服器陣列管理員群組。Farm Administrators SharePoint group.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server 產品 Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server Products cmdlets.

      注意

      如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 啟動 SharePoint 管理命令介面。Start the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元中,輸入下列命令:At the PowerShell command prompt, type the following command:

    Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} -Item "Farm\Shared Services\Shared Services Applications\<SearchServiceApplicationName>" [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是您用於儲存備份檔案的資料夾路徑。<BackupFolder> is the path of the folder that you use for storing backup files.

    • <SearchServiceApplicationName> 是您想還原之 Search Service 應用程式的名稱。<SearchServiceApplicationName> is the name of the Search service application that you are backing up.

      注意

      若是第一次備份伺服器陣列,必須使用 [完整]**** 選項。您必須先執行完整備份,才可執行差異備份。若要檢視備份作業的進度,請使用 Verbose 參數。[差異]**** 選項僅適用於搜尋資料庫。搜尋索引檔案一律完整備份,即使使用 [差異]**** 選項也一樣。If you are backing up the farm for the first time, you must use the Full option. You must perform a full backup before you can perform a differential backup. To view the progress of the backup operation, use the Verbose parameter. The Differential option only applies to the search databases. The search index files are always fully backed up, even when you use the Differential option.

如需詳細資訊,請參閱<Backup-SPFarm>。For more information, see Backup-SPFarm.

注意

建議您在執行命令列管理工作時使用 Windows PowerShell。Stsadm 命令列工具已過時,但為與舊版產品相容,仍會隨附提供。We recommend that you use Microsoft PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

在 SharePoint Server 中使用管理中心來備份搜尋Use Central Administration to back up search in SharePoint Server

您可以使用管理中心來備份搜尋。此程序會備份所有搜尋元件,包括資料庫、Search Service 設定及所有索引檔。You can use Central Administration to back up search. This procedure backs up all of the search components including the databases, the search service configuration, and all of the index files.

若要使用管理中心備份搜尋To back up search by using Central Administration

  1. 確認執行此程序的使用者帳戶為 SharePoint 伺服器陣列管理員群組的成員。Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.

  2. 啟動 [管理中心]****。Start Central Administration.

  3. 在管理中心首頁上,按一下 [備份與還原]**** 區段中的 [執行備份]*In Central Administration, on the home page, in the *Backup and Restore section, click Perform a backup.

  4. 在 [執行備份 - 步驟 2 之 1:選取要備份的元件] 頁面的元件清單中,展開 [共用服務]*,然後展開 [共用服務應用程式]* 以檢視伺服器陣列中的服務應用程式清單。請從元件清單中選取 Search Service 應用程式,然後按 [下一步]*On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, in the list of components, expand *Shared Services and then expand Shared Services Applications to view the list of service applications in the farm. Select the search service application from the list of components, and then click Next.

    注意

    Search Service 應用程式可能包含數個元件。您必須選取頂層元件。服務應用程式的名稱預設為 "Search Service 應用程式"。The search service application might consist of several components. You must select the top-level component. By default, the service application is named "Search Service Application".

  5. 在 [開始備份 - 步驟 2 之 2: 選取備份選項] 頁面的 [備份類型]**** 區段中,選取 [完整]**** 或 [差異]*On the Start Backup — Step 2 of 2: Select Backup Options page, in the *Backup Type section, select either Full or Differential.

    注意

    若是第一次備份搜尋,必須使用 [完整]**** 選項。您必須先執行完整備份,才可執行差異備份。[差異]**** 選項僅適用於搜尋資料庫。搜尋索引檔案一律完整備份,即使使用 [差異]**** 選項也一樣。If you are backing up search for the first time, you must use the Full option. You must perform a full backup before you can perform a differential backup. The Differential option only applies to the search databases. The search index files are always fully backed up, even when you use the Differential option.

  6. 在 [備份檔案位置]**** 區段的 [備份位置]**** 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]****。In the Backup File Location section, in the Backup location box, type the path of the backup folder, and then click Start Backup.

  7. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備]**** 區段中,檢視所有備份工作的一般狀態。在同頁面底部的 [備份]**** 區段中,則可檢視目前備份工作的狀態。狀態頁面每 30 秒會自動更新。只要按一下 [重新整理]*,即可手動更新狀態詳細資料。備份與復原都是計時器服務工作。因此,備份要數秒後才會開始。You can view the general status of all backup jobs at the top of the Backup and Restore Job Status page in the *Readiness section. You can view the status for the current backup job in the lower part of the page in the Backup section. The status page updates every 30 seconds automatically. You can manually update the status details by clicking Refresh. Backup and recovery are timer service jobs. Therefore, it might take several seconds for the backup to start.

    如有收到錯誤,可以檢閱 [備份與還原工作狀態] 頁面的 [失敗訊息]**** 欄。也可以在步驟 6 所指定之 UNC 路徑下的 Spbackup.log 檔案中,找到詳細資料。If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page. You can also find more details in the Spbackup.log file at the UNC path that you specified in step 6.

您無法使用 SQL Server 工具來備份整個 SharePoint Search Service 應用程式。不過,您可以使用 SQL Server 工具來備份與 Search Service 應用程式相關聯的資料庫。若要備份整個 Search Service 應用程式,請使用 PowerShell 或管理中心。You cannot back up the complete SharePoint Search service application by using SQL Server tools. However, you can use SQL Server tools to back up the databases that are associated with the Search service application. To back up the complete Search service application, use either PowerShell or Central Administration.

若要使用 SQL Server 來備份與 Search Service 應用程式相關聯的資料庫,必須遵循下列步驟:To use SQL Server to back up the databases that are associated with the Search service application, you must follow these steps:

  1. 暫停 Search Service 應用程式。Pause the Search service application.

  2. 以 SQL Server 工具來備份所有 Search Service 應用程式資料庫。Back up all the Search service application databases with SQL Server tools.

  3. 繼續 Search Service 應用程式。Resume the Search service application.

使用 PowerShell 來暫停 Search Service 應用程式To pause the Search service application by using PowerShell

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。securityadmin fixed server role on the SQL Server instance.

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。db_owner fixed database role on all databases that are to be updated.

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。Administrators group on the server on which you are running the PowerShell cmdlets.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint 2016 Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint 2016 cmdlets.

      注意

      如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 啟動 SharePoint 管理命令介面。Start the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元中,輸入下列命令:At the PowerShell command prompt, type the following command:

    $ssa = Get-SPEnterpriseSearchServiceApplication -Identity <SearchServiceApplicationName> Suspend-SPEnterpriseSearchServiceApplication -Identity $ssa
    

    其中:Where:

    • <SearchServiceApplicationName> 是您想還原之 Search Service 應用程式的名稱。<SearchServiceApplicationName> is the name of the Search service application that you are backing up.

使用 SQL Server 工具來備份所有 Search Service 應用程式資料庫To back up all the Search service application databases by using SQL Server tools

  1. 確認執行此程序的使用者帳戶是儲存各資料庫之資料庫伺服器上的 SQL Server db_backupoperator 固定資料庫角色成員。Verify that the user account that is performing this procedure is a member of the SQL Server db_backupoperator fixed database role on the database server where each database is stored.

  2. 啟動 SQL Server Management Studio,並連線至資料庫伺服器。Start SQL Server Management Studio and connect to the database server.

  3. 在 [物件總管] 中,展開 [資料庫]*In Object Explorer, expand *Databases.

  4. 在要備份的資料庫上按一下滑鼠右鍵,並指向 [工作]*,然後按一下 [備份]Right-click the database that you want to back up, point to **Tasks, and then click **Back Up*.

  5. 在 [備份資料庫]**** 對話方塊中,確認資料庫名稱。In the Back Up Database dialog box, confirm the database name.

  6. 下一步,從 [備份類型]**** 清單選取要執行的備份種類。如需要使用哪種備份類型的詳細資訊,請參閱《SQL Server 線上叢書》中的<復原模式 (SQL Server)>。Next, select the kind of backup that you want to perform from the Backup type list. For more information about which backup type to use, see Recovery Models (SQL Server) http://go.microsoft.com/fwlink/p/?LinkID=626889&clcid=0x409 in SQLServer_2nd_NoVer Books Online.

  7. 在 [備份元件]**** 區域中,按一下 [資料庫]*In the *Backup component area, click Database.

  8. 在 [名稱]**** 文字方塊中,填入提供的預設名稱,或是另外指定備份組名稱。Either use the default name that is provided or specify a name for the backup set in the **Name **text box.

  9. 在 [目的地] 區域中,指定您要儲存備份的位置。In the Destination area, specify where you want to store the backup.

  10. 按一下 [確定]**** 備份資料庫。Click OK to back up the database.

  11. 針對下列資料庫重複步驟 1-10:Repeat steps 1-10 for the following databases:

    • 搜尋管理Search Administration

    • 分析報告Analytics Reporting

    • 編目Crawl

    • 連結Link

使用 PowerShell 來繼續 Search Service 應用程式To resume the Search service application by using PowerShell

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。securityadmin fixed server role on the SQL Server instance.

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。db_owner fixed database role on all databases that are to be updated.

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。Administrators group on the server on which you are running the PowerShell cmdlets.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server cmdlets.

      注意

      如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 啟動 SharePoint 管理命令介面。Start the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元中,輸入下列命令:At the PowerShell command prompt, type the following command:

    $ssa = Get-SPEnterpriseSearchServiceApplication -Identity <SearchServiceApplicationName> Resume-SPEnterpriseSearchServiceApplication -Identity $ssa
    

    其中:Where:

    • <SearchServiceApplicationName> 是 Search Service 應用程式的名稱。<SearchServiceApplicationName> is the name of the Search service application.

另請參閱See also

概念Concepts

在 SharePoint Server 中還原搜尋服務應用程式Restore Search service applications in SharePoint Server