在 SharePoint Server 中備份 Search Service 應用程式

適用于:yes-img-132013 yes-img-16 2016yes-img-192019 yes-img-se訂閱版本 no-img-sopMicrosoft 365 中的 SharePoint

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來備份伺服器陣列中的 Search Service 應用程式。 所使用的備份工具取決於已部署的環境類型、備份排程的需要以及您組織的服務等級協定而定。

開始之前

建議您定期在伺服器陣列層級進行備份。 但是,業務或 IT 需求可能需要您備份搜尋服務及相關的資源。 定期備份搜尋系統,可減少因硬體故障、停電或其他問題時發生資料遺失的機率。 雖然這只是簡單的處理程序,但有助於在必要時可確保構成搜尋系統的資料及設定能用於復原。

開始這項作業之前,請先檢閱下列資訊:

  • 您必須在本機電腦或網路上建立儲存備份的資料夾。 若要獲得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。

  • 您無法使用 SQL Server 工具或 Data Protection Manager 來備份所有搜尋元件。

  • 備份搜尋不會影響伺服器陣列的狀態。 不過,它確實需要資源。 因此,備份搜尋可能會影響備份執行時的伺服器陣列效能。 您可以在伺服陣列使用量最低時備份搜尋,以避免發生效能問題。

備份同義字檔案

同義字檔案可用來指定出現在搜尋查詢中之單字或片語的同義字。 您可以先在 SharePoint Server 的外部系統中建立及維護同義字檔案,然後再將其匯入 SharePoint Server,以供搜尋系統使用。 這樣同義字檔案就不會包含在以下說明的 SharePoint Server 搜尋備份程序中。

若要備份同義字檔案,請確定其內含在用來建立及維護同義字檔案外部系統的備份程序中。

在 SharePoint Server 中使用 PowerShell 來備份搜尋

您可以使用 PowerShell 來手動備份搜尋,或透過可以依排程間隔執行的指令碼備份搜尋。 此程序會備份所有搜尋元件,包括資料庫、Search Service 設定及所有索引檔。

若要使用 PowerShell 來備份搜尋

  1. 確認您具備下列成員身分:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。

    • SharePoint 伺服器陣列管理員群組。

    系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server 產品 Cmdlet 的權限。

    注意事項

    [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。 如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdmin

  2. 啟動 SharePoint 管理命令介面。

  3. 在 PowerShell 命令提示字元中,輸入下列命令:

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

    其中:

    • <BackupFolder> 是您用於儲存備份檔案的資料夾路徑。

    • <SearchServiceApplicationName> 是您想還原之 Search Service 應用程式的名稱。

    注意事項

    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>。

注意事項

[!附註] 建議您在執行命令列管理工作時使用 Windows PowerShell。 Stsadm 命令列工具已過時,但為與舊版產品相容,仍會隨附提供。

在 SharePoint Server 中使用管理中心來備份搜尋

您可以使用管理中心來備份搜尋。 此程序會備份所有搜尋元件,包括資料庫、Search Service 設定及所有索引檔。

若要使用管理中心備份搜尋

  1. 確認執行此程序的使用者帳戶為 SharePoint 伺服器陣列管理員群組的成員。

  2. 啟動 [管理中心]

  3. 在管理中心首頁上,按一下 [備份與還原] 區段中的 [執行備份]

  4. 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 應用程式"。

  5. 在 [開始備份 - 步驟 2 之 2: 選取備份選項] 頁面的 [備份類型] 區段中,選取 [完整] 或 [差異]

    注意事項

    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. 在 [備份檔案位置] 區段的 [備份位置] 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]

  7. 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.

    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 或管理中心。

若要使用 SQL Server 來備份與 Search Service 應用程式相關聯的資料庫,必須遵循下列步驟:

  1. 暫停 Search Service 應用程式。

  2. 以 SQL Server 工具來備份所有 Search Service 應用程式資料庫。

  3. 繼續 Search Service 應用程式。

使用 PowerShell 來暫停 Search Service 應用程式

  1. 確認您具備下列成員身分:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。

    系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint 2016 Cmdlet 的權限。

    注意事項

    [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。 如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdmin

  2. 啟動 SharePoint 管理命令介面。

  3. 在 PowerShell 命令提示字元中,輸入下列命令:

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

    其中:

    • <SearchServiceApplicationName> 是您想還原之 Search Service 應用程式的名稱。

使用 SQL Server 工具來備份所有 Search Service 應用程式資料庫

  1. 確認執行此程序的使用者帳戶是儲存各資料庫之資料庫伺服器上的 SQL Server db_backupoperator 固定資料庫角色成員。

  2. 啟動 SQL Server Management Studio,並連線至資料庫伺服器。

  3. In Object Explorer, expand Databases.

  4. 在要備份的資料庫上按一下滑鼠右鍵,並指向 [工作],然後按一下 [備份]

  5. 在 [ 備份資料庫 ] 對話方塊中,確認資料庫名稱。

  6. 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).

  7. 在 [備份元件] 區域中,按一下 [資料庫]

  8. 在 [名稱] 文字方塊中,填入提供的預設名稱,或是另外指定備份組名稱。

  9. 在 [目的地] 區域中,指定您要儲存備份的位置。

  10. 按一下 [確定] 備份資料庫。

  11. 針對下列資料庫重複步驟 1-10:

  • 搜尋管理

  • 分析報告

  • 編目

  • 連結

使用 PowerShell 來繼續 Search Service 應用程式

  1. 確認您具備下列成員身分:
  • SQL Server 執行個體上的 securityadmin 固定伺服器角色。

  • 所有要更新之資料庫上的 db_owner 固定資料庫角色。

  • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。

    系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server Cmdlet 的權限。

    注意事項

    [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。 如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdmin

  1. 啟動 SharePoint 管理命令介面。

  2. 在 PowerShell 命令提示字元中,輸入下列命令:

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

    其中:

    • <SearchServiceApplicationName> 是 Search Service 應用程式的名稱。

另請參閱

概念

在 SharePoint Server 中還原搜尋服務應用程式