在 SharePoint Server 中导出网站、列表或文档库Export sites, lists, or document libraries in SharePoint Server

适用于:是2013 是2016 是2019 没有SharePoint OnlineAPPLIES TO: yes2013 yes2016 yes2019 noSharePoint Online

可以使用 SharePoint 管理中心网站或 Microsoft PowerShell 在 SharePoint Server 中导出网站、列表或文档库。具体使用哪种备份工具,取决于已部署的环境类型、备份计划要求以及与组织达成的服务级别协议。You can export a site, list, or document library in SharePoint Server by using the SharePoint Central Administration website or Microsoft PowerShell. The backup tool that you use depends on the kind of environment that you have deployed, your backup schedule requirements, and service level agreements that you have made with your organization.

开始之前Before you begin

我们建议您定期备份整个服务器场。但是,您的业务要求或 IT 要求可能会要求您导出网站、列表或文档库。定期导出网站、列表和文档库将可减小因硬件故障、断电或其他问题而导致的数据损失。这一过程非常简单,并且有助于确保数据在必要时可用于恢复。一次只能导出一个网站、列表或文档库。We recommend that you regularly back up the complete farm. However, business or IT requirements might require you to export a site, list, or document library. Regularly exporting sites, lists, and document libraries reduces data losses that might occur from hardware failures, power outages, or other problems. It is a simple process and helps make sure that data is available for recovery, if that is required. You can only export one site, list, or document library at a time.

有关要备份的内容和要使用的工具的信息,请参阅在 SharePoint Server 中规划备份和恢复For information about what to back up and which tools to use, see Plan for backup and recovery in SharePoint Server.

在开始此操作之前,请查看有关先决条件的以下信息:Before you begin this operation, review the following information about prerequisites:

  • 在开始之前,必须在本地计算机或网络上创建一个用于存储导出文件的文件夹。为了提高性能,我们建议您先导出到本地计算机,然后再将导出文件移到网络文件夹。Before you begin, you must create a folder on the local computer or the network in which to store the export file. For better performance, we recommend that you export to the local computer and then move the export file to a network folder.

  • 您无法使用 SQL Server 工具或 Data Protection Manager 导出网站、列表或文档库。You cannot use SQL Server tools or Data Protection Manager to export a site, list or document library.

使用 PowerShell 在 SharePoint Server 中导出网站、列表或文档库Use PowerShell to export a site, list, or document library in SharePoint Server

可以使用 PowerShell 以手动方式或作为可定期运行的脚本的一部分导出网站、列表或文档库。You can use PowerShell to export a site, list, or document library manually or as part of a script that can be run at scheduled intervals.

使用 PowerShell 导出网站、列表或文档库的具体步骤To export a site, list or document library 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 组。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.

  2. 启动 SharePoint 命令行管理程序。Start the SharePoint Management Shell.

  3. 在 PowerShell 命令提示符处,键入以下命令:At the PowerShell command prompt, type the following command:

    Export-SPWeb -Identity <SiteURL> -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose]
    

    其中:Where:

    • <SiteURL> 是要导出的网站、列表或库的 URL。<SiteURL> is URL for the site, list, or library that you are exporting.

    • <Path and FileName> 是要导出的网站、列表或库的路径和名称。<Path and FileName> is path and name for the site, list, or library that you are exporting.

    • <URL of Site, List, or Library> 是要在其中导出的网站、列表或库的 URL。<URL of Site, List, or Library> is the URL for the site, list, or library where you are exporting.

    如果要导出大的网站、列表或文档库,则可以使用 GradualDelete 参数。如果使用了此参数,网站集将被标为已删除,这样可以立即阻止继续访问其内容。然后,此计时器作业将随着时间推移逐渐(而不是一次性)删除此已删除网站集中的数据,这可以减少它对场服务器和 SQL Server 性能的影响。If you are exporting a large site, list, or document library, you can use the GradualDelete parameter. When this parameter is used, the site collection is marked as deleted, which immediately prevents any further access to its content. The data in the deleted site collection is then deleted gradually over time by a timer job instead of at one time, which reduces its effect on the performance of farm servers and SQL Server.

    若要指定要包含的网站、列表或文档库的版本,请使用 IncludeVersions 参数并指定"LastMajor"(默认值)、"CurrentVersion"、"LastMajorandMinor"或"All"。若要使列表或文档库包含用户安全设置,请使用 IncludeUserSecurity 参数。如果要覆盖指定的文件,请使用 Force 参数。若要查看备份操作的进度,请使用 Verbose 参数。To specify which version of the site, list, or document library to include, use the IncludeVersions parameter and specify "LastMajor" (default), "CurrentVersion", "LastMajorandMinor", or "All". To include the user security settings with the list or document library, use the IncludeUserSecurity parameter. If you want to overwrite the file that you specified, use the Force parameter. To view the progress of the backup operation, use the Verbose parameter.

    通过使用 NoFileCompression 参数,可以指定在导出过程中不执行文件压缩。使用此参数可以在导出过程中将资源使用率最多降低 30%。如果使用此参数,则会创建备份文件夹,而不是创建压缩文件。如果在 NoFileCompression 命令中使用 Export-SPWeb 参数,则在使用 Import-SPWeb 命令导入内容时也必须使用该参数。The NoFileCompression parameter lets you specify that no file compression is performed during the export process. Using this parameter can lower resource usage up to 30% during the export process. Using this parameter will result in a backup folder being created instead of a compressed file. If you use the NoFileCompression parameter in the Export-SPWeb command, you must also use it when you import the content by using the Import-SPWeb command.

