MOM - SystemCenterReporting database inconsistency errors

假設您發現以下資料庫 "鏈結連接不相符" 錯誤:

Event Type:          Error
Event Source:      MOM.Datawarehousing.DTSPackageGenerator.exe
Event Category:  None
Event ID:               1001
Date:                      8/5/2008
Time:                      01:00:02
User:                      N/A
Computer:           SRV-MOM
Description:  The following information is part of the event: 資料表錯誤 : 資料庫識別碼 10,物件識別碼 1739153241,索引識別碼 0。鏈結連接不相符。(1:11109192)->下一個 = (1:11101007),但是 (1:11101007)->前一個 = (1:11101006)。
Table error: Database ID 10, object ID 1739153241, index ID 0. Chain linkage mismatch. (1:11109192)->next = (1:11101007), but (1:11101007)->prev = (1:11101006)..

Event Type:          Error
Event Source:      MOM.Datawarehousing.DTSPackageGenerator.exe
Event Category:  None
Event ID:               1001
Date:                      8/4/2008
Time:                      01:00:05
User:                      N/A
Computer:           SRV-MOM
Description:  The following information is part of the event: 資料表錯誤 : 資料庫識別碼 10,物件識別碼 1739153241,索引識別碼 0。鏈結連接不相符。(1:11109192)->下一個 = (1:11101007),但是 (1:11101007)->前一個 = (1:11101006)。
Table error: Database ID 10, object ID 1739153241, index ID 0. Chain linkage mismatch. (1:11109192)->next = (1:11101007), but (1:11101007)->prev = (1:11101006)..

Event Type:          Error
Event Source:      MOM.Datawarehousing.DTSPackageGenerator.exe
Event Category:  None
Event ID:               1001
Date:                      8/2/2008
Time:                      01:00:04
User:                      N/A
Computer:           SRV-MOM
Description:  The following information is part of the event: 資料表錯誤 : 資料庫識別碼 10,物件識別碼 1739153241,索引識別碼 0。鏈結連接不相符。(1:11109192)->下一個 = (1:11101007),但是 (1:11101007)->前一個 = (1:11101006)。
Table error: Database ID 10, object ID 1739153241, index ID 0. Chain linkage mismatch. (1:11109192)->next = (1:11101007), but (1:11101007)->prev = (1:11101006)..

解決辦法
==================

請嘗試以下步驟進行資料庫修復,修復過程您必須承擔因部分資料不一致導致資料遺失可能。
1. 從上面的錯誤訊息找出資料庫的 ID 代號 (舉例上面的例子是 ID 10) 透過下面指令確認 ID 10 = SystemCenterReporting

    SELECT * FROM sysdatabases

2. 請停止 MOM service
3. 請完整備份 SystemCenterReporting 資料庫
4. 請執行以下指令以修復資料庫一致性

    ALTER DATABASE OnePoint SET EMERGENCY
    GO
    ALTER DATABASE OnePoint SET SINGLE_USER
    GO
    DBCC CHECKDB (<db_name>, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS
    GO

    Note: 取代 <db_name> 成第一步的資料庫名字

5. 重複 DBCC CHECKDB command 直到你看見 "found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 1 seconds" 訊息,這訊息代表資料庫修復已經完成,沒有再發現任何錯誤。現在你可以進行資料庫上線動作。

    ALTER DATABASE OnePoint SET MULTI_USER
    GO
    ALTER DATABASE OnePoint SET ONLINE
    GO

6. 請檢視 "OnePoint" 資料庫的 "ReportingSettings" 資料表,檢查 "TimeDTSLastRan" 的值,這個值告訴你 "OnePoint" 的 DTS 最後執行日期。
7. 如果 "TimeDTSLastRan" 的值大於十天之前,建議您用 "/latency" 參數去限制 DTS 的處理天數。(we have removed the "/slient" switch so that the DOS window does not disappear)

MOM.Datawarehousing.DTSPackageGenerator.exe /srcserver:<server_name> /srcdb:OnePoint /dwserver:<server_name> /dwdb:SystemCenterReporting /product:"Microsoft Operations Manager" /latency:<an_integer_number>

Note: 假設 "TimeDTSLastRan" 返回值(某一日期)減掉今天的日期等於 38 天,而我們想手動執行 DTS 而且每一次只處理 7 天。那麼您就要在參數後面加上 "31" ==> "/latency:31"。(38 - 7 = 31)

8. 利用下面的指令確認 DTS 是否還在執行

    SELECT * FROM dbo.sysprocesses WHERE program_name LIKE '%DTS%' (against the masterdb)

9. 如果返回的值有一筆顯示 "INSERTing" 資料,而且該 PID 可以對應上工作管理員的 PID 那就意味 DTS 工作還在執行
10. 等到 DTS 工作完成,重新檢視 "TimeDTSLastRan" 該值應該要被更新。
11. 重複步驟 7 到 10 直到 "latency" 的值不再需要被遞減 。
12. 啟動 MOM 服務並觀察 MOM 伺服器狀態。