在 SharePoint Server 中刪除並還原網站集合Delete and restore site collections in SharePoint Server

摘要:如何刪除並還原 SharePoint Server 2016 和 SharePoint 2013 網站集合內容、使用者資訊及網站階層。Summary: How to delete and restore SharePoint Server 2016 and SharePoint 2013 site collection content, user information, and the site hierarchy.

如果您已建立小組網站來追蹤特定專案的進度,當該專案結束時,您可能會決定在經過一段時間後刪除該網站集合。If you've created a team site to track progress on a specific project, and the project has ended, you might decide to delete the site collection after a certain amount of time has passed.

當您刪除網站集合時,會刪除組成集合的網站階層。刪除網站集合時,還會永久移除所有的內容與使用者資訊,例如:When you delete a site collection, you are deleting the hierarchy of sites that comprise the collection. Deleting a site collection, also permanently destroys all content and user information, such as the following:

  • 文件與文件庫。Documents and document libraries.

  • 清單與清單資料,包括調查、討論、通知及活動等等。Lists and list data, including surveys, discussions, announcements, and events.

  • 網站組態設定。Site configuration settings.

  • 網站相關的角色與安全性資訊。Role and security information that is related to the website.

  • 頂層網站的子網站、其內容與使用者資訊。Subsites of the top-level website, their contents, and user information.

注意

[!附註] 刪除網站集合之前,應先進行備份。如需詳細資訊,請參閱 <在 SharePoint Server 中規劃備份和修復>。You should back up a site collection before you delete it. For more information, see Plan for backup and recovery in SharePoint Server.

若網站集合與 Project Server 服務應用程式 相關聯,就必須先移除關聯,再刪除 Project Web App 後,再刪除網站集合。您可以在 SharePoint 管理中心網站 的服務應用程式設定頁面移除與 Project Server 服務應用程式 相關聯的網站集合。If the site collection is associated with a Project Server service application, you must remove the association and delete the Project Web App before you delete the site collection. You can remove the site collection association with the Project Server service application from service application settings page in the SharePoint Central Administration website.

開始之前Before you begin

在刪除網站集合之前,請確定網站集合的備份複本及其所有內容已存在。Before you delete a site collection, ensure that a backup copy of the site collection and all of its contents exists.

SharePoint 中有兩個資源回收筒,每一個的保留時間如下所示︰There are two recycle bins in SharePoint and the retention time for each is as follows:

  • 網站資源回收筒 (第一階段) = 30 天Site Recycle Bin (First-Stage) = 30 days

  • 網站集合 (第二階段) = 50% 的網站配額Site Collection (Second Stage) = 50% of the site quota

項目的最大可能保留時間為 30 天。如果您未達到第二階段的配額限制,已刪除的項目就會在其中一個資源回收筒停留 30 天。如果項目予以刪除且位於第一階段資源回收筒,就會保留整整 30 天,因為它仍會計入您的配額。如果項目予以刪除且位於或移至第二階段資源回收筒,它就不會計入您的配額,除非它是已刪除的 SharePoint web 應用程式,但如果第二階段資源回收筒中的內容總數超過網站配額的 50%,此項目的保留時間可能就會低於 30 天。The maximum possible retention time for an item is 30 days. If you don't reach the second stage quota limit, the deleted item stays in one of the recycle bins for 30 days. If an item is deleted and resides in the first stage recycle bin, it is retained for the entire 30 days since it will still count against your quota. If an item is deleted and resides in or is moved to the second stage recycle bin, it does not count against your quota unless it's a deleted SharePoint web application, but the retention time for this item could be less than the 30 days if the total amount of content in the second stage bin exceeds the 50% of the site quota.

使用管理中心刪除網站集合Delete a site collection by using Central Administration

執行此程序之後,會永久銷毀網站集合及其所有內容與使用者資訊。After you perform this procedure, the site collection and all of its content and user information will be permanently destroyed.

