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

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

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具還原 SharePoint Server 搜尋。 您使用的還原工具取決於已部署的環境類型、排程需求,以及您對組織所進行的服務等級協定而定。

開始之前

在某些情況下,您可能必須還原特定的服務應用程式,而不是還原整個伺服器陣列。 某些服務應用程式 (如 SharePoint Search Service 應用程式、Business Data Connectivity Service 應用程式及 User Profile Service 服務應用程式) 可對其他服務與網站提供資料。 因此,使用者可能會在完成復原程序之前,遇到一些服務中斷情況。

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

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

  • 您不能使用 SQL Server 工具還原整個服務應用程式。 不過,您可以還原與服務應用程式相關聯的資料庫。

還原同義字檔案

同義字檔案可用來針對搜尋查詢中使用的字詞或片語,指定這些字詞或片語的同義字。 將同義字檔案匯入 SharePoint Server 之前,您可以先在 SharePoint Server 以外的系統內建立和維護同義字檔案,然後將同義字檔案提供給搜尋系統使用。 因此,同義字檔案不會包含在預設的 SharePoint Server 搜尋備份程序之中,也不會包含在下方概述的搜尋還原程序之中。

還原同義字檔案

  1. 請依循下列其中一種程序還原 SharePoint Server Search 服務應用程式。

  2. 必要時,您可以使用外部系統 (您用來建立和維護同義字檔案的外部系統) 的還原程序還原同義字檔案。

  3. 使用 Import-SPEnterpriseSearchThesaurus PowerShell Cmdlet,將同義字檔案匯入到 SharePoint Server 搜尋系統,如<部署同義字字典>中所述。

使用PowerShell還原 SharePoint Search 服務應用程式

您可以使用 PowerShell 還原服務應用程式。

使用PowerShell還原 Search 服務應用程式

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

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

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

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

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

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

    注意事項

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

  2. 確定您正在還原的伺服器與建立備份的伺服器使用相同的磁碟機對應。

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

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

    Restore-SPFarm -Directory <BackupFolder> -Item "<ServiceApplicationName>" -RestoreMethod Overwrite [-BackupId <GUID>] [-Verbose]
    

    其中:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。

    • <ServiceApplicationName> 是服務應用程式的名稱。

    • <> 是要使用的備份識別碼。

    若要指定要使用的備份,請使用 BackupId 參數。 您可以輸入下列命令來檢視伺服器陣列的備份: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup 。 如果您未指定 BackupId ,則會使用最新的備份。 您無法從僅有設定的備份還原服務應用程式。

    若要還原所有服務應用程式,請在 PowerShell 命令提示字元處輸入下列命令:

    Restore-SPFarm -Directory <BackupFolder> -Item "Farm\Shared Service Applications" -RestoreMethod Overwrite [-BackupId <GUID>] [-Verbose]
    

    其中:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。

    • <> 是要使用的備份識別碼。

    如需詳細資訊,請參閱<Restore-SPFarm>。

  5. 還原 Search Service 應用程式時,系統會將之自動暫停。 若要在完成還原後恢復 Search Service 應用程式,請輸入下列命令:

    $ssa = Get-SPEnterpriseSearchServiceApplication <SearchServiceApplicationName>$ssa.ForceResume(0x02)
    

    其中:

    • <SearchServiceApplicationName> 是您要繼續之服務應用程式的名稱。

注意事項

[!附註] 索引檔案會還原到每個索引磁碟分割的一個複本。 完成還原後,會將每個複本的索引複製到其他索引複本。 在此程序期間,搜尋拓撲可針對編目和查詢完全運作,但不會容錯。

依據伺服器陣列和索引的大小,程序可能耗費數小時,而且索引複本在「搜尋管理」UI 中及 Get-SPEnterpriseSearchStatus Microsoft PowerShell Cmdlet 的輸出中會出現降級現象。

注意事項

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

使用管理中心還原 SharePoint Search Service 應用程式

請利用下列程序使用 SharePoint 管理中心網站還原搜尋服務應用程式。

