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

摘要:了解如何還原 SharePoint Server 2016 和 SharePoint Server 2013的 Search Service 應用程式。Summary: Learn how to restore the Search service application in SharePoint Server 2016 and SharePoint Server 2013.

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具還原 SharePoint Server 搜尋。您使用的還原工具取決於已部署的環境類型、排程需求,以及您對組織所進行的服務等級協定而定。You can restore SharePoint Server search by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. The restore tool that you use depends on the kind of environment that you have deployed, your schedule requirements, and service level agreements that you have made with your organization.

開始之前Before you begin

在某些情況下,您可能必須還原特定的服務應用程式,而不是還原整個伺服器陣列。某些服務應用程式 (如 SharePoint Search Service 應用程式、Business Data Connectivity Service 應用程式及 User Profile Service 服務應用程式) 可對其他服務與網站提供資料。因此,使用者可能會在完成復原程序之前,遇到一些服務中斷情況。There are situations in which you might have to restore a specific service application instead of restoring the complete farm. Some service applications — for example, the SharePoint Search service application, Business Data Connectivity service application, and the User Profile Service service application — provide data to other services and sites. As a result, users might experience some service interruption until the recovery process is completed.

開始此操作前,請先檢閱下列資訊:Before you begin this operation, review the following information:

  • 備份和還原搜尋並不會影響伺服器陣列的狀態,但它確實需要資源。因此,備份和還原搜尋可能會影響備份執行時的伺服器陣列效能。您可以在伺服器陣列使用量最低的期間備份搜尋,以避免發生效能問題。Backing up and restoring search does not affect the state of the farm. However, it does require resources. Therefore, backup and restore for 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.

  • 您無法使用 SQL Server 工具來還原整個服務應用程式,但可以還原與服務應用程式相關聯的資料庫。You cannot restore the complete service application by using SQL Server tools. However, you can restore the databases that are associated with the service application.

還原同義字檔案Restore 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 default SharePoint Server search backup procedures, and also not in the search recovery procedures outlined below.

還原同義字檔案To restore a thesaurus file

  1. 請依循下列其中一種程序還原 SharePoint Server Search 服務應用程式。Follow one of the procedures below to restore the SharePoint Server Search service application.

  2. 必要時,您可以使用外部系統 (您用來建立和維護同義字檔案的外部系統) 的還原程序還原同義字檔案。If necessary, restore the thesaurus file using the restore procedures for the external system you are using to create and maintain thesaurus files.

  3. 使用 Import-SPEnterpriseSearchThesaurus PowerShell Cmdlet,將同義字檔案匯入到 SharePoint Server 搜尋系統,如<部署同義字字典>中所述。Import the thesaurus file to the SharePoint Server search system by using the Import-SPEnterpriseSearchThesaurus PowerShell cmdlet as described in Deploy a thesaurus.

使用PowerShell還原 SharePoint Search 服務應用程式Use PowerShell to restore a SharePoint Search service application

您可以使用 PowerShell 還原服務應用程式。You can use PowerShell to restore a service application.

