Visual Studio Team Foundation Server 安裝筆記(二):Troubleshooting

摘要:Visual Studio Team Foundation Server 安裝筆記(二):Troubleshooting

這是上一篇「Visual Studio Team Foundation Server 安裝筆記」的續集。因為之前裝是裝好了,可是度量資訊倉儲卻沒有資料,以至於開啟專案入口網站時,首頁最下方的「剩餘工作」區塊顯示錯誤訊息:

報表處理期間發生錯誤。 (rsProcessingAborted) 取得線上說明
資料集 'IterationParam' 的查詢執行失敗。 (rsErrorExecutingCommand) 取得線上說明
Team System Cube 不存在或尚未處理。

如果是正常的情形,這個區塊應該會有一個圖表顯示目前剩餘的工作。

用關鍵字向 Google 詢問了一下,找到兩篇很有用的討論串:

  1. Warehouse Troubleshooting Guide
  2. Warehouse Cube Won't Process - B3Refresh Upgraded OK

我是先照第一篇的說明逐一檢測,不過它的 Step 2 的 SQL 指令有誤,以下是我修正後的 SQL 指令:

use TfsWarehouse
select Setting as [Last Cube Processing] from _WarehouseConfig where ID = 'LastProcessTimeStamp'

-- total revisions in the relational warehouse
use TfsWarehouse
select top 1 __LastUpdatedTime as [LastVCWHWrite] from dbo.[Code Churn] with (nolock) order by __LastUpdatedTime desc
select top 1 __LastUpdatedTime as [LastWITWHWrite] from dbo.[Work Item History] with (nolock) order by __LastUpdatedTime desc

use TfsWarehouse
select count(*) as [WH Revisions] from [dbo].[Work Item History] with (nolock)
where [Record Count] <> -1

use TfsWorkitemTracking 
select count(*) as [WIT Revisions] from [dbo].[WorkitemsLatestAndWere] with (nolock)

use TfsWarehouse
select max ([Changeset ID]) as [WH Changeset] from [dbo].Changeset with (nolock) 
where __DimensionMemberActive = 1

use TfsVersionControl
select max(ChangeSetId) as [VC Changeset] from tbl_Changeset with (nolock)

-- identities
use TfsWarehouse
select Property_Value as [Warehouse Identity Id] from _PropertyBag 
where Property_Key = 'CSS Identity Sequence Id'

use TfsIntegration
select max(sequence_Id) as [Integration Identity Id] from tbl_security_identity_cache

-- structure
use TfsWarehouse
select Property_Value as [Warehouse Structure Id] from _PropertyBag 
where Property_Key = 'CSS Structure Sequence Id'

use TfsIntegration
select max(sequence_Id) as [Integration Structure Id] from tbl_nodes with (nolock)

到 Step 3 時發現 TfsWarehouse 沒資料,於是跳到 Gathering Error Data。照 Gathering Error Data 這個步驟,下載了 SysInternals 的 DebugView 工具來觀看除錯訊息,有一大堆這樣的錯誤:

MdxScript(Team System) (66, 1) END SCOPE 陳述式不符合開始的 SCOPE 陳述式。 
MdxScript(Team System) (68, 46) '[Str]' 函數不存在。 

再到 Google 搜尋一次,便找到第二篇討論串,依照裡面的步驟刪除 Cube 資料,問題就完全解決了!

順便把第二篇討論串的 Step 2 所執行的命令和結果貼上來,將以下只令存成 fix_tfs.bat,然後執行此批次檔就行了:

c:
cd \Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Tools
Setupwarehouse -rebuild -mturl http://localhost:8080 -c warehouseschema.xml -s localhost -d TfsWarehouse -a VSTS\TFSSERVICE -ra VSTS\TFSREPORTS

(註:我的機器名稱是 VSTS)

執行結果:
SetupWarehouse: 已成功更新倉儲。

完成後,再重複執行第一篇討論串的 Step 3,直到 Warehouse 的狀態從 Running Adapters 變成 Idle。然後再檢視 Team 專案入口網站,在首頁底下的「剩餘工作」報告應該就能正常顯示了。