One of the new feature of TFS 2010 is the concept of Project Collection, that is a sort of container for Team Projects. You can think that a Project Collection can be used to have a sort of multiple TFS inside one single server. If you have multiple customers, and you want them to access your TFS, but you want to be sure that customer A cannot see team projects of customer B, you can create a separate project collection for each customer.
One cool feature is that you can move/copy project collections between servers, I have downloaded the trial of VS2010 as explained in Brian Keller’s blog, then I worked on the hyper-v version of the machine for a couple of session in Italy, then I need to move everything I did into another blank VM that uses Virtual Pc, to be run when Hyper-v is not available. To move my modified collection I disconnected the project collection from the original tfs instance.
Once the Project collection was disconnected I simply did a database backup, then moved the backup on the other machine. In the destination machine I detach the original project collection, then restore the database backup from the source machine and reattach the collection again. When you clicked on the “Attach Team Project collection†button a dialog will appear
In my situation I can verify that a single project collection is importable, the one I detached in the previous step, but now I restored the database from the source machine and that collection contains my new project. After I finished attaching the collection I can verify that it now contains my new Team Project. I got some warning from the process, because the import process find that reporting services and sharepoint already exists (I imported in a machine where that collection already existed) so it tells me to verify if reporting and sharepoint works as expected.
As you can see the DefaultCollection contains my new project I created on another machine and the ProjectCollection was moved between tfs instances.
alk.






July 1st, 2010 at 8:26 am
Hello,
This is exactly what I’m trying to do, but I’d like to explain in details my issue:
I have made a backup of my ProjectCollection Database. But I did not detach it beforehand.
Then I’ve formatted my PC, re-installed SQL Server 2008 and TFS 2010.
I then followed these steps:
-recreate the collection using the same name
-shutdown all tfs services
-restore original database (overwriting the database of the collection I’ve just created)
-start all tfs services
But when I go to Visual Studio and browse my collection I get this error:
TF30046: The instance information does not match
have you come across this problem ?
thanks
July 1st, 2010 at 8:54 am
This problem happens because you have not detatched the collection. An MVP friend posted about the problem here http://tinyurl.com/39rfzkg
The procedure you are following is the typical one used in disaster recovering, where you have the backup of database, but you have only the project collection, and not all other databases of TFS. I’ll try to investigate for a solution.
Alk.
July 1st, 2010 at 8:59 am
You should try to restore the db on a server that has the same name of the original one, this could be another possibility.
As a suggestion, always backup all files of the TFS, this permits you to restore everything.
alk.
July 1st, 2010 at 12:05 pm
Thanks for the reply, but you got me worried !!
I don’t know the name of the original server.
How come the project collection backup is not sufficient ? That, I don’t understand…
Is there a workaround you can think of ?
thank you
July 1st, 2010 at 12:12 pm
Dumb idea maybe but is there any way I can retrieve my code from the database backup (command line maybe… ?) , if there’s no other options ?
July 1st, 2010 at 1:06 pm
The problem relies in some data that are in database that point to the old server, as far as I know there is no standard procedure to solve this problem. You can try to install the new tfs, create a collection with the same name, and then, with some data compare tools, try to understand if you can change some of the data to be able to reattach again the old project collection, but this is completely unsupported.
Having only the backup of a single collection without detatching is not enough. The collection should be detatched, or you need to backup all the database related to tfs server
alk.
July 1st, 2010 at 4:26 pm
yes, I understand. :’(
do you know of any way to read the code stored in the db ? I mean it’s got to be somewhere, even in binary format. I just can’t get used to the idea that I may have lost all my work …
July 1st, 2010 at 7:23 pm
I’ve managed to sort everything out finally !!!
Here’s what I did if it helps others….
1. Create a new collection with the same name as the one on the old server. This will create a new collection db.
2. Overwrite the db with the backup. (Task>Restore db and tick the option ‘overwrite db’). I had to stop tfs services in order to do that otherwise it failed saying the db was in use.
3. Now comes the tricky bit. Since the db contains info related to the old server, I had to mess around in order to find the right settings.
Right click on Tfs_configuration, properties. There’s a property TFS_INSTANCE with a value. I had to use that value for my collection db. I also needed to add the missing property TFS_SNAPSHOT_STATE with the value ‘Complete’.
4. Then I could attach the collection. However no projects were showing in the collection when browsing the collection from Visual Studio.
So I created a new project and I added it to this tfs collection. Looking at the log file I figured it added a record in Tfs_Configuration.dbo.tbl_CatalogResource.
I just needed to add a new record with a ResourceType (foreign key to CatalogResourceType, value: Project), and a DisplayName.
That’s it, the project was now showing in the collection
One last step though. I didn’t have any privileges to get the files ! I could see them, but I couldn’t get them, frustrating !
I just had to add my windows account username to the group members and tick all privileges for that collection.
That was a nightmare for getting this to work, but if that can help someone in the same situation…
Thanks a lot for your help.
July 2nd, 2010 at 8:02 am
Glad to know that you’ve finally solved your problem
alk.