6

For testing purposes I need a couple of SQL scripts that will cause an ORA-00600 error in Oracle, version 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.

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.

What exactly I need is 4-5 different ways to cause ORA-00600 error.

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.

Jon Heller
  • 34,999
  • 6
  • 74
  • 132
LXandR
  • 69
  • 1
  • 1
  • 4
  • `ORA-00600` probably means you've stumbled upon Oracle bug. – Egor Skriptunoff Feb 03 '14 at 08:34
  • Exactly, and I want to find some easy ways to reproduce it at will. – LXandR Feb 03 '14 at 09:29
  • According to [this page](http://www.orafaq.com/wiki/ORA-00600) at orafaq.com the following are possible causes for an ORA-00600: 1. time-outs, 2. file corruption, 3. failed data checks in memory, hardware, memory, or I/O messages, 4. incorrectly restored files, 5. a SELECT FROM DUAL statement in PL/SQL within Oracle Forms (you have to use SELECT FROM SYS.DUAL instead!). So there's a list of things to try. May fortune favor your efforts! – Bob Jarvis - Слава Україні Feb 03 '14 at 12:04
  • Most of such errors depends on concrete very special conditions such as a operating system, patches installed, DB engine update history, data size, database service configuration and so on. Therefore it's not a good point to learn something generic and really useful from my point of view. Anyway, at most cases education database must meet conditions for all bugs found to reproduce such errors. – ThinkJet Feb 06 '14 at 22:12
  • From another point of view more interesting task for students is how to introduce ORA-600 by modifying DB files. E.g. modify file storage to cause ORA-600 by querying a specific record ... :) – ThinkJet Feb 06 '14 at 22:16
  • @ThinkJet Yes, most errors depend on a lot of specifics. But there are many relatively simple SQL statements that only use DUAL and can generate an ORA-600 error across many different configurations. Finding them may be tough, that's why I offered the bounty. – Jon Heller Feb 06 '14 at 22:23
  • @jonearles Ok, but to find really working examples we need more information. At least results of `select * from v$version`. – ThinkJet Feb 06 '14 at 22:54
  • You can try to invoke `[kghalo4]` with `ORA-00600` on versions 11.2.0.1 to 11.2.0.3, that is, if you have not already applied patch:10360383 (ORA-00600[kghalo4] errors during secure LOB insert/updates). Refer Oracle Support note id 1352876.1 if you can. Also, chances are slim that the error would appear on screen. – Anjan Biswas Feb 06 '14 at 23:25
  • Please refer this http://www.dba-oracle.com/t_ora_00600_internal_error_code_arguments_string_%20string_string_string_string_string_string.htm – Avrajit Feb 07 '14 at 06:58
  • @Annjawn and Avrajit: There are many posts in this thread explaining the theory behind ORA-600 errors. Now we need specific examples that work with 11.1.0.7. – Jon Heller Feb 07 '14 at 14:40
  • @jonearles The example I gave is a specific example of `ORA-00600 [KGHALO4]` error, but the DB version is 11.2+. Will do some research on 11.1 specifically. – Anjan Biswas Feb 07 '14 at 19:28

3 Answers3

5

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.

What you can do is raise an application error yourself, 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:

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
Ben
  • 51,770
  • 36
  • 127
  • 149
  • 1
    Good idea. But unfortunately, that's not what I need. I gotta correct the question a bit, I suppose. – LXandR Feb 03 '14 at 09:24
  • 2
    I know that's not exactly what you need @user3265017; you mention SQL and I tell you how to do it in SQL... corrupt your database or find an Oracle bug that causes this (or turn this into a function to do that). – Ben Feb 03 '14 at 09:26
  • Anyway, thank you for your help. i'm currently looking for a bug that suits my requirements. – LXandR Feb 03 '14 at 09:32
3

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 use SELECT FROM SYS.DUAL instead!)

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.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • I see your point, thank you. I will update my question with some clarifications. My database is a training ground for students, so, data safety is not the thing we should worry about. – LXandR Feb 03 '14 at 09:25
1

May be all toghether we can find good examples for you ...

Just to start a collection:

№1 (found here)

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.

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
ThinkJet
  • 6,725
  • 24
  • 33
  • 1
    Without using metalink well done! The problem with these is you're _not_ getting ORA-00600 in SQL... – Ben Feb 09 '14 at 20:56