SQL 故意在 Oracle 中引起 ORA-00600 异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21522594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Intentionally Cause ORA-00600 exception in Oracle
提问by LXandR
For testing purposes I need a couple of SQL scripts that will cause an ORA-00600
error in Oracle, version 11.1.0.7.
出于测试目的,我需要几个 SQL 脚本,它们会ORA-00600
在 Oracle 11.1.0.7 版中导致错误。
The database is not empty, it is filled with the data of a fresh install of Vision Demo E-Business Suite.
该数据库不是空的,它填充了全新安装的 Vision Demo E-Business Suite 的数据。
This system is a training ground for students studying Oracle. It will be used to develop their troubleshooting skills. Why SQL? Because this scripts reproduction should be automated. We will randomize the issue occurrence to create a model of a real bugging system for mastering troubleshooting activity.
该系统是学习甲骨文的学生的训练场。它将用于培养他们的故障排除技能。为什么是 SQL?因为这个脚本复制应该是自动化的。我们将随机出现问题,以创建一个真正的窃听系统模型,以掌握故障排除活动。
What exactly I need is 4-5 different ways to cause ORA-00600
error.
我真正需要的是 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 causingan ORA-600 error.
注意:这个问题不是要解释 ORA-600 错误是什么,或者如何解决它们。这个问题是关于故意导致ORA-600 错误的。
回答by Ben
You can't cause an ORA-00600"naturally"; it's a generic exception that covers internal Oracle exceptions. So, unless you know of an Oracle bug that causes this or want to deliberately corrupt your database you've got no chance.
你不能“自然地”导致ORA-00600;这是一个涵盖内部 Oracle 异常的通用异常。因此,除非您知道导致此问题的 Oracle 错误或想要故意破坏您的数据库,否则您没有机会。
What you cando is raise an application erroryourself, which can mimic that exception:
您可以做的是自己引发应用程序错误,它可以模仿该异常:
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
If you have to do this from SQL you can convert the above into a function:
如果必须从 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;
Then just call it:
然后只需调用它:
select raise_600 from dual
回答by paxdiablo
As per here:
按照这里:
ORA-600 is an internal error generated by the generic kernel code of the Oracle RDBMS software. It is different from other Oracle errors in many ways. Possible causes include:
- time-outs,
- file corruption,
- failed data checks in memory, hardware, memory, or I/O messages,
- incorrectly restored files
- a
SELECT FROM DUAL
statement in PL/SQL within Oracle Forms (you have to useSELECT FROM SYS.DUAL
instead!)
ORA-600 是由 Oracle RDBMS 软件的通用内核代码生成的内部错误。它在许多方面与其他 Oracle 错误不同。可能的原因包括:
- 超时,
- 文件损坏,
- 内存、硬件、内存或 I/O 消息中的数据检查失败,
- 错误恢复的文件
- 一个
SELECT FROM DUAL
Oracle表单内的PL / SQL语句(你必须使用SELECT FROM SYS.DUAL
,而不是!)
So, in order to generate these errors, you probably need to cause some serious damage to your database, not something I'd advise. The last bullet point above may be a way to do it so I'd test that first.
因此,为了产生这些错误,您可能需要对您的数据库造成一些严重损坏,我不建议这样做。上面的最后一个要点可能是一种方法,所以我会先测试一下。
回答by ThinkJet
May be all toghether we can find good examples for you ...
也许我们可以一起为您找到很好的例子......
Just to start a collection:
只是开始收集:
№1 (found here)
№1(在这里找到)
create table t(a clob);
insert into t values(utl_raw.cast_to_varchar2('EC'));
№2 Didn't return ORA-600 to client, just drops connection. But this error may be found in server logs. This case must be verified because I don't have access to test environment at the moment. Please, add a comment to indicate if such cases are interesting.
№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