Service Broker/数据库镜像传输无法侦听端口,因为端口正在被使用

Microsoft.SQLServer.2012.The_Service_Broker_Database_Mirroring_transport_cannot_listen_on_port_because_it_is_in_use_5_Rule (Rule)

Knowledge Base article:

摘要

创建 Service Broker 或数据库镜像端点时,SQL Server 接受在端点中指定的端口上的 TCP/IP 连接。传输安全要求获得授权才能连接到端口。如果运行 SQL Server 的计算机启用了防火墙,则计算机上的防火墙配置必须允许端点中指定的端口进行传入和传出连接。

在这种情况下,指定的端口不可用,因为它正在使用中。

原因

计算机上的其他程序正在使用指示的 TCP 端口。Windows 应用程序日志指定是否由 Service Broker 或数据库镜像记录该错误。此消息在 Windows 应用程序日志中记录为 MSSQLSERVER 事件 ID 9692。

解决方法

从命令提示符处运行 netstat -aon 以确定正在使用该端口的程序。

您可以禁用正在使用该端口的应用程序,或者在 Service Broker 应用程序中指定其他端口。

外部

请参阅 SQL Server 2012 联机丛书中的 "ALTER ENDPOINT (Transact-SQL)"。

Element properties:

TargetMicrosoft.SQLServer.2012.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID9692
Event Source$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
Service Broker/数据库镜像传输无法侦听端口,因为端口正在被使用
{0}
Event LogApplication
CommentMom2012ID='{BEE972D8-4422-4CFD-BC7D-B1035EA67E9D}';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.The_Service_Broker_Database_Mirroring_transport_cannot_listen_on_port_because_it_is_in_use_5_Rule" Target="SQL2012Core!Microsoft.SQLServer.2012.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2012ID='{BEE972D8-4422-4CFD-BC7D-B1035EA67E9D}';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>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>9692</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$</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.2012.The_Service_Broker_Database_Mirroring_transport_cannot_listen_on_port_because_it_is_in_use_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>