Oracle子查询内部错误

时间:2015-05-14 05:35:57

标签: oracle oracle10g

清单1中的查询连接两个子查询,这两个子查询都是从两个命名子查询(ANIMAL和SEA_CREATURE)计算得出的。输出应列出不住在海中的动物,并列出住在海中的动物。

在控制台窗口(SQL Navigator 5.5)中运行时,服务器返回错误:

15:21:30  ORA-00600: internal error code, arguments: [evapls1], [], [], [], [], [], [], []

为什么?以及如何解决这个问题?

有趣的是,我可以在用Delphi XE7编写的程序中运行相同的查询(使用TSQLQuery组件),它运行正常。但这不是SQL Navigator的问题。如果我创建包含清单1中的表达式的视图,则从视图中选择不会输出错误。问题出在oracle服务器上。

如果我使ANIMAL子查询非常简单,如清单2所示,它可以工作。但是其他任何东西,即使只是从表中选择,都会导致内部错误。

清单1 :(输出错误)

with ANIMAL as (
  select ANIMAL_NAME
    from xmltable( 't/e' passing xmltype( '<t><e>Tuna</e><e>Cat</e><e>Dolphin</e><e>Swallow</e></t>')
                  columns
                    ANIMAL_NAME varchar2(100) path 'text()')),

SEA_CREATURE as (
  select           'Tuna' as CREATURE_NAME from dual
  union all select 'Shark'    from dual
  union all select 'Dolphin'  from dual
  union all select 'Plankton' from dual)

select NONSEA_ANIMALS, SEA_ANIMALS
  from (

  select stringagg( ANIMAL_NAME) as NONSEA_ANIMALS
    from (      (select * from ANIMAL)
          minus (select CREATURE_NAME as ANIMAL_NAME from SEA_CREATURE))),

  (select stringagg( ANIMAL_NAME) as SEA_ANIMALS
    from ANIMAL
    where ANIMAL_NAME in
      (select CREATURE_NAME as ANIMAL_NAME from SEA_CREATURE))

清单2 :(这有效)

with ANIMAL as (
  select           'Tuna' as ANIMAL_NAME from dual
  union all select 'Cat'     from dual
  union all select 'Dolphin' from dual
  union all select 'Swallow' from dual),

SEA_CREATURE as (
  select           'Tuna' as CREATURE_NAME from dual
  union all select 'Shark'    from dual
  union all select 'Dolphin'  from dual
  union all select 'Plankton' from dual)

select NONSEA_ANIMALS, SEA_ANIMALS
  from (

  select stringagg( ANIMAL_NAME) as NONSEA_ANIMALS
    from (      (select * from ANIMAL)
          minus (select CREATURE_NAME as ANIMAL_NAME from SEA_CREATURE))),

  (select stringagg( ANIMAL_NAME) as SEA_ANIMALS
    from ANIMAL
    where ANIMAL_NAME in
      (select CREATURE_NAME as ANIMAL_NAME from SEA_CREATURE));

清单3:清单1和清单中表达式的预期输出2:

NONSEA_ANIMALS    SEA_ANIMALS
-------------------------------
'Cat,Swallow'    'Tuna,Dolphin'

Oracle横幅如清单4所示。

清单4:从v $ version

中选择*
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0  Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production

这种疯狂是如何解释的?

更新

这是解释计划......

PLAN_TABLE_OUTPUT

----------------------------------------------------------------------------
| Id  | Operation                            | Name                        |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT                     |                             |
|   1 |  TEMP TABLE TRANSFORMATION           |                             |
|   2 |   LOAD AS SELECT                     |                             |
|   3 |    VIEW                              |                             |
|   4 |     COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE      |
|   5 |   LOAD AS SELECT                     |                             |
|   6 |    UNION-ALL                         |                             |
|   7 |     FAST DUAL                        |                             |
|   8 |     FAST DUAL                        |                             |
|   9 |     FAST DUAL                        |                             |
|  10 |     FAST DUAL                        |                             |
|  11 |   NESTED LOOPS                       |                             |
|  12 |    VIEW                              |                             |
|  13 |     SORT AGGREGATE                   |                             |
|  14 |      VIEW                            |                             |
|  15 |       MINUS                          |                             |
|  16 |        SORT UNIQUE                   |                             |
|  17 |         VIEW                         |                             |
|  18 |          TABLE ACCESS FULL           | SYS_TEMP_0FD9D6666_765BCCBD |
|  19 |        SORT UNIQUE                   |                             |
|  20 |         VIEW                         |                             |
|  21 |          TABLE ACCESS FULL           | SYS_TEMP_0FD9D6667_765BCCBD |
|  22 |    VIEW                              |                             |
|  23 |     SORT AGGREGATE                   |                             |
|  24 |      HASH JOIN RIGHT SEMI            |                             |
|  25 |       VIEW                           | VW_NSO_1                    |
|  26 |        VIEW                          |                             |
|  27 |         TABLE ACCESS FULL            | SYS_TEMP_0FD9D6667_765BCCBD |
|  28 |       VIEW                           |                             |
|  29 |        TABLE ACCESS FULL             | SYS_TEMP_0FD9D6666_765BCCBD |
----------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:0)

ORA-03113ORA-6000通常在使用WITH子句查询时发生 执行时发生了致命的事。

Oracle的子查询因子WITH子句有时会被过度使用。 Oracle可以为WITH子句内的每个查询创建一个全局临时表,以便重用结果。所以,这里XMLTABLE()可能在这里创建了另一个GTT,这可能会导致数据库崩溃。

  

COLLECTION ITERATOR PICKLER FETCH是从...获取的东西   PL / SL对象。 It returns pickled(packed and formatted) data

     

它可能涉及在我之前提到的下面创建一些临时表。因此子查询因子和PL / Sql数组选择并不顺利。

我还看到UNION ALL嵌套 WITH的查询已崩溃。

这是Oracle中的大多数错误,应该向他们报告。

现在解决这个问题的唯一方法就是改革查询。在我们的应用程序中,WITH的使用受到严格限制(由于高CPU使用率),仅用于作为批处理执行的报告。