使用PowerShell還原 Search 服務應用程式To restore a 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.

    • 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 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. 確定您正在還原的伺服器與建立備份的伺服器使用相同的磁碟機對應。Make sure that the server you are restoring to use the same drive mapping as the server where you created the backup.

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

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

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

    其中:Where:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。<BackupFolder> is the path for the backup folder where the service application was backed up.

    • <ServiceApplicationName> 是服務應用程式的名稱。<ServiceApplicationName> is the name the service application.

    • <GUID>_is 要使用的備份識別碼。<GUID>_is the ID of the backup to use.

      若要指定所使用的備份,請使用 BackupId 參數。您可以輸入下列命令檢視伺服器陣列的備份: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup。如果未指定 BackupId,則會使用最近一次的備份。您無法從僅有設定的備份還原服務應用程式。To specify which backup to use, use the BackupId parameter. You can view the backups for the farm by typing the following: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup. If you do not specify the BackupId, the most recent backup will be used. You cannot restore a service application from a configuration-only backup.

      若要還原所有服務應用程式,請在 PowerShell 命令提示字元處,輸入下列命令:To restore all the service applications, at the PowerShell command prompt, type the following command:

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

    其中:Where:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。<BackupFolder> is the path for the backup folder where the service application was backed up.

    • <GUID>_is 要使用的備份識別碼。<GUID>_is the ID of the backup to use.

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

  5. 還原 Search Service 應用程式時,系統會將之自動暫停。若要在完成還原後恢復 Search Service 應用程式,請輸入下列命令:When you restore a Search service application, it is automatically paused. To resume the Search service application when the restore has completed, type the following command:

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

    其中:Where:

    • <SearchServiceApplicationName> 是您要繼續之服務應用程式的名稱。<SearchServiceApplicationName> is the name the service application you want to resume.

注意

[!附註] 索引檔案會還原到每個索引磁碟分割的一個複本。完成還原後,會將每個複本的索引複製到其他索引複本。在此程序期間,搜尋拓撲可針對編目和查詢完全運作,但不會容錯。Index files are restored to one replica per index partition. After the restore has completed, the index for each replica is replicated to the other index replicas. During this process the search topology is fully functional for crawling and queries, but is not fault tolerant.

依據伺服器陣列和索引的大小,程序可能耗費數小時,而且索引複本在「搜尋管理」UI 中及 Get-SPEnterpriseSearchStatus Microsoft PowerShell Cmdlet 的輸出中會出現降級現象。Depending on the size of the farm and the index, the process can take several hours and the index replicas appear as degraded in the Search Administration UI and in the output of the Get-SPEnterpriseSearchStatus Microsoft PowerShell cmdlet.

注意

[!附註] 建議您在執行命令列管理工作時使用 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 Search Service 應用程式Use Central Administration to restore a SharePoint Search service application

請利用下列程序使用 SharePoint 管理中心網站還原搜尋服務應用程式。Use the following procedure to restore a search service application by using the SharePoint Central Administration website.

使用管理中心還原 Search 服務應用程式To restore a Search service application 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. 確定您正在還原的伺服器與建立備份的伺服器使用相同的磁碟機對應。Make sure that the server you are restoring to use the same drive mapping as the server where you created the backup.

  3. 啟動管理中心。Start Central Administration.

  4. 在 管理中心首頁的 [備份與還原] 區段中,按一下 [從備份還原]。In Central Administration, on the home page, in the Backup and Restore section, click Restore from a backup.

  5. 從 [從備份還原 - 步驟 3 之 1: 選取要還原的備份] 頁面的備份清單中,選取包含搜尋服務應用程式備份,或伺服器陣列層級的備份工作,然後按 [下一步]。只要按一下備份旁的 (+),即可檢視每項備份的詳細資訊。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. > You cannot use a configuration-only backup to restore the farm.

  6. 在 [從備份還原 - 步驟 3 之 2: 選取要還原的元件] 頁面上,展開 [共用服務應用程式],選取 Search 服務應用程式旁的核取方塊,然後按 [下一步]。若要還原所有服務應用程式,請選取 [共用服務應用程式] 節點。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 服務應用程式\< 服務應用程式>會出現在還原下列元件清單。On the Restore from Backup — Step 3 of 3: Select Restore Options page, in the Restore Component section, make sure that Farm\Shared Services Applications\<Service application> appears in the Restore the following component list.

    在 [還原選項] 區段的 [還原的類型] 下,選取 [相同的設定] 選項。對話方塊會隨即出現,請您確認該作業。按一下 [確定]。In the Restore Options section, under Type of restore, select the Same configuration option. A dialog box will appear that asks you to confirm the operation. Click OK.

    按一下 [開始還原]。Click Start Restore.

  8. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備] 區段中,檢視所有復原工作的一般狀態。在同頁面底部的 [還原] 區段中,則可檢視目前復原工作的狀態。狀態頁面每 30 秒會自動更新。只要按一下 [重新整理],即可手動更新狀態詳細資料。備份與復原都是計時器服務工作。因此,復原要數秒後才會開始。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.

    如有收到錯誤,可以檢閱 [備份與還原工作狀態] 頁面的 [失敗訊息] 欄。您也可以在步驟 3 中所指定之 UNC 路徑下的 Sprestore.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 Sprestore.log file at the UNC path that you specified in step 3.

  9. 還原 Search Service 應用程式時,系統會將之自動暫停。若要在完成還原後恢復 Search Service 應用程式,您需要使用 PowerShell:When you restore a Search service application, it is automatically paused. To resume the Search service application when the restore has completed you need to use PowerShell:

    確認您是執行 PowerShell Cmdlet 之伺服器上系統管理員群組的成員。Verify that you are a member of the 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.

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

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

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

    其中:Where:

    • <SearchServiceApplicationName> 是您要繼續之服務應用程式的名稱。<SearchServiceApplicationName> is the name the service application you want to resume.

