MSSQL 2012: 資料庫複本角色已變更

Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplicaRoleChanged (Rule)

資料庫複本變更其角色時會發生此錯誤。

Knowledge Base article:

摘要

資料庫複本變更其角色時會發生此錯誤。

在 SQL Server 中,預設會停用此事件。透過下列 TSQL 即可啟用: sp_altermessage 1480, 'with_log', 'true'

原因

請檢查事件描述中的原因。

解決方法

使用者不必採取任何動作。如需詳細資訊,請參閱 SQL Server 錯誤記錄檔、Windows Server 容錯移轉叢集 (WSFC) 管理主控台或 WSFC 記錄檔。

可覆寫的參數

名稱

描述

預設值

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

1

Element properties:

TargetMicrosoft.SQLServer.2012.AlwaysOn.DatabaseReplica
CategoryEventCollection
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2012: 資料庫複本角色已變更
{0}
Event LogApplication

Member Modules:

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

Source Code:

<Rule ID="Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplicaRoleChanged" Target="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplica" Enabled="true" ConfirmDelivery="true" Remotable="true">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<Or>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Target/Property[Type="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplica"]/PerformanceObjectName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<!--Default instance with SQLServer object name-->
<Value Type="String">MS$Target/Property[Type="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplica"]/PerformanceObjectName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</Or>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">1480</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Params/Param[2]</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Target/Property[Type="AlwaysOnDisc!Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplica"]/AvailabilityDatabaseName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2012.AlwaysOn.DatabaseReplicaRoleChanged.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>