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

Microsoft.SQLServer.2008.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 呼叫之間的連線或交易中斷的可能性。若要完成此工作,您需要將開啟文件控制代碼儲存在資料表中,一旦批次發生中斷,即可參考此資料。

Element properties:

TargetMicrosoft.SQLServer.2008.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
CommentMom2008ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';MOM2008GroupID={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.2008.XML___XML_document_could_not_be_created_because_server_memory_is_low._Use_sp_xml_removedocument_to_release_XML_documents_1_5_Rule" Target="SQL2008Core!Microsoft.SQLServer.2008.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2008ID='{136A2E5E-A460-4FAE-8587-D72C945E89EB}';MOM2008GroupID={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.2008.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>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>