Share via


SharePoint 2010: SP1 Site Collection Recycle Bin

SharePoint 2010 SP1 introduces 'deluxe' version of recycle bin feature both at web and site collection level. 
It's no longer necessary to deploy SharePoint Site Recycle bin from http://governance.codeplex.com/ to save site (internally it does a backup) before the deletion.

 

How to use and how it works

When a site collection is deleted it is not destroyed from content database but it is flagged as 'recyclable'. The new site collection recycle bin feature is driven off a new table SiteDeletion located in the content database and a couple of columns (InDeletion and Restorable) used to manage the status of site collection.

Just after the site collection is deleted, the flags are set to InDeleted = 0 and Restorable = 1

Unlike web recycle bin that could be managed direcly from site collection with SharePoint UI, to manage site collection recycle bin is necessary switch to Powershell.

Starting from SP1 and also into SharePoint 2013 there are three new Powershell commands:

After executing Remove-SPDeletedSite command, the site collection is still present on content database but flags on SiteDetetion table assume new value InDeletion = 0 and Restorable = 0. Site clean up is executed in async by Gradual Site Deletion timer job, that performs the physical deletion. Every web application has a dedicated timer job for clean-up activities that can be scheduled in appropriate way. The default schedule executes the job only during the night.
So when the timer job runs it changes the status of InDeletion flag to 1, then both site collection and row on SiteDeletion table are physically deleted.

Both remove and restore commands use identity parameter to identify site collection. The identity could be a GUID or server relative path of the site collection (not full path as the other commands). Personally I prefer to use GUID, of course because it does not give any chance of mistakes.

Note that site collections do not live forever in this state.  The Gradual Site Deletion timer job will mark them for physical deletion when the time for the web applications first stage recycle bin is reached (The default is 30 days).