注意

[!附註] 索引檔案會還原到每個索引磁碟分割的一個複本。完成還原後,會將每個複本的索引複製到其他索引複本。在此程序期間,搜尋拓撲可針對編目和查詢完全運作,但不會容錯。依據伺服器陣列和索引的大小,程序可能耗費數小時。而且在此程序期間,索引複本在「搜尋管理」UI 中及 Get-SPEnterpriseSearchStatus Microsoft PowerShell Cmdlet 的輸出中會出現降級現象。Index files are restored to one replica per index partition. After the restore has completed, the index for each replica is replicated to the other index replicas. During this process the search topology is fully functional for crawling and queries, but is not fault tolerant. Depending on the size of the farm and the index, the process can take several hours. The index replicas appear as degraded in the Search Administration UI and in the output of the Get-SPEnterpriseSearchStatus Microsoft PowerShell cmdlet during the process.

使用 SQL Server 工具還原 Search 服務應用程式的資料庫Use SQL Server tools to restore the databases for a Search service application

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

使用 SQL Server 工具還原 Search 服務應用程式的資料庫To restore the databases for a Search service application by using SQL Server tools

  1. 確認您要用於還原資料庫的使用者帳戶是否為儲存每個資料庫之資料庫伺服器上 SQL Server sysadmin 固定伺服器角色的成員。Verify that the user account that you are using to restore the databases is a member of the SQL Server sysadmin fixed server role on the database server where each database is stored.

  2. 開啟 SQL Server Management Studio 並連線至資料庫伺服器。Open 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 restore, point to Tasks, point to Restore, and then click Database.

  5. 在 [還原資料庫] 對話方塊中的 [一般] 頁面上,從 [目的地資料庫] 下拉式清單中選取還原的目的地資料庫。In the Restore Database dialog box, on the General page, select the database to restore to from the To database drop-down list.

  6. 從 [從資料庫] 下拉式清單中選取還原的來源位置。Select the restore source from the From database drop-down list.

  7. 在 [選取要還原的備份集] 區域中,選取資料庫旁的核取方塊。In the Select the backup sets to restore section area, select the check box next to the database.

  8. 在 [選項] 索引標籤上,選取 [還原狀態] 區段的還原狀態。On the Options tab, select the recovery state from the Recover state section.

    如需該使用何種復原類型的詳細資訊,請參閱復原模式 (SQL Server)For more information about which recovery type to use, see Recovery Models (SQL Server) .

  9. 按一下 [確定] 還原資料庫。Click OK to restore the database.

  10. 針對與服務應用程式相關聯的每個資料庫重複步驟 1-9。Repeat steps 1-9 for each database that is associated with the service application.

另請參閱See also

概念Concepts

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