To move the managed metadata database, take a copy only backup of it from your SQL server and then restore from files in your new SQL server. I’ll write a future post on that and put a link to it here.
At this point, you already have a managed metadata service application in your target farm and you need to get it’s globally unique identifier (GUID). Run the following:
Get-SPServiceApplication | ?{$_.name -like "*meta*"} | ft id
You could put that ID in a variable, or you could type it into your next set of commands that attach the new db to the Managed Metadata service application
$ServiceID = Get-SPServiceApplication | ?{$_.name -like "*meta*"} | ft id $mms = Get-SPServiceApplication -Identity $ServiceID Set-SPMetadataServiceApplication -Identity $mms -DatabaseName "MetaData"
The key to this working is that the correct DatabaseName is used. So if your new db is named MetaDataDB, then the above script would need to be modified a little for the -DatabsaseName parameter.
The managed metadata navigation should now be working. If it’s not, just go to manage service applications, change the managed metadata database to a database that does not exist, click OK, then change it back. This process causes SharePoint to execute a timer job that syncs the service application up to the database.
Hope this helps someone.