資料表錯誤:資料表遺失或資料列索引的鍵值無效:

Microsoft.SQLServer.2012.Table_error__Table_missing_or_invalid_key_in_index_for_the_row__1_5_Rule (Rule)

Knowledge Base article:

原因

資料表中的每個資料列 (堆積或叢集索引) 必須在該資料表的每個非叢集索引中剛好有一個相符的索引資料列。此錯誤表示非叢集索引遺失索引資料列。

將會伴隨 8955 訊息出現,此訊息會識別遺失索引資料列的資料列與索引鍵。還可能會伴隨出現 8952 與 8956 錯誤。

解決方式

硬體失敗

請執行硬體診斷,並更正所有發現的問題。另請查看 Microsoft® Windows NT® 系統與應用程式記錄檔,以及 SQL Server™ 錯誤記錄檔,以判斷是否因硬體故障而導致此錯誤。請修正所有硬體相關問題。

若有持續發生的資料損毀問題,請嘗試抽換不同的硬體元件以隔離問題。檢查以確定您的系統未在磁碟控制卡上啟用寫入快取。如果懷疑此原因造成問題,請連絡硬體廠商。

最後您可能會發現切換至全新硬體系統會很有幫助,包括重新格式化磁碟機,以及重新安裝作業系統。

從備份還原

如果問題與硬體無關,而且確定有未受影響的備份可以使用,請利用該備份來還原資料庫。

DBCC CHECKDB

如果沒有完好的備份可用,請執行不含修復子句的 DBCC CHECKDB,以確定損毀程度。DBCC CHECKDB 將會建議要使用的修復子句。然後,執行含有適當修復子句的 DBCC CHECKDB 來修復損毀。

注意: 如果您不確定 DBCC CHECKDB 及 repair 子句對您的資料有什麼效果,請先連絡主要支援提供者再執行此陳述式。

執行修復將會重建索引。如果執行含有其中一種修復子句的 DBCC CHECKDB 仍無法更正問題,請連絡您的主要支援提供者。

如果分頁是 IAM 分頁,執行修復會重建該分頁所屬的 IAM 鏈結,從而移除該分頁。否則,該分頁將解除配置。

可覆寫的參數

名稱

描述

預設值

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

1

Element properties:

TargetMicrosoft.SQLServer.2012.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID8951
Event Source$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
資料表錯誤:資料表遺失或資料列索引的鍵值無效:
{0}
Event LogApplication
CommentMom2012ID='{E558B134-08BB-4D47-A655-D4E83D0D8D02}';MOM2012GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.Windows.EventProvider Microsoft.SQLServer.SQLDefaultAccount
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.2012.Table_error__Table_missing_or_invalid_key_in_index_for_the_row__1_5_Rule" Target="SQL2012Core!Microsoft.SQLServer.2012.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2012ID='{E558B134-08BB-4D47-A655-D4E83D0D8D02}';MOM2012GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Windows!Microsoft.Windows.EventProvider" RunAs="SQL!Microsoft.SQLServer.SQLDefaultAccount">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>8951</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2012.Table_error__Table_missing_or_invalid_key_in_index_for_the_row__1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>