There comes a time in every SharePoint 2010 admin’s life when they must make a choice. Continue to be pushed around by that bully the User Profile Service Application (UPA) , or fight back, give it a bloody nose and show it who’s boss. Today’s blog post is about the latter. At various times the UPA gets fuzz in its head and won’t behave. When that’s the case, you can often fix the issue by blowing the UPA away and recreating it. When you do that you lose all your existing profile information. If your profile information consists entirely of information pulled from Active Directory then it’s no big loss. That’s not the case with most farms though. Users have augmented their profile information with pictures or other information, and there’s also the whole social aspect. The UPA stores all the tags and notes and activities. You don’t want to lose that. When things go missing in SharePoint, users lose faith in the platform. We don’t want that. This blog post will walk you through how to rebuild your UPA without losing any previous data.
The first step is to copy down your existing settings. This is part of what we lose when we rebuild the UPA, so we need to scribble them down so we can put them back in when we rebuild. This usually is just your AD connection settings, though there may also be some connection filters or BCS connections to keep track of. You should probably also eyeball your other settings like preferred search center, MySite host, and any audiences you may have added.
After you have copied down your settings it's time to bite the bullet and delete the offending Service App. Go to Central Admin > Manage Service Applications and highlight User Profile Service Application. Then click Delete in the Ribbon.
This next part is INCREDIBLY important. Please pay very close attention. No NOT click the checkbox in the dialog box that pops up. That leaves the databases that we need in place.
Verify that box is NOT checked and click OK.
After the Service Application is deleted, head over to SQL Management Studio, and attach to the database instance where your UPA databases are. You will see three UPA related databases; profile, social and sync. Here’s a rough breakdown of what each database does:
Profile – Stores user information and activity feed
Social – Stores tags and notes
Sync – Staging area for FIM while it’s syncing between AD and SharePoint
You can find more information about each database in the TechNet article Database types and descriptions (SharePoint Server 2010).
The Profile and Social DBs have the important stuff in them, and thankfully the User Profile service can reuse them. The Sync database is trash, so we can delete it.
Go ahead, delete that mother.
You might have to make a couple of changes to the delete options:
Now the destructive part is over. The demons have been exorcized. You can breathe easy. The worst part is over.
Now it’s time for the phoenix to rise. We need to rebuilt our UPA, bigger, stronger than before. Go to back to Central Admin > Manage Service Applications and create a new User Profile Service Application.
When the dialog comes up, we’re going to give it the same database names the old UPA had. The new UPA will reuse the Profile and Social DBs, which will maintain that information. Since we deleted the Sync DB it can’t reuse that, so it will recreate it.Here are some shoddy screenshots that show the settings.
You’ll notice I also had to put in the My Site Host URL and My Site Managed Path location.
After the new service application is created you may have to refresh the Service Applications page before it will show up. While you’re in there let’s go ahead and give the Search crawler account permission to crawl our new server application. To do that, highlight the new service application and click “Administrators” in the Ribbon.
Then add your default crawl account and give it the “Retrieve People Data for Search Crawlers” permission.
Now click the service application and finish its configuration. In most cases this will mostly be recreating the Active Directory connection. When you open the UPA and look in the upper right corner you should see a bunch of profiles already exist. This is proof that the old profile database is being used, and that we still have all the old profile information.
At this point go ahead and recreate your AD connection and any other settings you copied down earlier. After you get those set, run a full sync and verify it all works. The profile count shouldn’t change, since we’re using the same Profile DB. You’ll have to watch the Sync in miisclient.exe to see how it goes. After the Sync gets finished run a full crawl with Search to make sure that all works.
Now hopefully whatever problem you had with the UPA is now fixed, and you have another notch on your keyboard from where you’ve done battle with the User Profile Service and won.
edit: I meant to mention in this that this same technique can be used to replicate the UPA in another environment. That environment could be testing or even a disaster recovery site.