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

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

您在 SharePoint Server 中僅可以使用 PowerShell 還原網站集合。You can only restore a site collection in SharePoint Server by using PowerShell.

在 SharePoint Server 中使用 PowerShell 還原網站集合Using PowerShell to restore a site collection in SharePoint Server

您可以使用 PowerShell 手動還原網站集合,也可以使用排定間隔執行的指令碼進行還原。You can use PowerShell to restore a site collection manually or as part of a script that can be run at scheduled intervals.

使用 PowerShell 還原網站集合To restore 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:

    Restore-SPSite -Identity <SiteCollectionURL> -Path <Backup file> [-DatabaseServer <DatabaseServerName>] [-DatabaseName <ContentDatabaseName>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]
    

    其中:Where:

    • <SiteCollectionURL> 是要還原的網站集合 URL。<SiteCollectionURL> is URL for the site collection you want to restore.

    • <DatabaseServerName> 是網站集合所在的資料庫伺服器名稱。<DatabaseServerName> is name of the database server where the site collection resides.

    • <ContentDatabaseName> 是內容資料庫的名稱。<ContentDatabaseName> is the name of the content database.

      如果您要將網站集合還原至特定的內容資料庫,請使用 DatabaseServerDatabaseName 參數指定該內容資料庫。如果您不指定內容資料庫,則會將網站集合還原為 SharePoint Server 選擇的內容資料庫。If you want to restore the site collection to a specific content database, use the DatabaseServer and DatabaseName parameters to specify the content database. If you do not specify a content database, the site collection will be restored to a content database chosen by SharePoint Server.

      如果您要還原以主機命名的網站集合,請使用 Identity 參數指定以主機命名網站集合的 URL,並使用 HostHeader 參數,指定要保留主機名稱網站集合之 Web 應用程式的 URL。If you are restoring a host-named site collection, use the Identity parameter to specify the URL of the host-named site collection and use the HostHeader parameter to specify the URL of the Web application that will hold the host-named site collection.

      如果您要覆寫現有的網站集合,請使用 Force 參數。If you want to overwrite an existing site collection, use the Force parameter.

      注意

      如果您要還原的網站集合等於或大於 1 GB,您可以使用 GradualDelete 參數,以在還原程序中獲得更好的效能。如果使用此參數,覆寫的網站集合將標記為已刪除,這樣可以立即防止繼續存取其內容。然後,計時器工作會逐步而不是同時地刪除標記網站集合中的資料,這可以減少對伺服器效能的影響。If the site collection that you are restoring is 1 gigabyte or larger, you can use the GradualDelete parameter for better performance during the restore process. When this parameter is used, the site collection that is overwritten is marked as deleted, which immediately prevents any additional access to its content. The data in the marked site collection is then deleted gradually over time by a timer job instead of all at the same time, which reduces the impact on server performance.

如需詳細資訊,請參閱 Restore-SPSiteFor more information, see Restore-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.

請參閱See also

概念Concepts

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