I am not sure how many have made a mistake of installing a CTP on a LIVE machine. I did ..
This was the time when TFS had released the support for GIT in their CTP release. At the same time we had a client who wanted to use GIT open source repository for their WPF project. I had read the blog from Scott Haneslman about the integration of GIT within TFS I made me excited. The client was asking for the support of VS 2012 and GIT, and we had it.
Without thinking twice or reading what the label had to say or the warnings it was shouted at me, I went and installed the latest bits of TFS express 2012 Update 2 and the next few words are very important CPT2. The installation went fine and we went with the development ………
the project was delivered, and client was happy. After the project we had some time off and realizing that TFS Express 2012 Update 3 had come out, we decided to install Update 3. As usual the installation went fine and when it came for the DB upgrade things started to twist.
The DB upgrade started to throw exception “TF400965: The database was created using a non-Go Live version…”. As we normally do when we get these exceptions is to turn out for help … Google. Without even reading what the error message had to say started to search for answers. This was not helping.
At this point the state of the server was that TFS application had been upgraded to Update 3 but not the DB and because of that our LIVE TFS server was down.
From this point on the situation had gone to panic mode. So we had to find a solution fast and I was desperate. I decided to ask the question in Stackoverflow . This is the link to http://stackoverflow.com/questions/17486313/tfs-express-2012-update-2-ctp-2-to-update-3. Meantime, I tried other options but none was successful.
I knew I cant keep the TFS down for long, so decided to rollback the changes. So I went ahead removed TFS Express 2012 Update 3 and installed TFS Express 2012 Update 2 CTP 2 and connected back to the existing DB and everything was back to normal except when I tried to access the portal I was getting an error (TF30046: The instance information does not match). From this below article I was able to solve this problem http://devtipsandtricks.wordpress.com/2013/02/25/tfs-express-2012-tf30046-the-instance-information-does-not-match/.
But I was not happy with this. I wanted TFS Express 2012 Update 3 installed on the LIVE server. That’s when I got the help from Richard Banks. He had mentioned to try to use the TFS Integration Tool. This tool is like a migration tool and since I had no other options I decided to use this tool.
Talked to the team on how we will be doing this.
- Get a spare machine and try to mimic the server. (like same users, connecting to the same domain / AD and so on..)
- Install the pre-requisite software needed for TFS Integration Tool
- Install TFS Express 2012 Update 3 on the new machine
- Ask all developers to check-in the code and restricts team from further check-in till the TFS is backup.
- Request the team to disconnect from the existing LIVE TFS.
- Migrate the data (source code / workitem) from the LIVE TFS Express to the new TFS DB using the TFS Integration Tool
- Once migration is complete, make this is as the LIVE TFS.
- Ask the developers to connect to the new TFS machine and if required remap the local path.
- Run TFS for a week, to validate and to make sure no data is lost.
- If things look good, plan for moving the data back to the actual TFS Server
- Uninstall TFS Express 2012 Update 2 CTP2, install TFS Express 2012 Update 3
- Ask all developers to check-in the code and restricts user from further check-in
- Use Attach/Detach of SQL Server 2012 to transfer the data to the TFS Server.
- Ask the developers to reconnect to the TFS server machine and if required remap the local path.
- Retest to make sure everything is fine,
- Shutdown the spare machine
- Now we have the TFS Server with the latest bit TFS 2012 Express Update 3.
I will try to explain the steps, in places we faced issues. It has been a almost a month or two when I did this full exercise and now I don’t fully recollect all the problems and the issues faced. I will try my best though.
Luckily enough we had a spare machine with Window 7 64bit already installed. I will call this machine SPARE1. We connected this machine to the domain. Installed all the Windows update and patches which itself took a day to finish. Installed SQL Server 2010 Express edition with the same instance name as on the server. After that I installed TFS Express 2012 Update 3. I knew the account under which the original TFS (TFSServer1) was installed, so used the same account for installation. For configuring the DB for TFS used the same accounts and tried to keep the the default names for the DB’s as on the TFSServer1 (was just being safe). Once completed the next task was to install TFS Integration Tool.
The installation needed to have few pre-requisite, one of them being TFS Explorer 2010. Installing TFS Explorer 2012 is not enough. It needs 2010 version.
Next part was not that hard since we were a small team and so we could manage this part easily. To reduce the impact we did the migration process and switch over in the early morning hours.
We decided to use the default settings of the migration tool to import WorkItems and Source code. The migrate tool did raise few conflicts and errors but at this moment I don’t remember from top of my head what those errors were but we were able to fix them.
One of the problems we found in the tool was sometimes it would say the migration is complete but nothing shows in the portal especially the Workitems. To fix this problem we exited the application and restarted a windows service called “Visual Studio Team Foundation Background Job Agent”. Launched the application and tried again. This technique did work for us and the migration started. This will take time based on the machine and data. For us it took 7-8hrs to complete.
The first thing we realized was that the Build Agent was not configured and the build definition has not been moved across. In our case we manually configured the build agent and re-created the build definitions. The other thing which was missing was queries. We had custom team queries and personal queries. This was hard since we had many but we choose the manual process. Did not even look if their was a different option within the tool which could port the queries.
Now with all these fixed, TFS was finally installed in SPARE1 machine. Again coordinated with the team and requested them to connect to the SPARE1 machine. We ran for a week and everything was working fine.
Now it was time to upgrade the TFS on the server which I will call TFSServer1 machine. Uninstalled the current version(TFS Update 2 CTP2) from the machine. Installed TFS Express 2012 Update 3. Instead of using the backup/restore of the DB, decided to use the attach/detach option. Opened up SQL Server express from TFSServer1 and detached both databases (Tfs_Configuration / Tfs_DefaultCollection). Renamed the .ldf /.mdf files of the corresponding db’s. Now logged into SPARE1 detached both the databases(Tfs_Configuration / Tfs_DefaultCollection). Copied the .ldf/.mdf files of both DB’s from SPARE1 to TFSServer1. Attached both the DB’s back within TFSServer1. Once this was successfully done we restarted IIS.
Time to test, trying to access the portal got a similar error as before “TF30046: The instance information does not match”. Now we knew how to solve this problem. Fixed it and tried again. We were able to login and we had our Source code and workitems. Checked and re-configured the build agent.
In-fact we had other challenges which is not mentioned in this post. Few were TFS was not installed on the default port within IIS and the DB was not using the default instance. So we had to do few things to get this working the way we wanted. If anyone is interested to know I can post those steps too.
After this the team pointed to the new updated TFS Server(TFS Express 2012 Update 3) and life went on as if nothing happened.