Upgrading Team Foundation Server 2008 to 2010

Posted by Martin Hinshelwood on Geeks with Blogs See other posts from Geeks with Blogs or by Martin Hinshelwood
Published on Mon, 03 May 2010 11:04:01 GMT Indexed on 2010/05/03 12:18 UTC
Read the original article Hit count: 1272

Filed under:

vs2010almI am sure you will have seen my posts on upgrading our internal Team Foundation Server from TFS2008 to TFS2010 Beta 2, RC and RTM, but what about a fresh upgrade of TFS2008 to TFS2010 using the RTM version of TFS. One of our clients is taking the plunge with TFS2010, so I have the job of doing the upgrade.



It is sometimes very useful to have a team member that starts work when most of the Sydney workers are heading home as I can do the upgrade without impacting them. The down side is that if you have any blockers then you can be pretty sure that everyone that can deal with your problem is asleep Sad

I am starting with an existing blank installation of TFS 2010, but Adam Cogan let slip that he was the one that did the install so I thought it prudent to make sure that it was OK.

Verifying Team Foundation Server 2010

We need to check that TFS 2010 has been installed correctly. First, check the Admin console and have a root about for any errors.

image
Figure: Even the SQL Setup looks good. I don’t know how Adam did it!

Backing up the Team Foundation Server 2008 Databases

As we are moving from one server to another (recommended method) we will be taking a backup of our TFS2008 databases and resorting them to the SQL Server for the new TFS2010 Server. Do not just detach and reattach. This will cause problems with the version of the database. If you are running a test migration you just need to create a backup of the TFS 2008 databases, but if you are doing the live migration then you should stop IIS on the TFS 2008 server before you backup the databases. This will stop any inadvertent check-ins or changes to TFS 2008.

image

Figure: Stop IIS before you take a backup to prevent any TFS 2008 changes being written to the database.

It is good to leave a little time between taking the TFS 2008 server offline and commencing the upgrade as there is always one developer who has not finished and starts screaming. This time it was John Liu that needed 10 more minutes to make his changes and check-in, so I always give it 30 minutes and see if anyone screams.

John Liu [SSW] said:
  are you doing something to TFS :-O
MrHinsh [SSW UK][VS ALM MVP] said:
  I have stopped TFS 2008 as per my emails
John Liu [SSW] said:
  haven't finish check in @_@
  can we have it for 10mins? :)
MrHinsh [SSW UK][VS ALM MVP] said:
  TFS 2008 has been started
John Liu [SSW] said:
  I love you!

-IM conversation at TFS Upgrade +25 minutes

After John confirmed that he had everything done I turned IIS off again and made a cup of tea. There were no more screams so the upgrade can continue.

image
Figure: Backup all of the databases for TFS and include the Reporting Services, just in case.

 

image
Figure: Check that all the backups have been taken

Once you have your backups, you need to copy them to your new TFS2010 server and restore them. This is a good way to proceed as if we have any problems, or just plain run out of time, then you just turn the TFS 2008 server back on and all you have lost is one upgrade day, and not 10 developer days.

As per the rules, you should record the number of files and the total number of areas and iterations before the upgrade so you have something to compare to:

TFS2008

File count:

Type Count
1 1845
2 15770

Areas & Iterations:

139

You can use this to verify that the upgrade was successful. it should however be noted that the numbers in TFS 2010 will be bigger. This is due to some of the sorting out that TFS does during the upgrade process.

Restore Team Foundation Server 2008 Databases

Restoring the databases is much more time consuming than just attaching them as you need to do them one at a time. But you may be taking a backup of an operational database and need to restore all your databases to a particular point in time instead of to the latest. I am doing latest unless I encounter any problems.

image
Figure: Restore each of the databases to either a latest or specific point in time.

 

 image
Figure: Restore all of the required databases

Now that all of your databases are restored you now need to upgrade them to Team Foundation Server 2010.

Upgrade Team Foundation Server 2008 Databases

This is probably the easiest part of the process. You need to call a fire and forget command that will go off to the database specified, find the TFS 2008 databases and upgrade them to 2010. During this process all of the 6 main TFS 2008 databases are merged into the TfsVersionControl database, upgraded and then the database is renamed to TFS_[CollectionName]. The rename is only the database and not the physical files, so it is worth going back and renaming the physical file as well. This keeps everything neat and tidy.

If you plan to keep the old TFS 2008 server around, for example if you are doing a test migration first, then you will need to change the TFS GUID. This GUID is unique to each TFS instance and is preserved when you upgrade. This GUID is used by the clients and they can get a little confused if there are two servers with the same one.

