MSSQL 2014: XML: 无法创建 XML 文档,因为服务器内存不足。请使用 sp_xml_removedocument 释放 XML 文档

Microsoft.SQLServer.2014.XML___XML_document_could_not_be_created_because_server_memory_is_low._Use_sp_xml_removedocument_to_release_XML_documents_1_5_Rule (Rule)

执行 sp_xml_preparedocument 时,在 SQL Server 2000 的内部缓存中存储已分析的 XML 文档。MSXML 分析器最多占用 SQL Server 可用总内存的八分之一。在分配给 MSXML 的高速缓存部分中没有足够内存用来打开 sp_xml_preparedocument 语句中指定的文档。这可能是因为指定的文档非常大,或因为该内存空间中现有的文档没有为新文档留下足够的空间。

Knowledge Base article:

摘要

执行 sp_xml_preparedocument 时,在 SQL Server 2000 的内部缓存中存储已分析的 XML 文档。MSXML 分析器最多占用 SQL Server 可用总内存的八分之一。在分配给 MSXML 的高速缓存部分中没有足够内存用来打开 sp_xml_preparedocument 语句中指定的文档。这可能是因为指定的文档非常大,或因为该内存空间中现有的文档没有为新文档留下足够的空间。

有关分析 XML 文档的详细信息,请参阅联机丛书中的 "sp_xml_preparedocument" 和 "sp_xml_removedocument"。

解决方法

执行 sp_xml_removedocument 以从内存中删除文档。验证您的代码是否总是会在完成处理文档时调用 sp_xml_removedocument。您的代码应该解决 sp_xml_preparedocumentsp_xml_removedocument 调用之间的连接或事务可能被中断的问题。若要完成此任务,可能需要将打开的文档句柄存储在一个表中,如果批处理被中断,就可以引用它们。

可替代参数

名称

说明

默认值

已启用

启用或禁用工作流。

优先级

定义警报优先级。

1

严重性

定义警报严重性。

1

Element properties:

TargetMicrosoft.SQLServer.2014.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID6624
Event Source$Target/Property[Type="SQL2014Core!Microsoft.SQLServer.2014.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2014: XML: 无法创建 XML 文档,因为服务器内存不足。请使用 sp_xml_removedocument 释放 XML 文档
{0}
Event LogApplication
CommentMom2014ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';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.XML___XML_document_could_not_be_created_because_server_memory_is_low._Use_sp_xml_removedocument_to_release_XML_documents_1_5_Rule" Target="SQL2014Core!Microsoft.SQLServer.2014.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2014ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';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>6624</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.2014.XML___XML_document_could_not_be_created_because_server_memory_is_low._Use_sp_xml_removedocument_to_release_XML_documents_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>