Friday, November 2, 2007

Event ID: 5553 & Event ID: 7888

Here is an issue that I came across that might be helpful for others. We were seeing these 2 errors recurring every hour in the application logs.

The synchronization runs every hour by default to ensure that the content database will be included in membership and profile information.

The most likely cause is a content database was moved, copied and used in same farm without being detached properly.

To avoid this situation always remember to run this command before moving content database:
stsadm -o preparetomove -contentDB database_server:database_name

This operation will allow the membership and profile synchronization to be included when you reattach the content database. If this is skipped it will result in static membership and profile information within the content database, preventing it from getting synchronized when it’s reattached.


//-----------------------------------------------------------------
Event Type: Error
Event Source: Office SharePoint Server
Event Category: User Profiles
Event ID: 5553
Date: 9/26/2007
Time: 4:01:02 PM
User: N/A
Computer: WEBSTER
Description:
failure trying to synch site a7b12d90-7d1d-4341-8df3-a1d92eba7a47 for ContentDB db7fb0d6-7d0d-4230-8de5-e7cc00ca0db7 WebApp 55de867d-5a9d-4ac4-83d6-f3ee9ee98df2. 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..
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

//----------------------------------------------------------------
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server General
Event ID: 7888
Date: 9/26/2007
Time: 4:01:02 PM
User: N/A
Computer: WEBSTER
Description:
A runtime exception was detected. Details follow.
Message: Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'.
The statement has been terminated.
Techinal Details:
System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError (SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError (SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning (TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader (SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds (CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader (CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery (DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery (SqlCommand command)
at Microsoft.Office.Server.UserProfiles.WSSSynchSqlSession.SynchExecuteNonQuery (SqlCommand cmd, Boolean throwOnFail)
at Microsoft.Office.Server.UserProfiles.WSSSynchSqlSession.SynchExecuteNonQuery (SqlCommand cmd)
at Microsoft.Office.Server.UserProfiles.SiteSynchronizer.WriteChangeLogConsumed()
at Microsoft.Office.Server.UserProfiles.SiteSynchronizer.Synch()
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter (Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
//-----------------------------------------

Probable cause is due to backing up our current content DB and restoring it to a different application on the same farm.

What happened is the GUID for the content DB is the same causing a conflict during the sync process.

Following steps are a workaround the issue:

Get a list of the content databases GUIDs that are being affected.
Stsadm -o sync -listolddatabases 0

Now run a Select Query on the Config Databases “dbo.Objects” table and look for the GUID that matches the listed GUID.

Database: Sharepoint_Config, Table dbo.Objects

SELECT Id, ClassId, ParentId, Name, Status, Version, Properties
FROM Objects
WHERE (Id = '5bafe2af-48a7-4043-a36d-29160f3b88e2')


In our case this is just a development/testing site that will not be around for long so we just excluded it from the sync process.
Stsadm –o sync –ExcludeWebApps URL of webapplist

But for those that are not as fortunate as us you will want to do a full detach and rebuild of the content database. This will enable the Content Database to get new GUID and be included in the sync process.

Detach Content Database. This will not delete your database only break the association.
stsadm -o preparetomove -contentdb -ContentDB SQLserver:DB_NAME -site http://website
stsadm -o deletecontentdb -url http://website -databaseserver SQLserver -databasename DB_NAME

Reattach Content Database.
stsadm -o addcontentdb -url http://website -databasename DB_NAME -databaseserver SQLserver

Helpful "sysadm –o sync" options can be found here.

-Scott

3 comments:

Ferdi said...

Dear Scott,

thank you very much for this detailed description.

After restore of several web appl / sites on a new sharepoint server we face also 2 entries ID 5552 and 7888 in our Eventlog.
I just followed your advise and it gave me some interesting look into the structure of sharepoint database.

I recognize by the stsadm -o sync -listolddatabases 0 three database which are not synchronized for a long time.

But I can not find them in our Objects table. I crosschecked all sites on our server with the entries in our Objects table and the results of the stsadm command and I do not really miss a content DB. So I guess these ones are really some "dead" entries in the SSP table.
How can I remove this ones?

I just come to your blogg after facing a problem while adding some excel tables from a libray into a excel services webpart. A problem appear "Exception message was Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'"

After searching for a while I come the conclusion my SSP might be corrupted. But I am yet not sure.

Can you help me?
with best regards
Ferdi

Ravi Dinavahi said...

Hi Ferdi!

Not sure if you found the solution for the above, but after spending whole two nights (weekend as it happened to be a Production server), I finally got rid of all these errors. The main reason that gave impetus to this investigation was the constant failure of the Backup of the SharePoint Farm. So I did some research and ran the commands that have been recommended by almost all the blogs. Preparetomove, DeleteContentDB, and AddContentDB. It did help me to stop getting the errors 5555 and 7888 but in return started generating the exact same errors you mentioned here. So this is what I did.

I ran just the "Preparetomove" command alone after running the aforementioned three key STSADM commands for all the web applications that were having this issue. Boom - no more errors and no more issues with Backup.

Please let me know if you need the steps and commands. Good luck!

Ravi Dinavahi.

Steven Summone said...

Excellent post clear and
well explained. I have read other post but none of them explain and walk you through the process like this. Well done Scott.