MSSQL 2014: 索引的檢視不包含檢視定義所產生的所有資料列。

Microsoft.SQLServer.2014.Indexed_view_does_not_contain_all_rows_that_the_view_definition_produces.__Refer_to_Books_Online_for_more_information_on_this_error.__This_does_not_necessarily_represent_an_integrity_issue_with_th_5_Rule (Rule)

有關這個錯誤的詳細資訊,請參閱線上叢書。這不必然表示資料庫中的資料完整性有問題。

Knowledge Base article:

摘要

DBCC CHECKDB 的第一階段是針對關鍵的系統資料表,執行資料頁的基本檢查。如果發現任何錯誤,且無法進行修復,則 DBCC CHECKDB 會立即終止。

此錯誤表示分頁 P_ID1 的下一頁指標指向分頁 P_ID2,但分頁 P_ID2 的上一頁指標指向分頁 P_ID3,而不是指回應該指向的分頁 P_ID1。

解決方式

硬體失敗

請執行硬體診斷並更正所有問題,另請檢查 Microsoft Windows NT 系統與應用程式記錄檔,以及 SQL Server 錯誤記錄檔,確定是否因硬體失敗而導致此錯誤。修正所有硬體相關問題。

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

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

從備份還原

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

DBCC CHECKDB

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

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

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

此錯誤無法自動修復。

可覆寫的參數

名稱

描述

預設值

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

2

Element properties:

TargetMicrosoft.SQLServer.2014.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID8908
Event Source$Target/Property[Type="SQL2014Core!Microsoft.SQLServer.2014.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2014: 索引的檢視不包含檢視定義所產生的所有資料列。
{0}
Event LogApplication
CommentMom2014ID='{DE1A3DAC-F7DB-402D-AF7B-B2A206FCB9C9}';MOM2014GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

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

Source Code:

<Rule ID="Microsoft.SQLServer.2014.Indexed_view_does_not_contain_all_rows_that_the_view_definition_produces.__Refer_to_Books_Online_for_more_information_on_this_error.__This_does_not_necessarily_represent_an_integrity_issue_with_th_5_Rule" Target="SQL2014Core!Microsoft.SQLServer.2014.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2014ID='{DE1A3DAC-F7DB-402D-AF7B-B2A206FCB9C9}';MOM2014GroupID={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">
<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="SQL2014Core!Microsoft.SQLServer.2014.DBEngine"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>8908</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2014.Indexed_view_does_not_contain_all_rows_that_the_view_definition_produces.__Refer_to_Books_Online_for_more_information_on_this_error.__This_does_not_necessarily_represent_an_integrity_issue_with_th_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>