使用管理中心刪除網站集合To delete a site collection by using Central Administration

  1. 確認是否具備下列系統管理認證:Verify that you have the following administrative credentials:

    • 若要刪除網站集合,執行此程序的使用者帳戶必須是 SharePoint 伺服器陣列管理員群組的成員。To delete a site collection, the user account that is performing this procedure must be a member of the Farm Administrators SharePoint group.
  2. 開啟 管理中心。Open Central Administration.

  3. 在 [管理中心] 網站上按一下 [應用程式管理]。On the Central Administration website, click Application Management.

  4. 在 [應用程式管理] 頁面上的 [網站集合] 區段中按一下 [刪除網站集合On the Application Management page, in the Site Collections section, click Delete a site collection.

  5. 在 [刪除網站集合] 頁面的 [網站集合] 清單中,按一下 [變更網站集合On the Delete Site Collection page, in the Site Collection list, click Change Site Collection.

    [選取網站集合] 網頁對話方塊會隨即顯示。The Select Site Collection webpage dialog box appears.

  6. 在 [ Web 應用程式] 清單中按一下 [變更 Web 應用程式]。In the Web Application list, click Change Web Application.

    [選取 Web 應用程式] 網頁對話方塊會隨即顯示。The Select Web Application webpage dialog box appears.

  7. 按一下包含您想要刪除的網站集合的 web 應用程式的名稱。在 [選取網站集合] 對話方塊會顯示您所選取的 web 應用程式集合的網站中的網站的相對 Url。Click the name of the web application that contains the site collection that you want to delete. Relative URLs of sites in the site collections of the web application that you have selected appear on the Select Site Collection dialog box.

  8. 按一下您要刪除的網站集合的相對 URL 並再按一下 [確定]Click the relative URL of the site collection that you want to delete, and then click OK.

  9. 閱讀 [警告] 區段,並檢查網站集合資訊是否正確。Read the Warning section and verify that the site collection information is correct.

  10. 按一下 [刪除網站集合] 頁面的 [刪除]。On the Delete Site Collection page, click Delete.

使用 Microsoft PowerShell 刪除網站集合Delete a site collection by using Microsoft PowerShell

執行此程序之後,會永久銷毀網站集合及其所有內容與使用者資訊。After you perform this procedure, the site collection and all of its content and user information will be permanently destroyed.

使用 PowerShell 刪除網站集合To delete a site collection by using PowerShell

  1. 確認您是否符合下列基本需求:Verify that you meet the following minimum requirements:

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

    • 正在執行 Microsoft PowerShell Cmdlet 之所在伺服器上的本機系統管理員群組。Local Administrators group on the server on which you are running the Microsoft PowerShell cmdlets.

  2. 開啟 SharePoint 管理命令介面。Open the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元處輸入下列命令,然後按 ENTER 鍵:At the PowerShell command prompt, type the following command, and then press ENTER:

    Remove-SPSite -Identity "<URL>" -GradualDelete
    

    位置: <URL> 是要刪除之網站集合的唯一位址。Where: <URL> is the unique address of the site collection you want to delete.

    此命令會移除指定的網站集合及所有子網站。逐步刪除會在刪除程序期間降低系統的負載。This command removes the specified site collection and all subsites. Gradual deletion reduces the load on the system during the deletion process.

    上一個程序示範如何使用 Remove-SPSite Cmdlet 來刪除網站集合。您可以指定不同的參數來設定此命令。如需詳細資訊,請參閱< Remove-SPSite>。The previous procedure illustrates a common way to use the Remove-SPSite cmdlet to delete a site collection. You can specify different parameters to configure this command differently. For more information, see Remove-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.

使用 Microsoft PowerShell 還原網站集合Restore a site collection by using Microsoft PowerShell

如果您已不小心刪除網站集合,可以使用 PowerShell 將它還原。If you've accidentally deleted a site collection, you can restore it using PowerShell.

意外刪除 SharePoint Server 中的網站集合 (亦即 SPSite 物件) 時,刪除的網站集合會儲存在 SPDeletedSite 物件中,而不是 SPSite 物件。若要還原已刪除的網站集合,您必須使用 Restore-SPDeletedSite Cmdlet 或以程式存取物件模型。When a site collection (that is, a SPSite object) is accidentally deleted in SharePoint Server, the deleted site collection is stored in the SPDeletedSite object, not the SPSite object. To restore a deleted site collection, you must use the Restore-SPDeletedSite cmdlet or programmatically access the object model.

另請參閱See also

概念Concepts

在 SharePoint Server 中建立網站集合Create a site collection in SharePoint Server

SharePoint Server 中的網站與網站集合概觀Overview of sites and site collections in SharePoint Server