Restoring a deleted Project Workspace from SQL Backups
By blurg64
There was a post in the Project forums a few weeks ago from a user asking how to undelete a project workspace that had been deleted accidently. Project Server provides functionality that allows enterprise objects including projects, calendars & resource pools to be backed up and subsequently restored, but this capability does not cover project workspaces. As workspaces are stored within a SharePoint site collection, it is necessary to use SharePoint backup and restore techniques to get the workspace back.
Before we get started, it is essential that you have implemented some form of backup strategy for your Project Server instance. There are a number of excellent documents on Technet to assist including articles on performing Project Server Farm backups via SharePoint or the underlying databases. For the purposes of this post, I am going to assume you have access to a SQL backup of the content database where the project workspace sites reside, which from my experience is the most common method of backing up a Project Server / SharePoint data (but also the least flexible when it comes to restoring configuration and solutions).
1. Mount the database in SQL Server
The first step is to restore the database from the backup onto SQL Server.
Once this has completed, you should see the backup database attached as per below.
As the backup was from the same server, the security on the database should be intact and not need any modification
2. Export the site
Once the database has been mounted within SQL, it is necessary to export the data out of the database into a format that can then be imported back into SharePoint. Thankfully, 2010 introduced a fantastic new feature which allows you to navigate a content database to find the exact site or list you wish to export. Via Central Administration, choose the option ‘Recover data from an unattached content database’.
You will be prompted for the database server and name to view and given a list of options including browsing, backing up a site collection or exporting a site or list. In our case, we are interested in exporting a site.
Next up, navigate through the content database, to find the correct site collection and site we want to restore, in this case the site Acquisition Target Analysis. In addition, we need to supply a file name for the site export and advise SharePoint that we want to export the security and all versions in addition.
Once you click on Start Export, the screen will change to show a job status screen where the status of the export can be viewed.
Once the export has been completed, two files will be created the .cmp file that contains the site export and a .export.log file that provides a log of the export process.
3. Import the Site
The final stage in the process is to import the site back into SharePoint, using the Import-SPWeb PowerShell command. Unfortunately Import-SPWeb expects the site that the import is going to be performed on to exist, which isn’t going to be the case for our previously deleted site, so we need to create a new empty site based on the template. There are two ways to do this, either via the New-SPWeb PowerShell command or to create a new site via Site Actions > New Site > Microsoft Project Site option.
Once the blank site has been created, the site content can finally be imported by running the Import-SPWeb PowerShell command restoring the site back to it’s pre deleted glory with the following parameters:
[sourcecode]
Import-SPWeb SiteName –Path
[/sourcecode]
You can of course find out more about Import-SPWeb PowerShell command by typing the following into the SharePoint 2010 Management Shell:
[sourcecode]
Get-help Import-SPWeb –full
[/sourcecode]
The last step is to check the site import has worked successfully by reviewing the import.log file and navigating to the site itself and having a look around.
Now of course the most simplest way to restore an accidently deleted site is to stop them getting deleted in the first place, so if this is a problem at your organisation, make sure you spend some time educating your users, or perhaps looking in to implementing a third party site level recycle bin such as the one at http://code.msdn.microsoft.com/RecycleBin.