Sunday, April 28, 2013

Upgrade to SP2013, part 4: Upgrade Managed Metadata Service App

I will only upgrade one service app and that is the Managed Metadata service application, since I have built the company wiki based on a taxonomy tree there.

There is an article on technet that I followed to update this, but it failed. I tried it twice and got the same error and I am sure I missed something or did something wrong somewhere, but there is a limit on how many trials you do before you give up. So I did my own workaround and got it to work finally.

These are the recommended steps that I followed from Technet:
Detach the Managed metadata database on the SP2010 test server
Copy it to the new SP2013 server
Attach it to the SQL server
Then run this command in Powershell to upgrade the database:

$applicationPool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services default'

$mms = New-SPMetadataServiceApplication -Name 'Managed Metadata Service Application' -ApplicationPool $applicationPool -DatabaseName 'Managed Metadata Service'
(If you use a variable like $mms (or whatever you want to call it), you can refer to that when you create the proxy group):
New-SPMetadataServiceApplicationProxy -Name ‘Managed Metadata Service Connection’ -ServiceApplication $mms -DefaultProxyGroup

Did an iisreset just to be sure...

Right. So the result was an error message when I tried to access the Managed metatadata service app.

Opened the Properties to make sure it had the correct database (the upgraded db name) and application pool. And I actually created a new application pool and assigned the correct service account to that. That did not change anything.

Then I verified that the same service account has permissions to the database on the SQL server also.
Checked the Health Analyzer. Found a message about the managed metadata not being associated to the service apps:

Checked the “Configure service application associations” and the service apps were correctly associated.
Went back to Health analyzer and clicked on “Reanalyze now” and the message disappeared. Did not change anything.

Went into “Upgrade and Migration” and clicked on “Check upgrade status” and found the successful upgrade message so the database seems to be OK:

Clicked on the second Managed metadata service connection level and checked the second box also. I did not expect any changes from this, but just in case….

Went into “Security” and “Configure Service Accounts” and changed to another pool account and made an iisreset to see if that helped. No, did not change anything, still same error.

Checked the ULS and found this error:
Failed to get term store for proxy 'Managed Metadata Service Connection'. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.     at Microsoft.SharePoint.Taxonomy.Internal.XmlDataReader.GetDateTime(String name)     at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore.Initialize(IDataReader dataReader, Guid termStoreIdValue, Boolean fromPersistedData)     at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore..ctor(IDataReader dataReader, Guid termStoreId, Boolean fromPersistedData)     at Microsoft.SharePoint.Taxonomy.Internal.DataAccessManager.GetTermStoreData(MetadataWebServiceApplicationProxy sharedServiceProxy, Boolean& partitionCreated) 3a24169c-4427-a0a0-8c09-185263be83c0
04/28/2013 14:01:11.13  w3wp.exe (0x2EDC)                        0x1E80 SharePoint Server              Taxonomy                       8088 Warning  The Managed Metadata Service 'Managed Metadata Service Connection' is inaccessible. 3a24169c-4427-a0a0-8c09-185263be83c0

Googled these errors and found nothing that really related and could solve my problem ("the given key was not present").

Gave up and tried my own solution, which worked immediately! Steps follows below:

My own solution
Detached the database
Deleted the Managed Metadata service application in CA that I had created in the steps above
Created a new managed metadata service application and also a new application pool account.
And I checked “Add this service application to the farms default list”.
Attached the upgraded database (from my former steps above, so the database needs to be upgraded)
Changed the properties of the service app, and added the name of the upgraded database
Iisreset just to be sure…
It worked immediately.

May not be the correct way, but at least this worked on first shot!


Manjiri said...

Thank you very much . I had exact same issue and been struggling with this for whole day and finally your post helped me. This is what i did
I deleted then recreated Managed metadata Service app using technet method with powershell using Sharepoint Webservices Default pool . Did not specify new account. Created new service applicationproxy using powershell. restore the metadata service database from 2010 . Go to properties , change the datbase name to point to this restored database and it worked.
Thanks again.

Lise Rasmussen said...

Hi Manjiri!
Glad I could help :) Thanks for posting yours also.

Squiggle said...

$mmsa = New-SPManagedAccount
[insert your preferred credentials]

$mmapppool = New-SPServiceApplicationPool -Name 'SharePoint Managed Metadata' -Account $mmsa
$mms = New-SPMetadataServiceApplication -Name 'Managed Metadata Service Application' -ApplicationPool $mmapppool -DatabaseName '[YOUR SP2010 DATABASE]' -Verbose
$mmsp = New-SPMetadataServiceApplicationProxy -Name 'Managed Metadata Service Application Proxy' -ServiceApplication $mms -DefaultProxyGroup -Verbose
Set-SPMetadataServiceApplication -Database DELETEME
Set-SPMetadataServiceApplication -Database '[YOUR SP2010 DATABASE]'

Then just go and delete the DELETEME database ...

Hughesers said...

Thanks for this post. I wish I found it a couple hours ago. Following your steps worked for me however I didn't recreate the application pool. All I did was swap out the databases.

Anonymous said...

Thank you very much . I had exact same issue and finally your post helped me

Jason Smith said...

I'm so glad I found your page, I've spent all morning trying to search for a solution to this and hitting so many 'just check permissions' answers! This works, many thanks for posting it up, finally I can move on...


Lise Rasmussen said...

Great to hear, glad I could help you out! Cheers!

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks Lise, I owe you a beer. Give a ping when you are nearby.

You got me started at the right track looking at the database instead of app pool permissions.

Pointing to the right DB fixed it, thanks :-)

Unknown said...

Apparently I'm unknown.

It's Søren Nielsen :-)

Anonymous said...

Thx, that helped me to fix the Problem :-)

westerdaled said...

Lisa I will owe you a beer. Got the same issue out of the blue with my Sp2013 farm ( no upgrade) looks like I will delete and recreate the mms db.. the only thing is should backup and restore in sql just to be on the safe side.

ra said...

Thank you SharePointBabe.