Monday, March 12, 2012

sharepoint 2010 user profiles failure trying to synch site

Event log shows you error:  failure trying to synch site . Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'. Task Category "user profiles"

It happens to me when I have restored content db from another farm.

The way I fixed it:

1. Clear SharePoint 2010 cache (  I doubt that it may help but I did with the second step. So, can't differentiate what actually helped. Let me know if this step is not necessary)

2. stsadm -o sync -deleteolddatabase 0





P.S. make sure that user that runs stsadm.exe has acces to User Profile Service.
To be on the safe side, Run stsadm.exe under the user that runs the service "Forefront Identity Manager Service"

 (for more insight on User Profile Synchronization service)