Tuesday, February 9, 2010

How to restore only a single SharePoint Site Collection from a full SharePoint Server Farm backup

Recently someone asked me how to restore only a single site collection from a full SharePoint FARM backup.


I did a bit of testing and it really is a simple process.
Herewith a simple tutorial on how to use the stsadm command line to achieve this.


1-Create two site collections (test site A and test site B) and then perform a full farm backup.












2-You will see that a new backup folder and xml file was created.











3-Upload a document to test site A:




















4-Upload a document to test site B:























5-Open the command prompt and browse to the 12 hive folder.


6-You can now use the STSADM command line tool to inspect the structure (tree) of the  full backup.
 * Note that this will not perform a restore but rather only show you what the backup  consist of and which items can be selected for restore.

Execute the following:
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN>stsadm -o restore
-directory "C:\test sp backups" -url http://localhost:40513/ -restoremethod overwrite -showtree

You will see the backup structure and receive a note that the -showtree parameter needs to be removed before the restore can take place. below is a snippet from the results:
Restore list.

Farm\
[SharePoint_Config]\
Windows SharePoint Services Web Application\
SharePoint - 80\
WSS_Content\
SharePoint - 40513\
WSS_Content_94a95d18ddbf428592f9f8c6b4070b9c\
[WSS_Administration]\
[Web Application]\
[SharePoint_AdminContent_4a553eae-d295-4895-a261-83e8849e3deb]\

[ ] - item cannot be selected.
* - not selected to be restored.


To start the backup or restore process, run the command again omitting the -showtree option.

7-You can now run the stsadm command again, but this time change add the -item parameter and provide the full path of the site collection which you want to restore and remove the -showtree param.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN>stsadm -o restore -directory "C:\test sp backups" -item "Farm\Windows SharePoint Services Web Application\SharePoint - 40513" -url http://localhost:40513/ -restoremethod overwrite


Warning: All selected items will be overwritten. Do you want them to be overwritten (y/n)? y
 
You will be prompted for a username and password - provide site admin credentials.
 
The restore should run and you should see the results when done:
Verbose: The IIS Web Site has been extended. You may need to use iisreset.exe to restart IIS before your site becomes accessible.


Finish Time: 2/9/2010 8:08:01 PM.
Progress: Completed
Verbose: The backup/restore process included the following objects:
*Farm\
*[SharePoint_Config]\
*Windows SharePoint Services Web Application\
*SharePoint - 80\
*WSS_Content\
SharePoint - 40513\
WSS_Content_94a95d18ddbf428592f9f8c6b4070b9c\
*[WSS_Administration]\
*[Web Application]\
*[SharePoint_AdminContent_4a553eae-d295-4895-a261-83e8849e3deb]\


Completed with 0 warnings.
Completed with 0 errors.
Restore completed successfully.
-------------------------------------------------
Operation completed successfully.
 
8-When you now go back to your 2 test sites, you will see that only site B has been restored.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Please note that I did not test this on a farm which contains multiple web apps.
You also will need to SharePoint Admin account to be running.
I did not test this thoroughly so please check before you run this on a production environment !!
 
For further options and guidance please look at: http://technet.microsoft.com/en-us/library/cc262087.aspx
 
Enjoy !!!

0 comments:

Post a Comment