在 SharePoint Server 中还原 Search Service 应用程序

适用于:yes-img-132013 yes-img-162016 yes-img-192019 yes-img-seSubscription Edition no-img-sopSharePoint in Microsoft 365

可以使用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 Service 应用程序。

  2. 如有必要,请对用于创建和维护同义词库文件的外部系统使用还原过程来还原同义词库文件。

  3. 使用 Import-SPEnterpriseSearchThesaurus PowerShell cmdlet 将同义词库文件导入 SharePoint Server 搜索系统中,如部署同义词库中所述。

使用 PowerShell 还原 SharePoint Search Service 应用程序

可以使用 PowerShell 工具还原服务应用程序。

使用 PowerShell 还原 Search Service 应用程序的具体步骤

  1. 确认您具有以下成员身份:

    • SQL Server 实例上的 securityadmin 固定服务器角色。

    • 要更新的所有数据库上的 db_owner 固定数据库角色。

    • 运行 PowerShell cmdlet 的服务器上的 Administrators 组。

    • SharePoint 组“Farm Administrators”。

    管理员可以使用 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> 是服务应用程序的名称。

    • _<GUID>_ 是要使用的备份的 ID。

    若要指定要使用的备份,请使用 BackupId 参数。 可以通过键入以下内容来查看场的备份: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup。 如果未指定 , BackupId将使用最新的备份。 不能从仅配置备份还原服务应用程序。

    若要还原所有服务应用程序,请在 PowerShell 命令提示符处,键入以下命令:

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

    其中:

    • <BackupFolder> 是在其中备份服务应用程序的备份文件夹的路径。

    • _<GUID>_ 是要使用的备份的 ID。

    For more information, see Restore-SPFarm.

  5. 在您还原 Search Service 应用程序时,它会自动暂停。 完成还原工作后,若要恢复 Search Service 应用程序,请键入下列命令:

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

    其中:

    • <SearchServiceApplicationName> 是您想要恢复的服务应用程序名。

注意

[!注意] 索引文件还原为每个索引分区一个副本。 完成还原后,每个副本的索引会复制到其他索引副本中。 在此过程中,搜索拓扑可对爬网和查询充分发挥作用,但不容错。

根据服务器场和索引大小的不同,该过程可能需要花费几个小时,索引副本在 Search Administration UI 和 Get-SPEnterpriseSearchStatus Microsoft PowerShell cmdlet 的输出中会降级。

注意

[!注意] 我们建议您在执行命令行管理任务时使用 Windows PowerShell。 Stsadm 命令行工具已被弃用,仍然包含该工具是为了支持与之前产品版本的兼容性。

使用管理中心还原 SharePoint Search Service 应用程序

使用以下过程可通过 SharePoint 管理中心网站还原 Search Service 应用程序。

使用管理中心还原 Search Service 应用程序的具体步骤

  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 步:选择还原选项)”页上的“ 还原组件 ”部分,确保 “服务器场\共享服务应用程序\<服务”应用程序> 显示在 “还原以下组件” 列表中。

    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> 是您想要恢复的服务应用程序名。

注意

[!注意] 索引文件还原为每个索引分区一个副本。 完成还原后,每个副本的索引会复制到其他索引副本中。 在此过程中,搜索拓扑可完全用于爬网和查询,但并不容错。 此过程可能需要几个小时才能完成,具体视场和索引的大小而定。 在此过程中,索引副本在 Search Administration UI 和 Get-SPEnterpriseSearchStatus Microsoft PowerShell cmdlet 输出中显示为降级。

使用 SQL Server 工具还原 Search Service 应用程序的数据库

不能使用 SQL Server 工具还原整个 SharePoint Search Service 应用程序。 但是,可以使用 SQL Server 工具还原与服务应用程序关联的数据库。 若要还原整个 Search Service 应用程序,请使用 PowerShell 或管理中心。

使用 SQL Server 工具还原 Search Service 应用程序的数据库

  1. 验证您要用于还原数据库的用户帐户是否为存储每个数据库的数据库服务器上 SQL Server sysadmin 固定服务器角色的成员。

  2. 打开 SQL Server Management Studio 并连接到数据库服务器。

  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. 在“ 还原数据库 ”对话框的“常规”页上,从“ 到数据库 ”下拉列表中选择要还原到的数据库。

  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)

  9. Click OK to restore the database.

  10. 对与该服务应用程序关联的每个数据库重复步骤 1-9。

另请参阅

概念

在 SharePoint Server 中备份 Search Service 应用程序