设为首页 收藏本站
查看: 1824|回复: 0

8623错误:The query processor ran out of internal resources and could not pro

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-23 09:11:20 | 显示全部楼层 |阅读模式
8623错误:The query processor ran out of internal resources and could not produce a query plan

问题描述:

配置了SQL Server安全性16的告警,发送邮件通知,如下:
wKiom1fjhwHDi9xiAAA4Bow09PM399.jpg

收到如下告警信息:
wKiom1fjhwOjQ2HQAABnD8IEC9k152.jpg

查看错误日志:
wKiom1fjhwWj9sjmAACK6Zwtds4440.jpg
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文章:
FIX: A non-yielding scheduler error or an error 8623 occurs when you run a query that contains a large IN clause in SQL Server 2005, SQL Server 2008, or SQL Server 2008 R2

使用扩展事件识别8623错误:

在SQL Server 2012及后续版本运行以下TSQL脚本:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-276238-1-1.html 上篇帖子: win7系统没有自带word excell ppt等软件,正版又太贵,怎么才能弄到免密钥的这些软件 下篇帖子: 假如我是科研人员,,那么侠客电脑侠客与精英电脑系统精英??? processor resources
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表