To kick of the upgrade you need to open a command prompt and change the path to “C:\Program Files\Microsoft Team Foundation Server 2010\Tools” and run the “import” command in  “tfsconfig”.

TfsConfig import /sqlinstance:<Previous TFS Data Tier>
                 /collectionName:<Collection Name>
                 /confirmed

Imports a TFS 2005 or 2008 data tier as a new project collection.

Important: This command should only be executed after adequate backups have been performed.

After you import, you will need to configure portal and reporting settings via the administration console.

EXAMPLES
--------
TfsConfig import /sqlinstance:tfs2008sql /collectionName:imported /confirmed
TfsConfig import /sqlinstance:tfs2008sql\Instance /collectionName:imported /confirmed

OPTIONS:
--------
sqlinstance         The sql instance of the TFS 2005 or 2008 data tier. The TFS databases at that location will be modified directly and will no longer be usable as previous version databases.  Ensure you have back-ups.

collectionName      The name of the new Team Project Collection.

confirmed           Confirm that you have backed-up databases before importing.

This command will automatically look for the TfsIntegration database and verify that all the other required databases exist.

In this case it took around 5 minutes to complete the upgrade as the total database size was under 700MB. This was unlike the upgrade of SSW’s production database with over 17GB of data which took a few hours. At the end of the process you should get no errors and no warnings.

The Upgrade operation on the ApplicationTier feature has completed. There were 0 errors and 0 warnings.

As this is a new server and not a pure upgrade there should not be a problem with the GUID.

If you think at any point you will be doing this more than once, for example doing a test migration, or merging many TFS 2008 instances into a single one, then you should go back and rename the physical TfsVersionControl.mdf file to the same as the new collection. This will avoid confusion later down the line.

To do this, detach the new collection from the server and rename the physical files. Then reattach and change the physical file locations to match the new name.

You can follow http://www.mssqltips.com/tip.asp?tip=1122 for a more detailed explanation of how to do this.

image
Figure: Stop the collection so TFS does not take a wobbly when we detach the database.

When you try to start the new collection again you will get a conflict with project names and will require to remove the Test Upgrade collection. This is fine and it just needs detached.

image
Figure: Detaching the test upgrade from the new Team Foundation Server 2010 so we can start the new Collection again.

You will now be able to start the new upgraded collection and you are ready for testing.

Do you remember the stats we took off the TFS 2008 server?

TFS2008

File count:

Type Count
1 1845
2 15770

Areas & Iterations:

139

Well, now we need to compare them to the TFS 2010 stats, remembering that there will probably be more files under source control.

TFS2010

File count:

Type Count
1 19288

Areas & Iterations:

139

Lovely, the number of iterations are the same, and the number of files is bigger. Just what we were looking for.

Testing the upgraded Team Foundation Server 2010 Project Collection

Can we connect to the new collection and project?

image
Figure: We can connect to the new collection and project.

 

image
Figure: make sure you can connect to The upgraded projects and that you can see all of the files.


image
Figure: Team Web Access is there and working.

Note that for Team Web Access you now use the same port and URL as for TFS 2010. So in this case as I am running on the local box you need to use http://localhost:8080/tfs which will redirect you to http://localhost:8080/tfs/web for the web access.

If you need to connect with a Visual Studio 2008 client you will need to use the full path of the new collection, http://[servername]/tfs/[collectionname] and this will work with all of your collections.

With Visual Studio 2005 you will only be able to connect to the Default collection and in both VS2008 and VS2005 you will need to install the forward compatibility updates.

  • Visual Studio Team System 2005 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010
  • Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010
  • To make sure that you have everything up to date, make sure that you run SSW Diagnostics and get all green ticks.

    Upgrade Done!

    At this point you can send out a notice to everyone that the upgrade is complete and and give them the connection details. You need to remember that at this stage we have 2008 project upgraded to run under TFS 2010 but it is still running under that same process template that it was running before. You can only “enable” 2010 features in a process template you can’t upgrade. So what to do? Well, you need to create a new project and migrate things you want to keep across.

    Souse code is easy, you can move or Branch, but Work Items are more difficult as you can’t move them between projects. This instance is complicated more as the old project uses the Conchango/EMC Scrum for Team System template and I will need to write a script/application to get the work items across with their attachments in tact.

    That is my next task!

    Technorati Tags: ,,

    © Geeks with Blogs or respective owner