使用管理中心還原 Search 服務應用程式

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

  2. 確定您正在還原的伺服器與建立備份的伺服器使用相同的磁碟機對應。

  3. 啟動管理中心。

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

  5. On the Restore from Backup — Step 1 of 3: Select Backup to Restore page, select the backup job that contains the service application backup, or a farm-level backup, from the list of backups, and then click Next. You can view more details about each backup by clicking the (+) next to the backup.

    注意事項

    If the correct backup job does not appear, in the Backup Directory Location text box, type the path of the correct backup folder, and then click Refresh. > 您無法使用僅限設定備份來還原伺服器陣列。

  6. On the Restore from Backup — Step 2 of 3: Select Component to Restore page, expand Shared Services Applications, select the check box that is next to the Search service application, and then click Next. To restore all the service applications, select the Shared Services Applications node.

  7. 在 [從備份還原 — 步驟 3 的 3:選取還原選項] 頁面的 [還原元件] 區段中,確定 [還原] 元件清單中會出現Farm\Shared Services Applications\ < Service >應用程式。

    In the Restore Options section, under Type of restore, select the Same configuration option. 隨即會出現一個對話方塊,要求您確認作業。 按一下 [確定]

    按一下 [開始還原]。

  8. You can view the general status of all recovery jobs at the top of the Backup and Restore Job Status page in the Readiness section. You can view the status for the current recovery job in the lower part of the page in the Restore 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 may take a several seconds for the recovery 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 Sprestore.log file at the UNC path that you specified in step 3.

  9. 還原 Search Service 應用程式時,系統會將之自動暫停。 若要在完成還原後恢復 Search Service 應用程式,您需要使用 PowerShell:

    確認您是執行 PowerShell Cmdlet 之伺服器上系統管理員群組的成員。

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

    注意事項

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

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

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

    $ssa = Get-SPEnterpriseSearchServiceApplication <SearchServiceApplicationName>
    $ssa.ForceResume(0x02)
    
    

    其中:

    • <SearchServiceApplicationName> 是您要繼續之服務應用程式的名稱。

注意事項

[!附註] 索引檔案會還原到每個索引磁碟分割的一個複本。 完成還原後,會將每個複本的索引複製到其他索引複本。 在此程序期間,搜尋拓撲可針對編目和查詢完全運作,但不會容錯。 依據伺服器陣列和索引的大小,程序可能耗費數小時。 而且在此程序期間,索引複本在「搜尋管理」UI 中及 Get-SPEnterpriseSearchStatus Microsoft PowerShell Cmdlet 的輸出中會出現降級現象。

使用 SQL Server 工具還原 Search Service 應用程式的資料庫

您不能使用 SQL Server 工具還原整個 SharePoint Search 服務應用程式。 不過,您可以使用 SQL Server 工具還原與服務應用程式相關聯的資料庫。 若要還原整個 Search 服務應用程式,請使用 PowerShell 或管理中心。

使用 SQL Server 工具還原 Search Service 應用程式的資料庫

  1. 確認您要用於還原資料庫的使用者帳戶是否為儲存每個資料庫之資料庫伺服器上 SQL Server sysadmin 固定伺服器角色的成員。

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

  3. 在 [物件總管] 中,展開 [資料庫]。

  4. 以滑鼠右鍵按一下要還原的資料庫,並依序指向 [工作] 及 [還原],然後按一下 [資料庫]。

  5. 在 [ 還原資料庫 ] 對話方塊的 [一般] 頁面上,從 [至資料庫] 下拉式清單中選取要還原的 資料庫

  6. 從 [從資料庫] 下拉式清單中選取還原的來源位置。

  7. 在 [選取要還原的備份集] 區域中,選取資料庫旁的核取方塊。

  8. 在 [選項] 索引標籤上,選取 [還原狀態] 區段的還原狀態。

    如需該使用何種復原類型的詳細資訊,請參閱復原模式 (SQL Server)

  9. Click OK to restore the database.

  10. 針對與服務應用程式相關聯的每個資料庫重複步驟 1-9。

另請參閱

概念

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