Friday, September 02, 2011

Attaching TFS 2010 Collection database which was not Detached

Not talking about in what situation you may have to do this operation of attaching collection database on another server while it was not detached from live server:

Here are the steps:

1. You have backup of collection database on your TFS server where you want to attach database
2. Restore collection database on sql server
3. You need to use TFSConfig Recover command to repair collection database such that it is ready to be attached.
             If you don't run this command and go straight in to TFS Admin Console to attach database, it will not display this collection there as it thinks there are no Detached Collection on server that can be attached here.

Command is: TFSConfig Recover /ConfigurationDB:ServerName;DatabaseName /CollectionDB:ServerName;CollectionDatabaseName

Ref: http://msdn.microsoft.com/en-us/library/ff407077.aspx

At the end of this command, you will see an error message "The host 'Collection Name' can not be started. The servicing needs to be scheduled and completed before the host can be started".

4. At this point, you will be able to see this collection in TFS Admin console when you go to Collections screen. It will appear as "Offline" collection.
5. Detach this collection.
6. Attach collection now again and it will be online and functional..

Ref: http://blogs.msdn.com/b/tfssetup/archive/2010/09/28/how-to-recover-a-collection-database-when-it-is-not-listed-in-the-tfs-admin-console.aspx


0 comments: