Geeks With Blogs
Gaurav Bodar - ALM Consultant, TFS specialist ALM, TFS, Agile, Scrum, Sharepoint, IT Service
If you are using Old Version of TFS (2012,1013) and if you want to Upgrade to TFS 2015 you have several options based on your requirements. 

2. Detach the Collection from your Old TFS Server and Attach it to TFS 2015 Environment 
https://msdn.microsoft.com/en-us/library/dd936138(v=vs.110).aspx

However you can still have some issues during Migration if your original Collection has been changed or modified for any reason. 

Good thing with TFS 2015 is Microsoft has exposed all SQL Scripts which runs during the Upgrade and with Knowledge of SQL you could resolve your TFS upgrade issue. 

I took simple approach of Detaching my Collection from TFS 2012 Update 3 which was on SQL Server 2008 R2. Restore Database on SQL Server 2012 and tried to Attach Collection with TFS 2015. This Migration Failed for me. There are two options to proceed with your Collection upgrade. 

Option 1


If you have Huge Collection than create Sample Test Collection Backup and see if the issue could be reproduced during Upgrade on TFS 2015. I had used dummy collection to figure out all the issues and than ran all command at once on my production collection before attach.


Error 1:
[2016-02-12 04:22:59Z][Error] 2 error(s) occurred while executing ProcessToDev12M46Custom.sql script.
Failed batch starts on line: 42.

Error: 5074, Level: 16, State: 1, Batch Line: 51, Script Line: 92
Message: The statistics 'FieldDisplayContextType' is dependent on column 'FieldDisplayContextType'.

Resolution

1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

DROP STATISTICS  tbl_ProjectConfigurationDisplayFields.FieldDisplayContextType
3. Now try to Attach the Collection 

Error 2:
[2016-03-24 04:17:56Z][Error] 2 error(s) occurred while executing ProcessToDev12M46Custom.sql script.
Failed batch starts on line: 104.

Error: 5074, Level: 16, State: 1, Batch Line: 72, Script Line: 175
Message: The statistics 'GridColumnType' is dependent on column 'GridColumnType'.

Resolution
1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

DROP STATISTICS tbl_ProjectConfigurationGridColumns.GridColumnType

3. Now try to Attach the Collection 


Error 3:
[2016-03-29 23:33:57Z][Error] 2 error(s) occurred while executing ProcessToDev12M46Custom.sql script.
Failed batch starts on line: 187.

Error: 5074, Level: 16, State: 1, Batch Line: 60, Script Line: 246
Message: The statistics 'WorkItemType' is dependent on column 'WorkItemType'.

Resolution
1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

DROP STATISTICS tbl_ProjectConfigurationWorkItemStates.WorkItemType

DROP STATISTICS tbl_ProjectConfigurationWorkItemTypes.WorkItemType


3. Now try to Attach the Collection 

Error 4:
[[2016-03-29 23:36:43Z][Error] 2 error(s) occurred while executing upd_WorkItemTrackingToDev12M58PreUpgrade.sql script.
Failed batch starts on line: 1.

Error: 5074, Level: 16, State: 1, Batch Line: 21, Script Line: 21
Message: The statistics 'ParentID' is dependent on column 'ParentID'.


Resolution
1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

DROP STATISTICS xxTree.ParentID

3. Now try to Attach the Collection 


Error 5:
[2016-03-29 23:39:39Z][Error] 3 error(s) occurred while executing TestManagementToDev12M45.sql script.
Failed batch starts on line: 8.

Error: 2715, Level: 16, State: 3, Batch Line: 8, Script Line: 15
Message: Column, parameter, or variable #2: Cannot find data type typ_TestResultAttachmentTypeTable.


Resolution
1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

IF NOT EXISTS(SELECT * FROM sys.types WHERE name = 'typ_TestResultAttachmentTypeTable' AND schema_id = SCHEMA_ID('dbo'))

 

CREATE TYPE typ_TestResultAttachmentTypeTable AS TABLE (

    testRunId       INT,

    testResultId    INT,

    iterationId     INT,

    actionPath      VARCHAR(256),

    fileName        NVARCHAR(256),

    comment         NVARCHAR(MAX),

    attachmentType  NVARCHAR(64),

    tmiRunId        UNIQUEIDENTIFIER,

    sessionId       INT

)


3. Now try to Attach the Collection 



Error 6:
[2016-03-29 23:48:14Z][Error] 2 error(s) occurred while executing VersionControlToDev12M46.sql script.
Failed batch starts on line: 19199.

Error: 2715, Level: 16, State: 3, Batch Line: 2, Script Line: 19200
Message: Column, parameter, or variable #3: Cannot find data type typ_LocalVersion2.

Error: 1087, Level: 16, State: 1, Batch Line: 55, Script Line: 19253
Message: Must declare the table variable "@localUpdates".


Resolution
1. On TFS Server your Collection would be shown as Offline,  Launch Admin Command Prompt and 
cd C:\Program Files\Microsoft Team Foundation Server 14.0\Tools
TfsConfig.exe collection delete /CollectionName:<Collection Name>

2. Launch SQL Server Mgmt Studio and Select Collection Database. Run Script Below.

IF NOT EXISTS(SELECT * FROM sys.types WHERE name = 'typ_LocalVersion2' AND schema_id = SCHEMA_ID('dbo'))

CREATE TYPE typ_LocalVersion2 AS TABLE (

    ItemIndex           INT,

    ItemId              INT,

    VersionFrom         INT,

    ParentPath NVARCHAR(400) COLLATE DATABASE_DEFAULT,

    ChildItem NVARCHAR(400) COLLATE DATABASE_DEFAULT,

    LocalItem           NVARCHAR(400) COLLATE DATABASE_DEFAULT,

    MappingLocalItem    NVARCHAR(400) COLLATE DATABASE_DEFAULT,

    MappingLength       SMALLINT,

    IsCommitted         AS CASE WHEN VersionFrom = 0 THEN CONVERT(BIT, 0) ELSE CONVERT(BIT, 1) END

)


3. Now try to Attach the Collection 

At this point if Attach fails, I would delete the Database from SQL Server. Restore Database, Run all the Scripts above in Single Shot and than try to Attach the collection. In my case this resolved the issue. 

Option 2 
The above workaround may loose some data during upgrade but I had 25 Team Projects and I dint want to use TFS Integration Toolkit to Move my Version Control and Workitem data through that Tool. the other approach in this situation could be 

1. Install TFS 2012 on Target Server
2. Create new Collection and Team Project 
3. Download https://tfsintegration.codeplex.com/
4. Map Two way link 
5. Move your Data between your TFS environment. 
6. Run In place Upgrade on Target Server to 2015. 



 
Posted on Wednesday, March 30, 2016 10:50 AM TFS , team foundation server , migration , TFS 2012 , TFS 2013 , TFS 2015 , TFS upgrade , TFS 2015 Upgrade | Back to top


Comments on this post: TFS 2012 to TFS 2015 Upgrade Issues

# re: TFS 2012 to TFS 2015 Upgrade Issues
Requesting Gravatar...
This is good news! It was a good thing that that have this kind of updates and was able to resolve some issues. - Gary McClure
Left by David Penn on Nov 01, 2016 6:03 AM

comments powered by Disqus

Copyright © Gaurav Bodar | Powered by: GeeksWithBlogs.net