1 Reply Latest reply: Jul 15, 2011 12:16 AM by bllewell-Oracle RSS

    Missing Edition name and DBMS_OUTPUT ora-0600

    21205
      Hi,
      While playing around with Edition Based Redefinition I ran into something strange. Here is my script:
      SQL> set echo on
      SQL> col "Current_Edition" format a20
      SQL> col object_name format a20
      SQL> 
      SQL> select sys_context('userenv'
        2                    ,'current_edition_name'
        3                    ) "Current_Edition"
        4    from dual
        5  /
      
      Current_Edition                                                                                                         
      --------------------                                                                                                    
      ORA$BASE                                                                                                                
      
      1 row selected.
      
      SQL> 
      SQL> create or replace
        2  procedure hello
        3  is
        4  begin
        5     dbms_output.put_line ('Hello World');
        6  end hello;
        7  /
      
      Procedure created.
      
      SQL> 
      SQL> begin
        2     hello;
        3  end;
        4  /
      Hello World                                                                                                             
      
      PL/SQL procedure successfully completed.
      
      SQL> 
      SQL> select object_name
        2       , object_type
        3       , edition_name
        4    from user_objects_ae
        5   where object_name = 'HELLO'
        6  /
      
      OBJECT_NAME          OBJECT_TYPE         EDITION_NAME                                                                   
      -------------------- ------------------- ------------------------------                                                 
      HELLO                PROCEDURE                                                                                          
      
      1 row selected.
      
      SQL> 
      Notice how the Edition_name column is empty...

      SQL> 
      SQL> create edition R1 as child of ora$base
        2  /
      
      Edition created.
      
      SQL> 
      SQL> 
      SQL> alter session set edition = R1
        2  /
      
      Session altered.
      
      SQL> 
      SQL> create or replace
        2  procedure hello
        3  is
        4  begin
        5     dbms_output.put_line ('Hello Universe');
        6  end hello;
        7  /
      
      Procedure created.
      
      SQL> 
      SQL> begin
        2     hello;
        3  end;
        4  /
      Hello Universe                                                                                                          
      
      PL/SQL procedure successfully completed.
      
      SQL> 
      SQL> select object_name
        2       , object_type
        3       , edition_name
        4    from user_objects_ae
        5   where object_name = 'HELLO'
        6  /
      
      OBJECT_NAME          OBJECT_TYPE         EDITION_NAME                                                                   
      -------------------- ------------------- ------------------------------                                                 
      HELLO                PROCEDURE                                                                                          
      
      1 row selected.
      There should be two entries there, one for ORA$BASE and one for R1...

      SQL> 
      SQL> conn sys/oracle@xe11 as sysdba
      Connected.
      SQL> 
      SQL> ALTER DATABASE DEFAULT EDITION = r1
        2  /
      
      Database altered.
      
      SQL> drop edition ora$base
        2  /
      drop edition ora$base
                   *
      ERROR at line 1:
      ORA-38805: edition is in use 
      
      
      SQL> drop edition ora$base cascade
        2  /
      
      Edition dropped.
      After a shutdown (of my VM), I get this message when using DBMS_OUTPUT:
      SQL> begin
        2     hello;
        3  end;
        4  /
      begin
      *
      ERROR at line 1:
      ORA-22303: type "SYS"."DBMSOUTPUT_LINESARRAY" not found
      ORA-00600: internal error code, arguments: [kkaegen_get_edition_name_1], [], [], [], [], [], [], [], [], [], [], []
      ORA-06508: PL/SQL: could not find program unit being called: "PUBLIC.DBMS_OUTPUT"
      ORA-06512: at "ALEX.HELLO", line 4
      ORA-06512: at line 2
      By looking at it, I get a feeling that it has something to do with EBR...

      Alex
        • 1. Re: Missing Edition name and DBMS_OUTPUT ora-0600
          bllewell-Oracle
          This is a genuine bug, not specific to XE. Here is a minimal testcase:

          -- Use a fresh-from-the-seed database
          CONNECT Sys/Sys@11202 AS SYSDBA
          create edition e1 as child of Ora$Base
          /
          alter session set edition = e1
          /
          alter database default edition = e1
          /
          -- Wait for MMON to switch over
          begin DBMS_Lock.Sleep(5); end;
          /
          drop edition Ora$Base cascade
          /
          SHUTDOWN IMMEDIATE
          STARTUP
          -- Causes ORA-00600
          begin DBMS_Output.Put_Line('Hello'); end;
          /

          I filed bug 12758386.

          Notice that all other reported problems were user errors. I've explained those in an offline email exchange with Alex.