在 SharePoint Server 中还原服务器场

适用于: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 Server 部署从一个服务器场移到另一个服务器场。

在您开始此操作之前,请查看下面有关如何在 SharePoint 中还原服务器场的信息:

  • 无法从一个版本的SharePoint Server 2019备份并还原到另一个版本的SharePoint Server 2019。 这同样适用于 SharePoint Server 2016 和 2013。

  • 备份服务器场将备份配置和管理中心内容数据库,但这些数据库无法使用 SharePoint Server工具进行还原。 有关如何备份和还原所有服务器场数据库的详细信息,请参阅在 SharePoint Server 中移动所有数据库

  • 当您使用 SharePoint Server还原服务器场时,还原过程不会自动启动所有服务应用程序。 您必须使用管理中心或 Microsoft PowerShell 手动启动它们。 请勿使用 SharePoint 产品配置向导启动这些服务,因为这将重新设置服务和服务代理。 有关详细信息,请参阅在 SharePoint Server 中启动或停止服务

  • 使用内置工具还原或重新附加数据库时,保留每个内容数据库的标识符 (ID)。 使用内置工具时的默认更改日志保留行为如下所示:

    • 还原服务器场时,保留所有数据库的更改日志。

    • 重新附加或还原数据库时,保留内容数据库的更改日志。

      当保留数据库 ID 和更改日志时,搜索系统将根据爬网规则定义的定期计划继续爬网。

      如果在还原现有数据库时,不使用 overwrite 选项,则会为还原的数据库分配一个新的 ID,并且不保留数据库更改日志。 下次对数据库爬网时,会将内容数据库中的数据添加到索引。

      如果在执行还原操作时,备份包中的 ID 已经在服务器场中使用,则会为还原的数据库分配一个新的 ID,并且会在还原日志中添加一条警告。 能否执行增量爬网(而不是完全爬网)取决于内容数据库 ID 是否与以前相同,以及搜索系统所使用的更改日志令牌对内容数据库中的当前更改日志是否有效。 如果不保留更改日志,则令牌将无效,并且搜索系统将必须执行完全爬网。

  • SharePoint Server 备份过程会备份 Business Data Connectivity Service 外部内容类型定义,但不会备份数据源本身。 为了保护数据,您应在备份 Business Data Connectivity Service 或服务器场的同时备份数据源。

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

  • 只有在使用 FILESTREAM 远程 BLOB 存储提供程序将数据放入远程 BLOB 存储区时,SharePoint Server 才会还原远程二进制大型对象 (BLOB) 存储区。

    如果使用的是其他提供程序,您必须手动还原远程 BLOB 存储区。

  • 如果您正在跨服务器场共享服务应用程序,请注意,已交换的信任证书不会包含在服务器场备份中。 您必须单独备份您的证书存储或在单独位置保存证书。 在还原共享服务应用程序的服务器场时,必须导入和重新部署证书,然后重新建立任何场间信任。

    有关详细信息,请参阅在服务器场之间交换信任证书 (SharePoint Server)

  • 在还原配置为使用基于声明的身份验证的 Web 应用程序后,通常会显示重复或额外的声明提供程序。 如果出现重复项,则必须手动保存每个 Web 应用程序区域,以移除重复项。 有关详细信息,请参阅在 SharePoint Server 中还原 Web 应用程序

  • 如果还原的服务器场包含配置为使用基于声明的身份验证的 Web 应用程序,则需要执行其他步骤。 有关详细信息,请参阅在 SharePoint Server 中还原 Web 应用程序

使用 Windows PowerShell 还原 SharePoint 中的服务器场

您可以使用 Microsoft 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> -RestoreMethod Overwrite [-BackupId <GUID>]
    

    其中:

    • <BackupFolder> 是用于存储备份文件的文件夹的路径。

    • <GUID> 是要从中进行还原的备份的标识符。

    注意

    [!注意] 如果您不以服务器场帐户的身份登录,系统会提示您提供服务器场帐户的凭据。

    如果未指定 , BackupId将使用最新的备份。 若要查看场的备份,请在 Microsoft PowerShell 命令提示符处键入以下命令:

    Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup [-Verbose]
    

    其中:

    • <BackupFolder> 是用于存储备份文件的文件夹的路径。

    不能使用纯配置备份将内容数据库与配置一起还原。

  4. 若要重新启动服务应用程序,请在 PowerShell 命令提示符处,键入以下命令:

    Start-SPServiceInstance -Identity <ServiceApplicationID>
    

    其中 <,ServiceApplicationID> 是服务应用程序的 GUID。

有关如何使用 PowerShell 重新启动服务应用程序的详细信息,请参阅 Start-SPServiceInstance

有关如何使用 PowerShell_2nd_NoVer 还原服务器场的详细信息,请参阅 Restore-SPFarm.PShell_stsadm_deprecated

使用管理中心还原服务器场

您可以使用管理中心网站还原服务器场。

