"System.OutOfMemoryException" exception when you execute a query in SQL Server Management Studio (转自MSDN)
Symptoms
When you use Microsoft SQL Server Management Studio (SSMS) to run an SQL query that returns a large amount of data, you receive an error message that resembles the following:
An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown
Cause
This issue occurs because SSMS has insufficient memory to allocate for large results.
Note SSMS is a 32-bit process. Therefore, it is limited to 2 GB of memory. SSMS imposes an artificial limit on how much text that can be displayed per database field in the results window. This limit is 64 KB in "Grid" mode and 8 KB in "Text" mode. If the result set is too large, the memory that is required to display the query results may surpass the 2 GB limit of the SSMS process. Therefore, a large result set can cause the error that is mentioned in the "Symptoms" section.
Workaround
To work around this issue, try one of the following methods.
Method 1: Output the results as text
Configure the query window to output the query results as text. A text output uses less memory than the grid, and it may be sufficient to display the query results. To make this change, follow these steps:
- Right-click the query window.
- Click Results to.
- Click Results to Text.
Method 2: Output the results to a file
Configure the query window to output the query results to a file. A file output uses a minimal amount of memory. This reserves more memory for storing the results set. To make this change, follow these steps:
- Right-click the query window.
- Click Results to.
- Click Results To File.
- Run the query, and then select the location in which to save the results file.
Method 3: Use sqlcmd
Use the sqlcmd tool instead of SSMS to run the SQL queries. This method enables queries to be run without the resources that are required by the SSMS UI. Additionally, you can use the 64-bit version of Sqlcmd.exe to avoid the memory restriction that affects the 32-bit SSMS process.
"System.OutOfMemoryException" exception when you execute a query in SQL Server Management Studio (转自MSDN)的更多相关文章
- Debugging a SQL Server query with WinDbg
Debugging a SQL Server query with WinDbg May 13, 2014 · Klaus Aschenbrenner · 5 Comments (Be sure to ...
- Exception of type 'System.OutOfMemoryException' was thrown
最近刚换了服务器,开始测试的时候未发现什么问题,可是一旦同一时间段操作的人比较多的时候,就会抛出如下错误: Server Error in '/' Application. Exception of ...
- 操作XmlDocument时,出现"System.OutOfMemoryException"异常,如何解决加载大数据的情况?
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.at System.St ...
- Dapper学习(一)之Execute和Query
Dapper是一个用于.NET的简单的对象映射,并且在速度上有着轻ORM之王的称号. Dapper扩展IDbConnection,提供有用的扩展方法来查询数据库. 那么Dapper是怎样工作的呢? 总 ...
- .Net 内存溢出(System.OutOfMemoryException)的常见情况和处理方式总结
.Net 内存溢出(System.OutOfMemoryException)的常见情况和处理方式总结 在什么情况下会出现OutOfMemonryException呢? 在我们试图新建一个对象时,而垃圾 ...
- .Net 内存溢出(System.OutOfMemoryException)
.Net 内存溢出(System.OutOfMemoryException) 在什么情况下会出现OutOfMemonryException呢? 在我们试图新建一个对象时,而垃圾收集器又找不到任何可用内 ...
- 内存溢出System.OutOfMemoryException
.Net 内存溢出(System.OutOfMemoryException)的常见情况和处理方式总结 在什么情况下会出现OutOfMemonryException呢? 在我们试图新建一个对象时,而垃圾 ...
- ASP.NET中出现内存溢出错误System.OutOfMemoryException
原因1:数据库服务器性能问题导致内存不够用,从而引起内存溢出 原因2:在IIS的应用程序池中进行配置,引起IIS服务器的内存分配问题,从而引起内存溢出 分析: 32位操作系统的寻址空间是 ...
- 引发类型为“System.OutOfMemoryException”的异常
在运维工作中,经常能接到客户的反馈这个:引发类型为“System.OutOfMemoryException”的异常.客户反馈物理内存都还有富余,怎么报内存不足的错误呢! 什么时候会引发System.O ...
随机推荐
- Chapter 2 Open Book——25
"My name is Edward Cullen," he continued. "I didn't have a chance to introduce myself ...
- php交叉合并数组
如数组 array1 = array('a', 'b', 'c'); array2 = array('1', '2', '3'); 希望能实现结果 array3 = array('a', '1 ...
- CentOS7 下安装 iSCSI Target(tgt) ,使用 Ceph rbd
目录 一.iSCSI 介绍 1. iSCSI 定义 2. 几种常见的 iSCSI Target 3. 优缺点比较 二.安装步骤 1. 关闭防火墙 2. 关闭selinux 3. 通过 yum 安装 t ...
- sqoop部署及使用
一.概述 sqoop是hive.hdfs.hbase等与RDMBS(mysql等)之间的沟通桥梁,主要通过JDBC与RDMBS进行交互.有两个版本sqoop1和sqoop2,sqoop1架构简单,使用 ...
- tcp/ip通信中ip头部结构iph->check校验计算
通过raw socket修改通信数据后,可通过该函数重新校验计算iph->check值 在http://www.cnblogs.com/dpf-10/p/7899237.html查看实际调用 s ...
- 微信支付开发 c# SDK JSAPI支付开发的流程和微信大坑
微信支付开发流程 1. 开通微信支付功能 省略 2. 下载微信的C#版的微信SDK 下载连接:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chap ...
- css溢出滚动条及去除滚动条的方法
<div class="father"> <div class="childern"></div> </div> ...
- Spring基础(9) : 自动扫描
一 配置xml方式:扫描com包下的bean <?xml version="1.0" encoding="UTF-8" ?> <beans ...
- C#基础知识回顾---你不知道的Lazy<T>
对象的创建方式,始终代表了软件工业的生产力方向,代表了先进软件技术发展的方向,也代表了广大程序开发者的集体智慧.以new的方式创建,通过工厂方法,利用IoC容器,都以不同的方式实现了活生生实例成员的创 ...
- Linux分区方式及关闭iptables和selinux的方式
分区方式一般有三种 第一种:数据不是很重要 /boot(系统的引导分区): 系统引导的信息/软件 系统的内核 200M swap( 交换分区): 为了避免系统内存用光了导致系统 宕机 如果系统内存 ...