Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intentionally Cause ORA-00600 exception in Oracle

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.

like image 492
LXandR Avatar asked Feb 03 '14 08:02

LXandR


2 Answers

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
like image 79
Ben Avatar answered Sep 21 '22 08:09

Ben


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.

like image 33
paxdiablo Avatar answered Sep 20 '22 08:09

paxdiablo