在 SharePoint Server 中还原服务应用程序

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

可以使用 SharePoint 管理中心网站或 Microsoft PowerShell 在 SharePoint Server 中还原服务应用程序。 具体使用哪种备份工具,取决于已部署的环境类型、备份计划要求以及与组织达成的服务级别协议。

开始之前

在某些情况下,您可能必须还原某个特定服务应用程序,而不是还原整个服务器场。 有些服务应用程序(如 Business Data Connectivity Service 应用程序和 User Profile Service 服务应用程序)可向其他服务和网站提供数据。 这可能导致用户在恢复过程完成之前遇到一些服务中断情况。

在开始此操作之前,请查看以下有关如何还原服务应用程序的信息:

  • 不能从一个版本的 SharePoint 中备份后,再将其备份内容还原为另一个版本的 SharePoint。

  • SharePoint Server 会备份 Business Data Connectivity Service 元数据存储,这包括外部内容类型、外部系统和业务数据目录模型。 请注意,这不会备份外部数据源。 为了保护数据,必须备份外部数据源。

  • 如果您先后将服务应用程序或服务器场和数据源还原到不同的位置,则必须在外部内容类型定义中配置位置信息。 如果没有配置,Business Data Connectivity Service 可能无法找到数据源。

    注意

    [!注意] 只有在使用 FILESTREAM 提供程序将数据放入远程 BLOB 存储时,SharePoint Server 才会还原远程二进制大型对象 (BLOB) 存储。 如果使用的是其他提供程序,必须手动还原远程 BLOB 存储。

  • 您无法使用 SQL Server 工具还原整个服务应用程序。 不过,您可以还原与服务应用程序关联的数据库。

使用 PowerShell 在 SharePoint Server 中还原服务应用程序

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

使用 PowerShell 还原服务应用程序

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

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

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

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

    管理员可以使用 Add-SPShellAdmin cmdlet 授予使用 SharePoint Server cmdlet 的权限。

    注意

    [!注意] 如果您不具有这些权限,请联系您的安装管理员或 SQL Server 管理员来请求权限。

    有关 PowerShell 权限的其他信息,请参阅 Add-SPShellAdmin

  2. 启动 SharePoint 命令行管理程序。

  3. 在 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。

有关详细信息,请参阅 Restore-SPFarm

注意

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

使用管理中心在 SharePoint Server 中还原服务应用程序

使用以下过程可通过管理中心网站来还原服务应用程序。

使用管理中心还原服务应用程序

  1. 确认执行此过程的用户帐户是 SharePoint 组“服务器场管理员”的成员。

  2. 启动管理中心。

  3. 在管理中心主页上的“备份和还原”部分,单击“从备份还原”。

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

  5. 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 service application, and then click Next. To restore all the service applications, select the Shared Services Applications node.

  6. 在“从备份还原 — 步骤 3(共 3 步:选择还原选项)”页上的“ 还原组件 ”部分中,确保 “服务器场\共享服务应用程序\<服务”应用程序> 显示在 “还原以下组件” 列表中。

    In the Restore Options section, under Type of restore, select the Same configuration option. 将出现一个对话框,要求你确认操作。 单击“确定”。

    单击“开始还原”。

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

使用 SQL Server 工具还原与 SharePoint Server 中服务应用程序关联的数据库

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

使用 SQL Server 工具还原服务应用程序的数据库

  1. 验证您要用于还原数据库的用户帐户是否为存储每个数据库的数据库服务器上 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 联机丛书中的恢复模式 (SQL Server)

  9. Click OK to restore the database.

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

另请参阅

概念

在 SharePoint Server 中备份服务应用程序