Pages

Thursday, June 14, 2012

Event ID 7888 Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index

Problem:
These events appear in the event log appear over and over:
Event ID 7888
Event Type:    Error
Event Source:    Office SharePoint Server
Event Category:    Office Server General
Event ID:    7888
Date:        date
Time:        time
User:        N/A
Computer:    SERVERNAME
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.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.


It is followed by event ID 5553:
 Event Type:    Error
Event Source:    Office SharePoint Server
Event Category:    User Profiles
Event ID:    5553
Date:        6/10/2012
Time:        11:00:16 PM
User:        N/A
Computer:    SERVERNAME
Description:
failure trying to synch site 2b6344ca-36d8-4c59-bf88-a5940d4ae213 for ContentDB 33b1b239-2e5c-4306-a343-7ae7aee1e3f2 WebApp 9361a970-b32f-41fe-b345-20f10d223414.  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.


Issue:
I had done an stsadm backup and restore without doing the sts command -o preparetomove first.   When I restored it, SharePoint tried to recreate the site's members in the configuration database.  Since the data it is trying to insert is already there, it throws the errors you see in the event log.

Solution:
1. Find out which site this is.  (Read my post to do this)
2. Run this: stsadm–o preparetomove -site FullURL -oldcontentdb GUID_of_Content_DB
 - the full URL is your site - the guid of the content db is from the error message.
3. Then run this: stsadm –o sync -deleteolddatabases 0

This does not delete any content databases. This deletes old sync databases older than 0 days - which are the ones throwing the errors.

No comments:

Post a Comment