If you want to include a seamless exporting/importing of the Metadata you’ve produced when backing up and restoring of a SharePoint 2010 site, it is a two step process for each. First, you need to backup the site collection. Then you need to separately backup the Metadata. Naturally, you must import the data on the other server, AND separately import the metadata. In this tutorial, I am going to keep the backup and restore of each section (site and metadata) together.

Site Backup:

  • In Central Administration, in the Backup and Restore section, choose ‘Perform a site collection backup’.
  • Choose your Site Collection and give it a filename (with a .bak extension).
  • Then click the ‘Start Backup’ button.

Site Restore:

  • Go to the server where the restore is to be made, and run SharePoint Powershell ‘as Administrator’
  • Run this PowerShell command:
  • Restore-SPSite -Identity -Path
  • (To get a list of other command parameters for this command, use Restore-SPSite -?)

That seemed pretty easy, didn’t it? Well hold on, exporting and importing the metadata is a little bit trickier. If you go to the term store at this point, it may look like it’s all there, but it may be a bit disassociated from the content.

Backup the metadata, go to the original server:

  1. Run this PowerShell Command:
  2. Highlight and copy the ID of Managed Metadata Application
  3. Once it’s copied to the clipboard, assign it to a variable:
    $mmsApp = “949792b5-aa9b-40e0-9b8f-7efa46b33ea6"
  4. (your id will be different than this one)

  5. Go to Central Administration/Application Management/Service Applications/Manage Service Application. Look at the type of your appliction. If you have not changed it, it will be ‘Managed Metadata Service Connection’.
  6. Using that type, in PowerShell, use this command to get the Application Proxy via the Type Name and set it to a variable:
    $mmsproxy = Get-SPServiceApplicationProxy | 
    ?{$_.TypeName -eq "Managed Metadata Service Connection"};
  7. Type in the command ‘$mmsproxy’ to see if you return a Displayname, Typename and ID. If not, check the spellings of the command and the Proxy name
  8. Run this PowerShell command:
    Export-SPMetadataWebServicePartitionData -Identity $mmsApp -ServiceProxy 
    $mmsproxy -Path c:\YourExportName.bak;

Restoring the Metadata:

  • Very Important: Create a share on the database server for the target SharePoint site.
  • Copy the exported file to that share
  • Remote in to the Web Front End Server where you want to import the metadata.
  • Run steps 1-5 above
  • Run this PowerShell Command:
    Import-SPMetadataWebServicePartitionData -Identity $mmsApp 
    -ServiceProxy $mmsproxy 
    -path \\YourDBShare\YourExportName.bak -OverwriteExisting;

At this point, your import is done. All you really need to do is to check it to see that everything is correct.