首页 文章

故意导致Oracle中的ORA-00600异常

提问于
浏览
4

出于测试目的,我需要一些SQL脚本,这些脚本会在Oracle 11.1.0.7版中导致 ORA-00600 错误 .

数据库不是空的,它充满了全新安装的Vision Demo电子商务套件的数据 .

该系统是学习Oracle的学生的培训场所 . 它将用于开发他们的故障排除技能 . 为何选择SQL?因为这个脚本的复制应该是自动的 . 我们将随机化问题发生,以创建一个真正的窃听系统模型,用于掌握故障排除活动 .

我究竟需要的是4-5种不同的方法来导致 ORA-00600 错误 .

Note: This question is not about explaining what an ORA-600 error is, or how to troubleshoot them. This question is about intentionally causing an ORA-600 error.

3 回答

  • 3

    你不能导致ORA-00600 "naturally";它没有机会 .

    你可以做的是raise an application error你自己,可以模仿那个例外:

    declare
       internal_exception EXCEPTION;
       PRAGMA EXCEPTION_INIT( internal_exception, -600 );
    begin
      raise internal_exception;
    end;
    /
    declare
    *
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [], [], [], [], [], [], [], [], [], [], [], []
    ORA-06512: at line 5
    

    如果必须从SQL执行此操作,则可以将上述内容转换为函数:

    create or replace function raise_600 return number is
       internal_exception EXCEPTION;
       PRAGMA EXCEPTION_INIT( internal_exception, -600 );
    begin
      raise internal_exception;
      return 1;
    end;
    

    然后就叫它:

    select raise_600 from dual
    
  • 1

    根据here

    ORA-600是由Oracle RDBMS软件的通用内核代码生成的内部错误 . 它在很多方面与其他Oracle错误不同 . 可能的原因包括:超时,文件损坏,内存中的数据检查失败,硬件,内存或I / O消息,错误恢复的文件Oracle Forms中的PL / SQL中的SELECT FROM DUAL语句(必须使用SELECT FROM SYS) .DUAL而不是!)

    因此,为了产生这些错误,您可能需要对数据库造成严重损害,而不是我建议的那样 . 上面的最后一个要点可能是一种方法,所以我先测试一下 .

  • 5

    也许我们可以为你找到好的例子......

    刚开始收藏:

    №1(找到here

    create table t(a clob);
    
    insert into t values(utl_raw.cast_to_varchar2('EC'));
    

    №2没有将ORA-600返回给客户端,只是连接丢弃 . 但是这个错误可能在服务器日志中找到 . 必须验证此案例,因为此刻我无法访问测试环境 . 请添加评论以表明此类案例是否有趣 .

    create table t1(id number);
    create table t2(id number);
    
    insert into t1(id) values(1);
    insert into t1(id) values(2);
    insert into t2(id) values(1);
    insert into t2(id) values(2);
    
    select 
      ta.id
    from 
      t1 ta
      join (
        select id 
        from t2 
        start with id = 1 connect by prior id + 1= id 
      ) tb 
        on prior ta.id = tb.id
    start with 
      ta.id = 2
    connect by 
      prior ta.id - 1 = ta.id
    

相关问题