none
Backup and Restore My Sites RRS feed

  • Question

  • Hi,

    I was hoping for a bit of clarity regarding this topic.

    As I understand it, there are two sides of MySites, the Site Collections that are created through self-service site creation for users content, and then service application that provisions the site profiles.

    For site profiles, I believe that the Farm Backup and Restore procedure in Central Administration takes care of this, and a backup and restore can be done by selecting the service application in the long list of tick boxes available in the Farm Backup options. Please correct me if I'm wrong.

    For the Site Collections, as far as I can tell, you can either back them up individually using the SharePoint native backup tool (not feasible for thousands of site collections), backup the content db using SQL backup, or Powershell. As far as I can tell, this has the limitation of only allowing you to backup and restore ALL sites collections at once, not individual site collections. Is this correct?

    If so, is there a way of backing up the site collections so that an individual site collection can be restored should it be required, without having to painstakingly backup all the site collections individually? I didn't know if there was a script for this or failing that a 3rd party tool.

    Any thoughts and input would be much appreciated.

    Friday, March 8, 2013 4:50 PM

Answers

  • Re: SQL backups, yes. When you attach the content database it attaches all the site collections in the database.

    There is no out of the box method to restore individual site collections unless you perform individual site collection backups. You can automate this with PowerShell.

    Something like this would work:

    $mysites = Get-SPSite -Webapplication "My Sites"
    $Path = "\\path\to\place\backups\"
    
    foreach ($site in $mysite) {
    
    	$filename = $($site.ServerRelativeUrl -replace "/", "_") + ".bak"
    	Backup-SPSite -Identity $site -Path $($Path + $filename)
    
    }

    This creates a site collection backup of every site collection in the My Sites Webapplication (you could customize this as necessary for your environment). Note that it replaces forward slashes ("/") in the site collection URL with underscores ("_") as you can't have the slashes in a filename.

    This is a quick and dirty script as well. You'd probably want to add outputs or set the site locks, or whatever.

    Alternatively, most third-party SharePoint backup solutions offer more granulated restore options -- with a single backup you can restore everything that an OOB backup would contain, plus you can get lower within the content -- so site collections, sites, lists, libraries, items, documents.


    Jason Warren
    Infrastructure Architect


    Friday, March 8, 2013 6:58 PM

All replies

  • Re: SQL backups, yes. When you attach the content database it attaches all the site collections in the database.

    There is no out of the box method to restore individual site collections unless you perform individual site collection backups. You can automate this with PowerShell.

    Something like this would work:

    $mysites = Get-SPSite -Webapplication "My Sites"
    $Path = "\\path\to\place\backups\"
    
    foreach ($site in $mysite) {
    
    	$filename = $($site.ServerRelativeUrl -replace "/", "_") + ".bak"
    	Backup-SPSite -Identity $site -Path $($Path + $filename)
    
    }

    This creates a site collection backup of every site collection in the My Sites Webapplication (you could customize this as necessary for your environment). Note that it replaces forward slashes ("/") in the site collection URL with underscores ("_") as you can't have the slashes in a filename.

    This is a quick and dirty script as well. You'd probably want to add outputs or set the site locks, or whatever.

    Alternatively, most third-party SharePoint backup solutions offer more granulated restore options -- with a single backup you can restore everything that an OOB backup would contain, plus you can get lower within the content -- so site collections, sites, lists, libraries, items, documents.


    Jason Warren
    Infrastructure Architect


    Friday, March 8, 2013 6:58 PM
  • We also backup content databases on daily basis which helps us to restore mysites, as and when required.

    But in SharePoint 2010 the best way to restore deleted mysites prior to 35 Days is the restore-spdeleted site command. The time required for DB restore and pulling out the mysite and restoring it back is around 2-3 hours depending on various factors. But the restore-spdeleted site command does the job in 2 seconds.You dont even have to use the site GUID just restore-spdeletedsite /sites/<mysite> does the trick. 

    We use this method if the mysite has been deleted and customer comes to us before the 35 days of deletion.

    I am sure you are aware of this but just thought of putting it here.

    Also recover point is a great tool for restoring sites.

    Monday, April 7, 2014 4:37 AM