MOSS 2007: Event ID 5553 & Event ID 7888

We get following event ID being reported every hour

Log Name: Application

Source: Microsoft-SharePoint Products-SharePoint Portal Server

Date: 8/25/2010 2:00:14 PM

Event ID: 5553

Task Category: User Profiles

Level: Error

Keywords:

User: SPONGEBOB\Administrator

Computer: SharePoint2007.spongebob.com

Description: failure trying to synch site 86eda585-c33c-4039-90e7-4605d05e2b05 for ContentDB d6135e1c-7e5f-4e40-961e-83e687a1f2fc WebApp 171a934b-e4bd-454e-ae2f-52d8f42638a8. Exception message was Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'.

The statement has been terminated..

Event Xml:

<Event xmlns="https://schemas.microsoft.com/win/2004/08/events/event">

<System>

<Provider Name="Microsoft-SharePoint Products-SharePoint Portal Server" Guid="{8B3DDD3D-2B09-4669-BF81-E2D6921FEEEA}" />

<EventID>5553</EventID>

<Version>14</Version>

<Level>2</Level>

<Task>8</Task>

<Opcode>0</Opcode>

<Keywords>0x4000000000000000</Keywords>

<TimeCreated SystemTime="2010-08-25T18:00:14.263575700Z" />

<EventRecordID>21451</EventRecordID>

<Correlation ActivityID="{60994BB0-6731-403F-99A5-F65AF66805DB}" />

<Execution ProcessID="15132" ThreadID="6344" />

<Channel>Application</Channel>

<Computer> SharePoint2007.spongebob.com</Computer>

<Security UserID="S-1-5-21-796845957-436374069-1801674531-121594" />

</System>

<EventData>

<Data Name="string0">failure trying to synch site 86eda585-c33c-4039-90e7-4605d05e2b05 for ContentDB d6135e1c-7e5f-4e40-961e-83e687a1f2fc WebApp 171a934b-e4bd-454e-ae2f-52d8f42638a8.</Data>

<Data Name="string1">Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'.

The statement has been terminated.</Data>

</EventData>

</Event>

Facts:

Two MOSS Timer jobs per Web Application which controls the replication of the user profile attributes.

If we look at the Timer Job definitions (Central Administration à Operations à Timer Job definitions), we'll find jobs called Profile Synchronization and Quick Profile Synchronization. These jobs sync’s the changes to the WSS profiles.

Profile Synchronization Job

STSADM.exe –o sync –synctiming M:5

Sets the schedule for the main synchronization job. "M" denotes every n minutes (for example, “m:5” means every 5 minutes). "H" denotes every n hours (for example, “h:1” means every 1 hour). "D" denotes the number of times per day (for example, “D:3” means three times per day).

The default is once per hour

Quick Profile Synchronization

STSADM.exe –o sync –sweeptiming M:5

The sweep job is driven by the Windows SharePoint Services 3.0 change log and is used as a lightweight way to capture new users added. For example, you might have a fully synchronized site, but then a user is added to the site. The sweep job ensures that the incremental newly added user gets the user profile properties replicated quickly.

The default value is every 1 minute.

Warning: The above error can happen when there are duplicate GUID’s is being referenced within the dbo.SiteSync table of SSP database

Steps to resolve the issue:

Use an account that has administrative permissions to log on to the SharePoint Server

Open the Command Prompt and go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

We need to change the Profile Synchronization to happen every 5 Minutes as we don’t want to keep on waiting for an hour to verify if the issue still persists.

Execute

stsadm.exe –o sync –synctiming M:5

By executing the below command it will deletes old synchronization records corresponding to these databases. It does not delete the databases themselves.

stsadm.exe –o sync –deleteolddatabases 0

After executing the above command check the application event log to see if the above error still exists.

If the issue still persists go to Central Administration à Application Management à Content Database

Set the Content databases Online

Note:

Taking content database offline is sometimes used as mechanism for preventing creation of site collection in the content database. In order to allow profile sync the database must be online.

To restrict new site collections set the max number of sites equal to current number of sites for the content database.