After performing some trial and error with migrating the Managed Metadata Service databases and attempting to attach the databases in another farm in hopes it would just come up, I came to the conclusion that this isn’t the best option. These are my steps for migrating the Managed Metadata Service from one farm to another. In my situation, we had an ESF farm setup where several services were hosted and are primary farm connected over to those services via a remote connection. I was tasked with migrating those services over to the primary farm to simplify the architecture. So these steps involve dropping the remote connection and re-creating it in the primary farm.

  1. If you don’t already have the BulkAdmin permission level for the service account set on the destination farm SQL server, you’ll need to add that to be able to import the term store data. Otherwise you’ll receive an error during the import process.
  2. Disconnect the remote Managed Metadata Service remote connection to the ESF (Enterprise Services) farm.
  3. Create the new Managed Metadata Service in the primary farm via Central Administration.
  4. Export the term store (all the settings within the Managed Metadata Service in the ESF farm) using the following PowerShell commands on the ESF farm server (or source farm):
    1. $mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq “Managed Metadata Service”}
    2. $mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq “Managed Metadata Service Connection”}
    3. Export-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path “\\sourcefarm-appserver\backup\mms.cab”
  5. Import the term store backup using the following PowerShell commands on a primary farm server (or destination farm) … Also, your path below to the backed up file will still be the source farm server path, not the destination server, since that’s where we’re pulling the backed up data from. One other note: you MUST use a network path not a local file path. It won’t work otherwise. No one will tell you this:
    1. $mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq “Managed Metadata Service”}
    2. $mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq “Managed Metadata Service Connection”}
    3. Import-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path “\\sourcefarm-appserver\backup\mms.cab” -OverwriteExisting
  6. If you have any navigation dependent upon the Managed Metadata Service, you’ll need to go to that site within Navigation settings and toggle it to use the new service, using the navigation term store you have setup. Otherwise it will error.