TF246062: Two or more database are in conflict when upgrading to TFS 2010
Whist upgrading a TFS2010 Beta2 server to RTM I saw the following error when I ran the verify step of the upgrade.
TF246062: Two or more databases are in conflict because they are each designated as the owners of the following schema: Framework. The schema is for the host with the following name and ID: CollectionName, 8aace481-2471-49c8-da74-77ee3da4ce29. The databases with this conflict are: Data Source=SQLInstance1;Initial Catalog=Tfs_CollectionName;Integrated Security=True, Data Source=SQLInstance1;Initial Catalog=Tfs_Production_CollectionName;Integrated Security=True. You must specify one and only one database owner for the schema in the searchable SQL Server instances for this deployment of Team Foundation Server.
This error is caused because you have two Team Project Collection (TPC) DBs with the same unique GUID. So how can this happen and where do these GUIDs come from?.
When you create a TPC it gets a GUID. It keeps this GUID if you disconnect it from a TFS server and move it to another server. The only time this GUID can change is if you clone the TPC. When the cloned TPC DB is attached, the TFS spots it is a clone of a TPC is already hosts and issues a new GUID.
So how did I get two DBs with the same GUID? The answer is that prior to the upgrade some tests had been done using another TFS server to see if the client wished to do an in-place upgrade or disaster recovery style one onto new hardware. When doing a DR style upgrade the server does not issue a new GUID, as the TPC is unique to the new server, this server knows nothing of the original TFS server. This meant, as the two server shared a SQL cluster, that we had two copies of the same DB (but with different names) on the same SQL instance, so when the TFS upgrade program asked for the DBs by GUID it got back two DBs, hence the error.
The fix was to delete the Db created during the previous tests.
Note: You can see a similar effect if for any reason you replicate any of the TFS Dbs on a single SQL instance, such as to make a second copy of the warehouse DB for some special reporting purpose.