Backup-SPSite

执行网站集的备份。

语法

Backup-SPSite
      [-Identity] <SPSitePipeBind>
      -Path <String>
      [-AssignmentCollection <SPAssignmentCollection>]
      [-Confirm]
      [-Force]
      [-NoSiteLock]
      [-UseSqlSnapshot]
      [-WhatIf]
      [-UseABSDocStreamInfo]
      [<CommonParameters>]

说明

使用 Identity 参数时,Backup-SPSite cmdlet 执行网站集的备份。

By default, the site collection will be set to read-only for the duration of the backup to reduce the potential for user activity during the backup operation to corrupt the backup. If you have SQL Server Enterprise Edition, we recommend that UseSqlSnapshot parameter be used because this ensures a valid backup while it allows users to continue reading and writing to the site collection during the backup.

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

-------------------示例 1--------------------

Backup-SPSite https://server_name/sites/site_name -Path C:\Backup\site_name.bak

本示例将网站集 https://server_name/sites/site_name 备份到 C:\Backup\site_name.bak 文件。

-------------------示例 2--------------------

Get-SPSiteAdministration https://server_name/sites/site_name | Backup-SPSite -Path C:\Backup\site_name.bak

本示例将网站集 https://server_name/sites/site_name 备份到 C:\Backup\site_name.bak 文件。 结果与示例 1 相同,但是执行操作的方法不同。

-------------------示例 3--------------------

Backup-SPSite https://server_name/sites/site_name -Path C:\Backup\site_name.bak -UseSqlSnapshot

此示例使用数据库快照备份网站集,以确保备份完整性。

-------------------EXAMPLE 4--------------------

Backup-SPSite https://server_name/sites/site_name -Path C:\Backup\site_name.bak -NoSiteLock

本示例备份网站集,并防止在备份阶段将网站置于只读模式。 在生产环境中备份站点时,请使用 -NoSiteLock 参数,在进行备份时,最好不要将站点置于只读模式。

参数

-Confirm

执行命令前,看到确认提示。 有关详细信息,请键入以下命令:get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Force

指定覆盖现有备份文件(如果备份文件已经存在)。

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

指定要备份的网站集的 URL 或 GUID。

例如,有效的 URL,如 https://server_name/sites/site_name,或者 GUID,如"01234567-89ab-cdef-0123-456789abcdef"

Type:SPSitePipeBind
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-NoSiteLock

指定备份期间要保持可读写的网站集。

如果未指定 NoSiteLock 参数,则在执行网站集备份时,具有网站集锁设置为“none”或“无添加”的网站集将暂时设置为“只读”。 备份完成后,网站集锁定将恢复为其原始状态。 备份包将记录原始网站集锁定状态,以便还原为该状态。

如果在备份网站集时,有用户正在写入网站集,那么建议不要使用 NoSiteLock 参数,以防对备份完整性造成可能影响

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Path

指定备份文件的完整路径(即 C:\Backup\site_name.bak)。

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-UseABSDocStreamInfo

请勿使用。

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-UseSqlSnapshot

Specifies a SQL Database Snapshot will be created when the backup begins, and all site collection data will be retrieved directly from the database snapshot. This snapshot will be deleted automatically when the backup completes

The UseSqlSnapshot parameter is recommended if the database server hosting your content database supports database snapshots such as SQL Server Enterprise Edition and SQL Server Developer Edition. This is because it will ensure a valid backup while allowing users to continue reading and writing to the site collection during the backup. It is not necessary to specify the NoSiteLock parameter when specifying the UseSqlSnapshot parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-WhatIf

显示一条描述命令作用的消息,而不执行命令。 有关详细信息,请键入以下命令:get-help about_commonparameters

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-工作分配

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition