After moving the content database to another SQL Server, I started getting the following message in the event log every hour : “A duplicate site ID … 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.”
Nice and simple and even a recommended solution in the error message – except that it wouldn’t work. After a lot of additional searching I turned up this command, which did work:
stsadm -o sync -DeleteOldDatabases 0
I am reposting it here because of how hard it was to find in the first place. For what its worth, the full syntax of this is:
stsadm -o sync
{-ExcludeWebApps <web applications> |
-SyncTiming <schedule(M/H/D:value)> |
-SweepTiming <schedule(M/H/D:value)> |
-ListOldDatabases <days> |
-DeleteOldDatabases <days>}
The original answer was posted by Vikram Garlapati.