{"id":1593,"date":"2012-02-23T17:50:10","date_gmt":"2012-02-23T17:50:10","guid":{"rendered":"http:\/\/www.obieta.com\/?p=1593"},"modified":"2012-02-23T17:50:10","modified_gmt":"2012-02-23T17:50:10","slug":"event-id-7888-cannot-insert-duplicate-key-row-in-object-dbo-usermemberships-with-unique-index","status":"publish","type":"post","link":"http:\/\/obieta.com\/?p=1593","title":{"rendered":"Event ID 7888 \u2013 Cannot insert duplicate key row in object \u2018dbo.UserMemberships\u2019 with unique index"},"content":{"rendered":"<p><strong>Error 1:<\/strong><\/p>\n<address>Event Type: Error<\/address>\n<address>Event Source: Office SharePoint Server<\/address>\n<address>Event Category: Office Server General<\/address>\n<address>Event ID: 7888<\/address>\n<address>Date: 4\/25\/2011<\/address>\n<address>Time: 1:22:02 PM<\/address>\n<address>User: N\/A<\/address>\n<address>Computer: SERVERNAME<\/address>\n<address>Description:<\/address>\n<address>A runtime exception was detected. Details follow.<\/address>\n<address>Message: Cannot insert duplicate key row in object  \u2018dbo.UserMemberships\u2019 with unique index  \u2018CX_UserMemberships_RecordId_MemberGroupId_SID\u2019.<\/address>\n<address>The statement has been terminated.<\/address>\n<address>Techinal Details:<\/address>\n<address>System.Data.SqlClient.SqlException: Cannot insert duplicate key  row in object \u2018dbo.UserMemberships\u2019 with unique index  \u2018CX_UserMemberships_RecordId_MemberGroupId_SID\u2019.<\/address>\n<address>The statement has been terminated.<\/address>\n<address>at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)<\/address>\n<address>at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)<\/address>\n<address>at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)<\/address>\n<address>at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,  SqlCommand cmdHandler, SqlDataReader dataStream,  BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)<\/address>\n<address>at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)<\/address>\n<address>at  System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior  cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean  async)<\/address>\n<address>at  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior  cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String  method, DbAsyncResult result)<\/address>\n<address>at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)<\/address>\n<address>at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<\/address>\n<address>at Microsoft.Office.Server.Data.SqlSession.ExecuteNonQuery(SqlCommand command)<\/address>\n<address>at Microsoft.Office.Server.UserProfiles.WSSSynchSqlSession.SynchExecuteNonQuery(SqlCommand cmd, Boolean throwOnFail)<\/address>\n<address>at Microsoft.Office.Server.UserProfiles.WSSSynchSqlSession.SynchExecuteNonQuery(SqlCommand cmd)<\/address>\n<address>at Microsoft.Office.Server.UserProfiles.SiteSynchronizer.WriteChangeLogConsumed()<\/address>\n<address>at Microsoft.Office.Server.UserProfiles.SiteSynchronizer.Synch()<\/address>\n<address>at  Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean  fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock  catchBlock, FinallyBlock finallyBlock)<\/address>\n<address>For more information, see Help and Support Center at http:\/\/go.microsoft.com\/fwlink\/events.asp.<\/address>\n<p>&nbsp;<\/p>\n<p><strong>Error 2:<\/strong><\/p>\n<address>Event Type: Error<\/address>\n<address>Event Source: Office SharePoint Server<\/address>\n<address>Event Category: User Profiles<\/address>\n<address>Event ID: 5553<\/address>\n<address>Date: 4\/25\/2011<\/address>\n<address>Time: 1:22:02 PM<\/address>\n<address>User: N\/A<\/address>\n<address>Computer: SERVERNAME<\/address>\n<address>Description:<\/address>\n<address>failure trying to synch site  3ddb699f-b03c-420a-98d2-4ed94982f8ee for ContentDB  b9a1094c-492f-47e3-a374-a3a2f1f28020 WebApp  ac248ab9-09d5-42c8-872c-66919c150c65. Exception message was Cannot  insert duplicate key row in object \u2018dbo.UserMemberships\u2019 with unique  index \u2018CX_UserMemberships_RecordId_MemberGroupId_SID\u2019.<\/address>\n<address>The statement has been terminated..<\/address>\n<address>For more information, see Help and Support Center at http:\/\/go.microsoft.com\/fwlink\/events.asp.<\/address>\n<p>&nbsp;<\/p>\n<p><strong>Reason:<\/strong><\/p>\n<p>This occurs when I moved a site collection or content database from  one web application to another. The SSP thinks the site is new and tries  to insert data into the UserMemberships table that already exists  there.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Resolution 1:<\/strong><\/p>\n<p><strong> <\/strong>Open command prompt and change the path to C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12BIN<\/p>\n<p>Type the following command in command prompt<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">stsadm \u2013o preparetomove \u2013site &lt;<a href=\"http:\/\/whatevertheguiltysiteis\/\">http:\/\/the error site<\/a>&gt; -oldcontentdb &lt;guid of the content db listed in event log error&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Type the following command in command prompt<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">stsadm \u2013o sync \u2013deleteolddatabases 0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Check the list of content database by using the following command.  The time for the list of content databases should be around the same  time.<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">stsadm \u2013o sync \u2013listolddatabases 0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Get the GUID of the content databases by running the following query in SQL Server.<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">USE [WSS_CentralAdmin]SELECT Id, Name, ClassId, ParentId, Status, Version, Properties<\/p>\n<p>FROM Objects<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Resolution 2:<\/strong><\/p>\n<p>Open command prompt and change the path to C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12BIN<\/p>\n<p>Type the following command in command prompt<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">stsadm \u2013o deletecontentdb \u2013url &lt;<a href=\"http:\/\/whatevertheguiltysiteis\/\">http:\/\/the error site<\/a>&gt; -databasename &lt;database name&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Type the following command in command prompt<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"590\" valign=\"top\">stsadm \u2013o addcontentdb \u2013url &lt;<a href=\"http:\/\/whatevertheguiltysiteis\/\">http:\/\/the error site<\/a>&gt; -databasename &lt;database name&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>*The deletecontentdb does not delete the database in SQL.<\/p>\n<p>**The 1st resolution is tedious. By using the 2nd resolution, the  errors do not appear. Seem like another alternative to solve it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error 1: Event Type: Error Event Source: Office SharePoint Server Event Category: Office Server General Event ID: 7888 Date: 4\/25\/2011 Time: 1:22:02 PM User: N\/A Computer: SERVERNAME Description: A runtime exception was detected. Details follow. Message: Cannot insert duplicate key row in object \u2018dbo.UserMemberships\u2019 with unique index \u2018CX_UserMemberships_RecordId_MemberGroupId_SID\u2019. The statement has been terminated. Techinal Details: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,1],"tags":[],"_links":{"self":[{"href":"http:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts\/1593"}],"collection":[{"href":"http:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1593"}],"version-history":[{"count":0,"href":"http:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts\/1593\/revisions"}],"wp:attachment":[{"href":"http:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1593"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}