8623错误:The query processor ran out of internal resources and could not pro
8623错误:The query processor ran out of internal resources and could not produce a query plan
问题描述:
配置了SQL Server安全性16的告警,发送邮件通知,如下:
收到如下告警信息:
查看错误日志:
Error: 8623, Severity: 16, State: 1.
The query processor ran out of internal resources and could not produce a query plan.
原因:
这是一个突发事件,预料中只会发生在极其复杂的查询,或者参照了非常大量的表或者分区的查询。比如,使用IN从句(多于10000个条目)SELECT记录。
解决方法:
如果是SQL Server 2008 R2及之前版本,使用Server Side Trace;如果是SQL Server 2012及之后版本,使用Extended Event。首先,跟踪到具体导致8623错误的查询。然后对查询进行优化,可以尝试将部分查询结果放到临时表中,然后再去根据条件关联。
对于IN从句,我们可以来看看BOL上的附注部分:
“
Explicitly including an extremely large number of values (many thousands of values separated by commas) within the parentheses, in an IN clause can consume resources and return errors 8623 or 8632. To work around this problem, store the items in the IN list in a table, and use a SELECT subquery within an IN clause.
Error 8623:
The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.
Error 8632:
Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.
”
其他方法:
可以尝试运行带有使用了提示option(force order)、option(hash join)、option(merge join)、option(querytraceon 4102)的计划向导的查询。通过启用跟踪标志4102,将行为转为SQL Server 2000的半连接处理。启用跟踪标志4118、4122(或者涵盖的4199)也可以避免你看到的问题。查看文档确定你的情况下的具体原因:
Microsoft Knowledge Base article for TF 4122
Microsoft Knowledge Base article for TF 4102, 4118
Microsoft Knowledge Base article for TF 4199
打相关Hotfix补丁包,或者直接升级到对应版本最新的SP包。相关KB 982376文章:
使用扩展事件识别8623错误:
在SQL Server 2012及后续版本运行以下TSQL脚本:
CREATE EVENT SESSION overly_complex_queries ON SERVER ADD EVENT sqlserver.error_reported ( ACTION (sqlserver.sql_text, sqlserver.tsql_stack, sqlserver.database_id, sqlserver.username) WHERE ([severity] = 16 AND [error_number] = 8623) ) ADD TARGET package0.asynchronous_file_target (set filename = 'E:\SQL-DATA\XE\overly_complex_queries.xel' , metadatafile = 'E:\SQL-DATA\XE\overly_complex_queries.xem', max_file_size = 10, max_rollover_files = 5) WITH (MAX_DISPATCH_LATENCY = 5SECONDS) GO -- Start the session ALTER EVENT SESSION overly_complex_queries ON SERVER STATE = START GO
该创建语句若在SQL Server 2008 R2中运行,会报如下错误:
Msg 25706, Level 16, State 8, Line 1
The event attribute or predicate source, "error_number", could not be found.
参考:
https://mssqlwiki.com/2012/10/07/optimizer-timeout-or-optimizer-memory-abort/
http://blog.rdx.com/blog/dba_tips/2014/05/using-server-trace-to-identify-8623-errors
http://jasonbrimhall.info/2014/01/02/day-9-queries-going-boom/

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
解决zabbix图形显示“方块”问题
如题所示,在Linux中安装配置好zabbix的web站点(PS:zabbix的安装和配置可以参考我的这篇文章:http://www.zifangsky.cn/576.html)之后,查看“监测中 –>图形”,显示的图形中可能会出现中文显示成“方块”的情况,如下图所示: 出现这个问题的原因是zabbix的web站点没有中文字体,因此我们给它加上一个中文字体即可 解决步骤: (1)从Windows系列系统复制一种中文字体: 控制面板->字体->复制一个中文字体 如:宋体,即:simsun.ttc (2)复制该字体文件到zabbix的web端的fonts目录下: 如:/usr/local/nginx/html/zabbix/fonts 注:字体文件的文件后缀名需要是:.ttf,因此改成:simsun.ttf (3)修改php配置文件: [root@localhost~]#cd/usr/local/nginx/html/zabbix/ [root@localhostzabbix]#viminclude/defines.inc.php 原内容如下: define(‘ZBX_G...
- 下一篇
yum 无法使用的解决方法
有一台服务器,准备使用yum安装一个软件包,结果报错,yum list,yum clean,都不能正常使用; 查找了很多资料,说是python版本的问题,结果查看也没有发现问题; 错误如下: # yum list Traceback (most recent call last): File "/usr/bin/yum", line 29, in <module> yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 298, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 110, in main base = cli.YumBaseCli() File "/usr/share/yum-cli/cli.py", line 72, in __init__ output.YumOutput.__init__(self) File "/usr/sh...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Eclipse初始化配置,告别卡顿、闪退、编译时间过长
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7
- Docker安装Oracle12C,快速搭建Oracle学习环境
- CentOS6,7,8上安装Nginx,支持https2.0的开启
- SpringBoot2整合Redis,开启缓存,提高访问速度
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- CentOS7设置SWAP分区,小内存服务器的救世主
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- CentOS7安装Docker,走上虚拟化容器引擎之路