MSSQL 2016: 索引视图不包含由视图定义生成的所有行。

Microsoft.SQLServer.2016.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 会对数据造成何种影响,请在执行该语句前与您的主要支持提供商联系。

如果在运行带有修复子句的 DBCC CHECKDB 后仍无法解决问题,请与您的主要支持提供商联系。

此错误无法自动修复。

可替代参数

名称

说明

默认值

已启用

启用或禁用工作流。

优先级

定义警报优先级。

1

严重性

定义警报严重性。

2

Element properties:

TargetMicrosoft.SQLServer.2016.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID8908
Event Source$Target/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2016: 索引视图不包含由视图定义生成的所有行。
{0}
Event LogApplication
CommentMom2016ID='{DE1A3DAC-F7DB-402D-AF7B-B2A206FCB9C9}';MOM2016GroupID={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.2016.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="SQL2016Core!Microsoft.SQLServer.2016.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2016ID='{DE1A3DAC-F7DB-402D-AF7B-B2A206FCB9C9}';MOM2016GroupID={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="SQL2016Core!Microsoft.SQLServer.2016.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.2016.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>