Intentionally Cause ORA-00600 exception in Oracle

LXandR picture LXandR · Feb 3, 2014 · Viewed 27.1k times · Source

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.

Answer

Ben picture Ben · Feb 3, 2014

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