Monday, May 27, 2013

Migrate/Export Managed Metadata Service Application data from one SharePoint farm to another.

The managed metadata service application makes it possible to:
·         Use managed metadata.
·         Share content types across site collections and Web applications.
A managed metadata service publishes a term store and, optionally, content types; a managed metadata connection consumes these.
The whole migration process is categorized into two category as mentioned below...
·      Export the Metadata Term store from the source farm
·      Import the exported term store backup taken from source farm into target farm.

1      Exporting Metadata Term Store from Source Farm

Note-: Below script should be run from the source farm from where you would like to take backup.
·         Login to the source server.
·         Create a folder MMSABackup on D drive.
·         Share this folder and provide full permission to farm account, Service account under which Managed metadata service runs.
·         Copy the below script to notepad and save it as ExportMMSA.ps1 in above created folder.
$mmsaSource = Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsaProxySource = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq "Managed Metadata Service Connection"}
Export-SPMetadataWebServicePartitionData $mmsaSource.Id -ServiceProxy $mmsaProxySource -Path "\\segotn10187\MMSABackup\mms10187data.cab"

·         In above script change server name in the path attribute. Also you can change the cab file name to something to match the server.
·         Path attribute accepts UNC path.
·         Open SharePoint 2010 Management Shell window.
·         Execute the script.

·         After few seconds Metadata term store data would be backed up in the form of cab file.

1      Importing Metadata Term Store data into target farm

1.1    Prerequisites for import
Following tasks should be performed prior to execution of import script to import the Metadata term store data.
·         Make sure the service account running Managed Metadata Service application is part of Metadata Service admin group.
·         To verify above click on the administrator ribbon as shown in screenshot below in red color box.

·         Make sure Metadata service account and farm account has full permissions to Metadata service application.
·         To verify click on the permission ribbon circled in red color in screenshot below...


·         Provide BulkAdmin Role to Metadata Service Account and farm account on Metadata database (on SQL box).
·         Create a shared folder named ”mmsabackup” on D drive of SQL Server box.
·         Copy the cab file exported in the source farm.
·         Paste it in the shared folder we have created on the sql box.
·         Give full permissions to farm account and Metadata service account on the above created shared folder on SQL box.
·         Make sure this shared folder is accessible from SharePoint server where will be executing the import script.
·         Login the the target SharePoint farm and create a folder named mmsabackup on drive.
·         Open notepad.
·         Copy and paste the below script into notepad.

$mmsaTarget = Get-SPServiceApplication | ? {$_.TypeName –eq “Managed Metadata Service”}
$mmsaProxyTarget = Get-SPServiceApplicationProxy | ? {$_.TypeName –eq “Managed Metadata Service Connection”}
Import-SPMetadataWebServicePartitionData $mmsaTarget.Id –ServiceProxy $mmsaProxyTarget –Path "\\segotn2411\MMSBackup\mms10187data.cab” –OverwriteExisting

·         In the above script change the value of Path attribute to point to the Shared folder we have created on SQL box and where the cab/backup file is placed.
·         Open SharePoint 2010 Management Shell window.
·         Execute the script.
·         After few seconds Metadata term store data would be restored in the target farm as shown in the screenshot below.

·         To verify this open central administrationàApplication ManagementàManage Service Applications.
·         Select/Highlight Managed Metadata Service Application and click on Manage ribbion as shown in screenshot below...
·         Clicking on Manage ribbon will open Term Store management tool page as shown below.

·         We will notice the term store data of source farm being displayed in the target farm.
·         The scripts above will work on both SharePoint 2010 and 2013.


3 comments: