在 SharePoint Server 中備份網站集合Back up site collections in SharePoint Server

摘要:了解如何備份 SharePoint Server 2016 和 SharePoint 2013 中的單一網站集合。Summary: Learn how to back up a single site collection in SharePoint Server 2016 and SharePoint 2013.

您可以使用 SharePoint 管理中心網站 或 Microsoft PowerShell 備份 SharePoint Server 中的網站集合。You can back up a site collection in SharePoint Server by using the SharePoint Central Administration website or Microsoft PowerShell.

開始之前Before you begin

建議您定期備份整個伺服器陣列。但從 IT 實務的角度看,您可能也需要備份網站集合。如需備份內容的詳細資訊,請參閱在 SharePoint Server 中規劃備份和修復We recommend that you regularly back up the complete farm. However, IT practices might require you to also back up a site collection. For more information about what to back up, see Plan for backup and recovery in SharePoint Server.

開始這項作業之前,請先檢閱下列資訊:Before you begin this operation, review the following information:

  • 您必須在用以儲存備份的本機電腦或網路上建立資料夾。若要取得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。如需如何建立備份資料夾的詳細資訊,請參閱在 SharePoint Server 中準備備份及還原伺服器陣列You must first create a folder on the local computer or the network in which to store the backups. For better performance, we recommend that you back up to the local computer and then move the backup files to a network folder. For more information about how to create a backup folder, see Prepare to back up and restore farms in SharePoint Server.

  • 如果網站集合的鎖定狀態設為未鎖定新增避免的內容、 SharePoint Server 暫時將 「 網站設定為唯讀時的備份作業會略微下降。SharePoint Server 執行以減少使用者變更網站集合要備份時的可能性。備份完成後,設定會變更回其正常狀態。If the site collection's Lock status is set to Not locked or Adding content prevented, SharePoint Server temporarily sets the site to Read-Only while the backup operation is occurring. SharePoint Server does this to reduce the possibilities of users changing the site collection while it is being backed up. After the backup is complete, the setting is changed back its normal status.

  • 執行網站集合備份可能會耗費些許資源,因此在備份執行期間,可能會對伺服器陣列的效能造成些微的影響。您可以利用伺服器陣列使用低峰的時間 (例如下班後) 執行備份,以避開效能的問題。Performing a site collection backup might require resources and might slightly affect farm performance when the backup is running. You can help avoid performance issues by backing up the farm during hours when farm use is lowest, such as outside office hours.

使用 PowerShell 備份 SharePoint Server 的網站集合Use PowerShell to back up a site collection in SharePoint Server

您可以使用 PowerShell 手動備份網站集合,或利用以排程間隔的指令碼執行。You can use PowerShell to back up a site collection manually or as part of a script that can be run at scheduled intervals.

使用 PowerShell 備份網站集合To back up a site collection 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 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:

    Backup-SPSite -Identity <SiteCollectionGUIDorURL> -Path <BackupFile> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
    

    其中:Where:

    • <SiteCollectionGUIDorURL> 是您要備份之網站集合的識別碼或 URL。<SiteCollectionGUIDorURL> is the ID or URL for the site collection you want to back up.

    • <BackupFile> 是備份檔案所在位置的路徑。<BackupFile> is the path to where the backup file is located.

      若要覆寫先前所使用的備份檔案,請使用 Force 參數。您可以使用 NoSiteLock 參數,不在備份進行期間,將網站集合設為唯讀。但若是使用此參數,使用者將可在備份期間變更網站集合,進而造成備份時的資料毀損。若要在 PowerShell 命令提示中顯示網站集合 GUID 或 URL,請輸入下列命令:If you want to overwrite a previously used backup file, use the Force parameter. You can use the NoSiteLock parameter to keep the read-only lock from being set on the site collection while it is being backed up. However, using this parameter can enable users to change the site collection while it is being backed up and could lead to possible data corruption during backup. To display the site collection GUID or URL at the PowerShell command prompt, type the following command:

    Get-SPSite | format-list -property id,url
    

    資料庫伺服器若是執行 SQL Server Enterprise Edition,建議您也使用 UseSqlSnapshot 參數,加強備份的一致性。您可以從這些快照匯出網站或清單。If the database server is running an Enterprise Edition of SQL Server, we recommend that you also use the UseSqlSnapshot parameter for more consistent backups. You can also export sites or lists from these snapshots.

    注意

    [!附註] 若您所使用的 RBS 提供者不支援快照,即無法使用快照進行內容部署或備份。例如 SQL FILESTREAM 提供者便不支援快照。If the RBS provider that you are using does not support snapshots, you cannot use snapshots for content deployment or backup. For example, the SQL FILESTREAM provider does not support snapshots.

    如需如何使用 SQL 快照的詳細資訊,請參閱<在 SharePoint Server 中將資料庫備份至快照>。For more information about how to use SQL snap-shots, see Back up databases to snapshots in SharePoint Server.

如需詳細資訊,請參閱<Backup-SPSite>。For more information, see Backup-SPSite.

注意

[!附註] 建議您在執行命令列管理工作時使用 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 back up a site collection in SharePoint Server

您可以使用管理中心備份網站集合。You can use Central Administration to back up a site collection.

使用 管理中心 備份網站集合To back up a site collection by using Central Administration

  1. 確認執行此程序的使用者帳戶為伺服器陣列管理員群組的成員。另外再檢查 Windows SharePoint Services Timer V4 服務是否具有備份資料夾的「完整控制」權限。Verify that the user account performing this procedure is a member of the Farm Administrators group. Additionally, verify that the Windows SharePoint Services Timer V4 service has Full Control permissions on the backup folder.

  2. 啟動 管理中心。Start Central Administration.

  3. 在管理中心內,在 [首頁] 頁面上的 [備份與還原] 區段中按一下 [執行網站集合備份In Central Administration, on the home page, in the Backup and Restore section, click Perform a site collection backup.

  4. 在 [網站集合備份] 頁面上選取的網站集合從網站集合清單。On the Site collection backup page, select the site collection from the Site Collection list.

  5. 在 [檔案名稱] 方塊中輸入備份檔案的本機路徑。Type the local path of the backup file in the Filename box.

    注意

    如果您想要重複使用檔案,選取覆寫現有檔案] 核取方塊。If you want to reuse a file, select the Overwrite existing file check box.

  6. 按一下 [開始備份]。Click Start Backup.

  7. 您可以檢視上方的 [細微備份工作狀態] 頁面上的所有備份工作的一般狀態的 [整備] 區段。您可以在頁面的 [網站集合備份] 區段中的下半部檢視目前的備份工作的狀態。[狀態] 頁面會自動更新每 30 秒。您可以按一下 [重新整理手動更新狀態的詳細資訊。備份及復原是計時器服務工作。因此,可能需要幾秒開始備份。You can view the general status of all backup jobs at the top of the Granular Backup Job Status page in the Readiness section. You can view the status for the current backup job in the lower part of the page in the Site Collection Backup 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 backup to start.

    若收到任何錯誤,可以檢閱 [細微備份工作狀態] 頁面的 [失敗訊息] 欄中。If you receive any errors, you can review them in the Failure Message column of the Granular Backup Job Status page.

另請參閱See also

概念Concepts

在 SharePoint Server 中規劃備份和修復Plan for backup and recovery in SharePoint Server

在 SharePoint Server 中還原網站集合Restore site collections in SharePoint Server