SQL 2008中的内存不足异常 [英] Out of Memory exception in SQL 2008

查看:101
本文介绍了SQL 2008中的内存不足异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于SQL Server 2008中的内存不足异常:

Regarding the Out of Memory exception in SQL Server 2008:

当我执行向表中插入数千行的大型查询时,

When I execute large query which inserts thousands of rows into a table,

执行此异常是"System.OutOfMemoryException".

The exception which occurs when executing this is "System.OutOfMemoryException".

推荐答案

根据一个非常好的Microsoft知识库文章

According to a really pretty good Microsoft knowledge base article (linked here) this caused by a query which requires more RAM allocated than is available.

换句话说,您需要更多的RAM,或者您需要重新设计查询以将过程分成较小的块.

In other words, you need more RAM, or you need to redesign the query to break up the process into smaller chunks.

这是整篇文章的摘要.原始文件包含指向内容的链接,以更详细地说明您应遵循他们的建议的过程.

This is a summary of the complete article. The original contains links to content to explain in more detail the process by which you should follow their suggestions.

Blockquote: MS知识库文章909678

当您使用SQL Server Reporting Services时,您可能会收到"System.OutOfMemoryException"错误消息

要解决此问题,请使用以下方法之一.

To resolve this issue, use one of the following methods.

方法1

为计算机添加足够的物理内存.

Add sufficient physical memory to the computer.

注意:如果您有超过2 GB的内存,则可以在Boot.ini文件中启用/3GB开关,以获得更好的性能.有关如何在SQL Server中使用/3GB开关的更多信息.

Note If you have more than 2 gigabytes (GB) of memory, you can enable the /3GB switch in the Boot.ini file for better performance. For more information about how to use the /3GB switch in SQL Server.

方法2

计划报告在内存限制较低时在非工作时间运行.

Schedule reports to run at off-hours when memory constraints are lower.

方法3

相应地调整MemoryLimit设置.

Adjust the MemoryLimit setting accordingly.

注意:通过Reporting Services Web服务呈现报表时,Reporting Services Web服务从Machine.config文件获取MemoryLimit设置.但是,报表服务器Windows服务将呈现计划的报表.报表服务器Windows服务从RSReportServer.config文件获取MemoryLimit设置.

Note: When you render a report through the Reporting Services Web service, the Reporting Services Web service obtains the MemoryLimit setting from the Machine.config file. However, a scheduled report is rendered by the Report Server Windows service. The Report Server Windows service obtains the MemoryLimit setting from the RSReportServer.config file.

方法4

升级到64位版本的Microsoft SQL Server 2005 Reporting Services,以允许Reporting Services利用更多的内存.

Upgrade to a 64-bit version of Microsoft SQL Server 2005 Reporting Services to allow Reporting Services to utilize more memory.

方法5

重新设计报告.为此,请使用以下方法之一.

Redesign the report. To do this, use one of the following methods.

重新设计报表查询. 您可以通过以下方式减少内存消耗 重新设计报表查询 可以通过以下方式:

Redesign the report queries. You can reduce memory consumption by redesigning the report queries in the following ways:

  • 在报表查询中返回较少的数据.
  • 对报表查询的WHERE子句使用更好的限制.
  • 将复杂的聚合移动到数据源.

方法B

将报告导出为其他格式.您可以通过使用其他格式来显示报告来减少内存消耗.

Export the report to a different format. You can reduce memory consumption by using a different format to display the report.

方法C

简化报告设计.

您可以通过以下方式简化报表设计来减少内存消耗:

You can reduce memory consumption by simplifying the report design in the following ways:

  • 在报告中包括较少的数据区域或控件.
  • 使用追溯报表显示详细信息.

这篇关于SQL 2008中的内存不足异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