XML: 因為伺服器的記憶體不足,所以無法建立 XML 文件。請使用 sp_xml_removedocument 釋出 XML 文件

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

Knowledge Base article:

摘要

當您執行 sp_xml_preparedocument 時,經剖析的 XML 文件會儲存在 SQL Server 2000 的內部快取中。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.2012.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID6624
Event Source$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
XML: 因為伺服器的記憶體不足,所以無法建立 XML 文件。請使用 sp_xml_removedocument 釋出 XML 文件
{0}
Event LogApplication
CommentMom2012ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';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.XML___XML_document_could_not_be_created_because_server_memory_is_low._Use_sp_xml_removedocument_to_release_XML_documents_1_5_Rule" Target="SQL2012Core!Microsoft.SQLServer.2012.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2012ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';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>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.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.2012.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>