Failure trying to synch web application xyz, ContentDB xyz Exception message was A duplicate site ID xyz (http://xyz.com) 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.
The above error due to the reason that the table “sistesynch” in the db. Usually the profile synchronizations service runs once in an hour. Database id‘s in this table “sistesynch” do not match with the database id’s from the config database. There will not be any problem with the Site ID’s.
Whenever you attach/detach the content database, this table has to be updated. If you delete the rows in this table manually, this error goes away and the table will be auto filled back with correct sites and database id’s next time when the service runs i.e an hour.
If you cant delete the table row entries manually(access restriction) , you can do the same operation using the following stsadm command.
stsadm -o sync -DeleteOldDatabases 0
Once you execute this command, it will list all the deleted rows and after that table “sistesynch” will be auto populated.
Note: perform the above command each time you attach/detach the content databases. Best practice is to script this command along with the actual routines