有关详细信息,请参阅 Export-SPWebFor more information, see Export-SPWeb.

备注

[!注意] 我们建议您在执行命令行管理任务时使用 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 Server 中的网站、列表或文档库Use Central Administration to export a site, list, or document library in SharePoint Server

您可以使用管理中心导出网站、列表或文档库。一次只能导出一个网站、列表或文档库。You can use Central Administration to export a site, list, or document library. You can only export one site, list, or document library at a time.

使用管理中心导出网站、列表或文档库To export a site, list, or document library by using Central Administration

  1. 确认执行此过程的用户帐户是 服务器场管理员 组的成员。Verify that the user account that is performing this procedure is a member of the Farm Administrators group.

  2. 启动管理中心。Start Central Administration.

  3. 在管理中心的主页上,单击“备份和还原”****。In Central Administration, on the home page, click Backup and Restore.

  4. 在"备份和还原"页上的"粒度备份"部分,单击"导出网站或列表"。On the Backup and Restore page, in the Granular Backup section, click Export a site or list.

  5. 在"网站或列表导出"页上的"网站集"部分,从"网站集"列表中选择网站集,然后从"网站"列表中选择网站。On the Site or List Export page, in the Site Collection section, select the site collection from the Site Collection list, and then select the site from the Site list.

  6. 如果正在导出网站,请跳过此步骤,并从"列表"列表中选择列表或文档库。If you are exporting a site, skip this step, Select the list or document library from the List list.

  7. 在“文件位置”**** 部分的“文件名”**** 框中,键入要将列表或文档库导出到的共享文件夹和文件的 UNC 路径。文件名必须使用 .cmp 扩展名。In the File Location section, in the Filename box, type the UNC path of the shared folder and the file to which you want to export the list or document library. The file name must use the .cmp extension.

  8. 如果文件已存在并且您要使用此文件,请选中“覆盖现有文件”**** 复选框。否则请指定其他文件名。If the file already exists and you want to use this file, select the Overwrite existing files check box. Otherwise, specify a different file name.

  9. 如果要随列表或库一起导出所有安全和权限设置,请在"导出完整安全模式"部分选中"导出完整安全模式"复选框。If you want to export all the security and permissions settings with the list or library, in the Export Full Security section, select the Export full security check box.

  10. 如果要指定要导出的列表或库的版本,请从"导出版本"列表中选择以下版本之一:If you want to specify which version of the list or library to export, select one of the following versions from the Export versions list:

    • 所有版本All Versions

    • 上一个主要版本Last Major

    • 当前版本Current Version

    • 上一个主要版本和上一个次要版本Last Major and Last Minor

  11. 指定了所需的设置后,单击“开始导出”****。When you have specified the settings that you want, click Start Export.

  12. 您可以在"粒度备份作业状态"页的顶部查看所有备份作业的状态。可以在该页的"内容导出"部分查看当前备份作业的状态。状态页每 30 秒自动更新一次。可以单击"刷新"手动更新状态详细信息。备份和恢复是定时服务作业。因此,可能要等待几秒才会开始备份。You can view the status of all backup jobs at the top of the Granular Backup Job Status page. You can view the status of the current backup job in the Content Export section of the page. 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 backup to start.

    If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page.If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page. 您还可以在您在步骤 6 <中指定的.UNC 路径上的文件名>export .log 文件中找到更多详细信息。You can also find more details in the <file name>.export.log file at the UNC path that you specified in step 6.

另请参阅See also

概念Concepts

在 SharePoint Server 中规划备份和恢复Plan for backup and recovery in SharePoint Server

其他资源Other Resources

Use Windows PowerShell to administer SharePoint ServerUse Windows PowerShell to administer SharePoint Server