Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Recover a deleted SharePoint site or site collection with the *New* Site Recycle Bin


By:   |   Read Comments   |   Related Tips: > Sharepoint

You're invited to this free live MSSQLTips webcast

The Right Database Monitoring Tools Make All the Difference
Tuesday, June 26, 2018 - click here to learn more and to register


Problem

SharePoint has never provided an easy way for Administrators to recover a deleted site, or site collection. The recycle bin, introduced in SharePoint 2007 and supported on SharePoint 2010, has only supported recovery of list and list items. If a site or site collection was accidently deleted, the only way to recover was to restore the site or site collection from a database backup.

Solution

SharePoint 2010 Service Pack 1, released in June 2011, has extended the recycle bin to allow Administrators to recover deleted sites and site collections. In this tip, we will review how to recover sites and site collections from the recycle bin on a SharePoint farm that has been upgraded with Service Pack 1.

home

For my demonstration, I have created a sample site collection that contains a single sub-site. Let's review how.

Recover a Deleted Site

The Recycle Bin capability is divided into two stages: the first-stage, referred to as the End User Recycle Bin, and a second-stage called the Site Collection Recycle Bin. Normally, when a user deletes a list or list item, the deleted item is saved to the first-stage recycle bin for a period of time, before transitioning to the second-stage recycle bin only available to site administrators.

Sub-sites that are deleted within a Site Collection are moved directly to the second-stage recycle bin, and can be found under Site Settings > Site Collection Administration > Recycle Bin.

recycle bin

Within the Site Collection Recycle Bin, administrators can view items from both the End User, and second-stage Recycle Bins. After deleting a site, it will appear in the second-stage recycle bin viewed by selecting the "Deleted from end user Recycle Bin" view.

If you delete a sub-site within a Site Collection, the sub-site can be recovered from the Site Collection Recycle Bin. The Site Collection Recycle Bin, sometimes referred to as the "2nd level" recycle bin is where items are normally moved after they have expired from the User Recycle Bin.

recycle bin

To recover the site, click the checkbox next to the site, and select "Restore Selection".

Recover a Deleted Site Collection

Unfortunately, there is no user interface for restoring deleted site collections. Managing deleted site collections requires using PowerShell. SharePoint 2010 Service Pack 1 introduces 3 new PowerShell CmdLets for managing the Recycle Bin for site collections.

  • Get-SPDeletedSite
  • Restore-SPDeletedSite
  • Remove-SPDeletedSite

The easiest way to get a list of all the deleted site collections is to just call Get-SPDeleteSite without any parameters. In the following example, for brevity, I have formatted the output as a table and filtered the columns displayed. In the second sample, I have added a wildcard filter to the command that can be used to easily filter sites based on relative paths.

deletion time

Once you have identified the site you want to restore, you call the Restore-SPDeletedSite. To restore one or more sites, it is easiest to just pipe the results from Get-SPDeletedSite. By default, the command will ask you to confirm the restore. To eliminate the confirmation, just add "Confirm:$true" to the end of the command.

deleted site
Next Steps


Last Update:


next webcast button


next tip button



About the author
MSSQLTips author Chris Beckett Chris Beckett is a Business Solutions Architect, Mentor and Trainer with 20 years of experience.

View all my tips





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools