Share via


SharePoint 2010: Import – Export TermSet

Starting from the point that site collection does not backup/restore TermSets bound to managed metadata fields, it’s easy to understand that site collection backup is not enough when site collection uses that type of field.

There are some scenarios like backup site collection, working on that with day by day activities (es. Delete terms) and then restore previous backup or like backup site collection and restore on another farm, that require also the export and import of the Managed Metadata content.  

Export

To export Managed metadata content follow this step by step procedure:

  1. Open SharePoint 2010 PowerShell in Administrative mode
  2. Get the GUID of Managed Metadata SA (MMSA) executing
    Get-SPServiceApplication
  3. Get the GUID of Managed Metadata SA proxy (MMSA) executing
    Get-SPServiceApplicationProxy
  4. Update placeholders with GUID obtained in the previous command execution
    $mmsApp = "<first guid>";
    $mmsAppProxy = "<second guid> ";
    Export-SPMetadataWebServicePartitionData -Identity $mmsApp -ServiceProxy $mmsAppProxy -Path "<path\filename.bak>";

 

Import

To import Managed metadata content follow this step by step procedure:

  1. Copy export file into target farm
  2. Get the GUID of Managed Metadata SA (MMSA) executing
    Get-SPServiceApplication
  3. Get the GUID of Managed Metadata SA proxy (MMSA) executing
    Get-SPServiceApplicationProxy
  4. Update placeholders with GUID obtained in the previous command execution
    $mmsApp = "<first guid>";
    $mmsAppProxy = "<second guid> ";
    Import-SPMetadataWebServicePartitionData -Identity $mmsApp -ServiceProxy $mmsAppProxy -path "<path\filename.bak>"-OverwriteExisting;

Troubleshooting

Work around to common problems:

  • Be sure to open PowerShell command windows in Administrative mode

  • Failed to export command with error:
    Access denied

    The application pool identity of the Managed Metadata Service Application has no the right privileges to write file on the specified path. From IIS Manager you get the identity of the application pool and then give temporarily full access to that path.    

  • Failed to import command with error:
    You do not have permission to use the bulk load statement

    The application pool identity requires “bulkadmin” privilege on Sql Server. More information  here

  • Failed to import command with error:
    Import-SPMetadataWebServicePartitionData : Cannot bulk load because the file "C:\99f6833d2bac4c53af26b816afca1d55\ECMGroup.dat" could not be opened.

    To work around, instead of keeping file on Application Server, move it on SQL Server and used the network path (UNC) to the file in command. Assign read write permission to that share because PowerShell creates temporary files while importing TermStore. After this the command worked as expected and we were able to import TermStore successfully. More information here