Content deployment fails with guid conflict

When setting up content deployment, you might need to start from scratch on the destination side. You delete the sitecollection, create a new one and try running the deployment. The deployment process will fail and log an error that states that the database already contains an item with the same guid.

The reason for this behaviour lies in the way SP2010 works post SP1. The feature is called sitecollection recycle bin. Sitecollections when deleted from the GUI or powershell are marked as deleted but are kept in the DB.

You can see which sitecollections have been deleted by running the Get-SPDeletedSite powershell cmdlet.

To delete these sites from the DB, you need to remove them using the Remove-SPDeletedSite cmdlet. After you have run this, you will need to manually start the Gradual site delete job that will actually delete the content from the DB.