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文章:

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脚本:

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://blogs.technet.microsoft.com/mdegre/2012/03/13/8623-the-query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan/

http://dba.stackexchange.com/questions/28945/query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan

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/

时间: 2024-10-29 02:48:17

8623错误:The query processor ran out of internal resources and could not pro的相关文章

SQL Server捕获发生The query processor ran out of internal resources and could not produce a query plan...错误的SQL语句

最近收到一SQL Server数据库服务器的告警邮件,告警内容具体如下所示: DATE/TIME: 10/23/2018 4:30:26 PM DESCRIPTION:  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 querie

VisualSVN错误 Cannot query proxy blanket解决办法

最近重新做了一下系统,在安装和使用svn过程中遇到了一些问题,记下备忘. 第一次安装好系统之后,安装VisualSVN遇到报错: Custom action InstallWMISchemaExcute failed: Cannot query proxy blanket: No such interface supported (0x80004002) 在网上上搜索了半天,也没找到解决办法.无奈之下又重新装了一遍系统,这次安装VisualSVN过程比较顺利,直接通过了,运行也没有问题.好景不长

关于mysql的错误 - no query specified

Mysql----error:no query specified mysql下抛出错误:error:no query specified出现此错误是sql不合法原因:如:select * from abc\G;或者select * from abc;; \G后面不需要再加分号; mysql> select * from giftcdkey where actID=2012322\G; *************************** 1. row ********************

Mysql错误:Ignoring query to other database解决方法

今天登陆mysql show databases出现Ignoring query to other database错误,又试了几个命令和sql全部提示Ignoring query to other database错误 错误如下: D:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -rootWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection

解决maven编译错误:程序包com.sun.xml.internal.ws.spi不存在

当maven项目里面有用到JDK内部的一些类,接口(如:com.sun.xml.internal.ws.spi.ProviderImpl)等的时候,用maven编译一般会出现如下错误 [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.105 s [INFO] Finished at: 2016-04-26

eclipse启动错误:java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer

转自:http://blog.csdn.net/niu_hao/article/details/9332521 eclipse启动时报错如下:java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer解决方法:可能是丢失部分起动文件,解决... eclipse启动时报错如下: java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer 解

数据库常见告警项

数据库常见告警项原创 Hehuyi_In 最后发布于2019-01-04 10:14:08 阅读数 1026 收藏展开 遇到的错误号,错误原因.处理方法及参考文档小结数据库类型     报错号     原因     参考     建议Oracle     ORA-609 The ORA-609 error is thrown when a client connection of any kind failed to complete or aborted the connection proc

Microsoft SQL Server Version List(SQL Server 版本)

原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches, hotfixes and other builds of MS SQL Server 2014, 2012, 2008 R2, 2008, 2005, 2000, 7.0, 6.5 and 6.0 tha

关于expdp 中query用法小结

今天看到群里有人问到关于在使用expdp导出数据中使用query参数报错的解决方法,自己也出于好奇心瞎折腾了一把,现记录如下 1.第一次尝试的时候 [[email protected] ~]$ expdp scott/scott tables=emp1 dumpfile=emp1.dmp logfile=emp1.log query=emp1:"where rownum < 5"   Export: Release 11.2.0.4.0 - Production on 星期日 6