Failure trying to sync web application - A duplicate site ID

You may receive this type of error after detaching and reattaching content databases in SharePoint. In my specific case, I had renamed a database and then reattached it to a web application using the addcontentdb command.  Apparently synchronization information gets confused a long the way.

 

Error Example:

Failure trying to synch web application d07de01b-1544-4058-ac17-8671865964d2, ContentDB 3f638556-d234-46ac-9da8-c6d590d213c1 Exception message was A duplicate site ID 94894a66-008a-4b82-bb8c-b7553abac5f9(https://amossite:2008) was found. This might be caused by restoring a content database from one server farm into a different server farm without first removing the original database and then running stsadm -o preparetomove. If this is the cause, the stsadm -o preparetomove command can be used with the -OldContentDB command line option to resolve this issue.

 

You can delete the old records by running the following stsadm command.  The value you are passing is how many days old the records are.  Also, note that you are only deleting the records that are associated - you are NOT deleting the database itself.

stsadm -o sync -deleteolddatabases 0

image

 

You can learn more about the Sync operation on technet (list info, etc..): https://technet.microsoft.com/en-us/library/cc263196.aspx