使用管理中心还原服务器场

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

  2. In Central Administration, on the home page, in the Backup and Restore section, click Restore from a backup.

  3. On the Restore from Backup — Step 1 of 3: Select Backup to Restore page, from the list of backups, select the backup job that contains the farm backup, 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 Universal Naming Convention (UNC) path of the correct backup folder, and then click Refresh. You cannot use a configuration-only backup to restore the farm.

  4. 在"从备份还原 - 第 2 步(共 3 步): 选择要还原的组件"页上,选中服务器场旁边的复选框,然后单击"下一步"。

  5. 在"从备份还原 第 3 步(共 3 步): 选择还原选项"页上的"还原组件"部分,确保"服务器场"显示在"还原以下组件"列表中。

    In the Restore Only Configuration Settings section, make sure that the Restore content and configuration settings option is selected.

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

    注意

    If the Restore Only Configuration Settings section does not appear, the backup that you selected is a configuration-only backup. You must select another backup.

    Click Start Restore.

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

  7. When the restore process has completed, you may need to restart one or more service applications. In Central Administration, on the home page, in the Systems Settings section, click Manage services on server. On the Services on Server page, start any services related to service applications that you want to run by clicking Restart in the Action column next to the service application.

  8. 重新建立任何信任关系。 有关详细信息,请参阅在服务器场之间交换信任证书 (SharePoint Server)

使用 SQL Server 工具还原服务器场

虽然您无法使用 SQL Server 工具还原完整的服务器场,但您可还原大部分服务器场数据库。 如果您使用 SQL Server 工具还原数据库,则必须使用管理中心或 PowerShell还原服务器场配置。 有关如何还原服务器场的配置设置的详细信息,请参阅在 SharePoint Server 中还原服务器场配置

注意

[!注意] 搜索索引不存储在 SQL Server 中。 如果您使用 SQL Server 工具备份和还原搜索,则必须在还原内容数据库之后执行完整爬网。

在还原 SharePoint Server 之前,建议先针对网站和项目恢复配置一个恢复场。

执行下列步骤还原数据库:

  1. 如果可能,应备份当前数据库的实时事务日志,以保护自上次完整备份后所做的任何更改。

  2. 还原上一个完整数据库备份。

  3. 还原最近一次完整数据库备份后进行的最新差异数据库备份。

  4. 还原最近一次完整或差异数据库备份后进行的所有事务日志备份。

若要还原场数据库,请执行下面的过程。

使用 SQL Server 工具还原场的具体步骤

  1. 确认执行此过程的用户帐户是 sysadmin 固定服务器角色的成员。

  2. 如果 SharePoint 定时服务正在运行,请停止该服务并等待几分钟,直到任何当前正在运行的存储过程完成。 在还原所有必须还原的数据库之前,请勿重新启动该服务。

  3. 启动 SQL Server Management Studio 并连接到数据库服务器。

  4. In Object Explorer, expand Databases.

  5. Right-click the database that you want to restore, point to Tasks, point to Restore, and then click Database.

    在恢复操作过程中,数据库将自动脱机,任何其他进程均无法访问。

  6. 在“ 还原数据库 ”对话框中,指定目标和源,然后选择要还原的备份集或备份集。

    目标和源的默认值适用于大多数恢复方案。

  7. 在"选择页面"窗格中,单击"选项"。

  8. In the Restore options section, select only Overwrite the existing database. Unless your environment or policies require otherwise, do not select the other options in this section.

  9. 在"恢复状态"部分:

    • 如果已包括所有必须还原的事务日志,则选择"全部恢复"。

    • 如果必须还原其他事务日志,则选择"部分恢复"。

    • 在该方案中,不使用第三个选项"包含备用内容的恢复"。

    注意

    [!注意] 若要详细了解这些恢复选项,请参阅还原数据库("选项"页)

  10. 单击"确定"完成恢复操作。

  11. 除配置数据库外,请对要还原的每个数据库重复步骤 4 - 9。

    重要

    [!重要说明] 如果要还原用户配置文件数据库(默认情况下名为"User Profile Service_ProfileDB_<GUID>"),则还要还原社会数据库(默认情况下名为"User Profile Service_SocialDB_<GUID>")。 如果不这样做,则会导致用户配置文件数据中出现难以检测和修复的不准确情况。

  12. 若要还原配置设置,必须使用现有配置数据库或手动创建一个新数据库并将配置还原到该数据库。 有关如何还原服务器场配置的详细信息,请参阅在 SharePoint Server 中还原服务器场配置

  13. 启动 SharePoint 定时服务。

  14. Start any service applications that have to be restarted. In Central Administration, on the home page, in the Systems Settings section, click Manage services on server. On the Services on Server page, start any services related to service applications that you want to run by clicking Restart in the Action column next to the service application.

相关内容

以下列表列出了仅需还原服务器场的一部分时可以使用的其他恢复方法: