Index   Search   Add FAQ   Ask Question  

Please note: This page is not maintained anymore. Please visit the new and improved FAQ at http://www.orafaq.com/faq/internals

Oracle Database Internals FAQ

$Date: 26-Apr-2002 $
$Revision: 1.02 $
$Author: Frank Naudé $

WARNING: This FAQ is for informational purposes only. Check with Oracle Support before using the information below.

Topics

  • What is the difference between locks, latches, enqueues and semaphores?
  • Where can one get a list of all hidden Oracle parameters?
  • What is a database EVENT and how does one set it?
  • What database events can be set?
  • How can one dump internal database structures?
  • How does one use ORADEBUG from Server Manager/ SQL*Plus?
  • Are there any undocumented commands in Oracle?
  • What is in all those X$ tables?
  • Handy X$table queries
  • Oracle Kernel Subsystems

  • Back to top of file

  • Where can one get a list of all hidden Oracle parameters?

    Oracle initialization or INIT.ORA parameters with an underscore in front are hidden or unsupported parameters. One can get a list of all hidden parameters by executing this query: The following query displays parameter names with their current value:

    Remember: Thou shall not play with undocumented parameters!

  • Back to top of file

  • What is a database EVENT and how does one set it?

    Oracle trace events are useful for debugging the Oracle database server. The following two examples are simply to demonstrate syntax. Refer to later notes on this page for an explanation of what these particular events do.

    Events can be activated by either adding them to the INIT.ORA parameter file. E.g.

    	 event='1401 trace name errorstack, level 12'
    
    ... or, by issuing an ALTER SESSION SET EVENTS command: E.g.
    	 alter session set events '10046 trace name context forever, level 4';
    
    The alter session method only affects the user's current session, whereas changes to the INIT.ORA file will affect all sessions once the database has been restarted.

  • Back to top of file

  • What database events can be set?

    The following events are frequently used by DBAs and Oracle Support to diagnose problems: The following list of events are examples only. They might be version specific, so please call Oracle before using them:

    Note: You can use the Unix oerr command to get the description of an event. On Unix, you can type "oerr ora 10053" from the command prompt to get event details.

  • Back to top of file

  • How can one dump internal database structures?

    The following (mostly undocumented) commands can be used to obtain information about internal database structures.
    
    -- Dump control file contents
    alter session set events 'immediate trace name CONTROLF level 10'
    /
    
    -- Dump file headers
    alter session set events 'immediate trace name FILE_HDRS level 10'
    /
    
    -- Dump redo log headers
    alter session set events 'immediate trace name REDOHDR level 10'
    /
    
    -- Dump the system state
    -- NOTE: Take 3 successive SYSTEMSTATE dumps, with 10 minute intervals
    alter session set events 'immediate trace name SYSTEMSTATE level 10'
    /
    
    -- Dump the process state
    alter session set events 'immediate trace name PROCESSSTATE level 10'
    /
    
    -- Dump Library Cache details
    alter session set events 'immediate trace name library_cache level 10'
    /
    
    -- Dump optimizer statistics whenever a SQL statement is parsed (hint: change statement or flush pool)
    alter session set events '10053 trace name context forever, level 1'
    /
    
    -- Dump a database block (File/ Block must be converted to DBA address)
    -- Convert file and block number to a DBA (database block address). Eg:
            variable x varchar2;
            exec :x := dbms_utility.make_data_block_address(1,12);
            print x
    alter session set events 'immediate trace name blockdump level 50360894'
    /
    
    

  • Back to top of file

  • How does one use ORADEBUG from Server Manager/ SQL*Plus?

    Execute the "ORADEBUG HELP" command from svrmgrl or sqlplus to obtain a list of valid ORADEBUG commands. Look at these examples:
    
            SQLPLUS> REM Trace SQL statements with bind variables
            SQLPLUS> oradebug setospid 10121
            Oracle pid: 91, Unix process pid: 10121, image: oracleorcl
            SQLPLUS> oradebug EVENT 10046 trace name context forever, level 12
            Statement processed.
            SQLPLUS> ! vi /app/oracle/admin/orcl/bdump/ora_10121.trc
    
    
            SQLPLUS> REM Trace Process Statistics
            SQLPLUS> oradebug setorapid 2
            Unix process pid: 1436, image: ora_pmon_orcl
            SQLPLUS> oradebug procstat
            Statement processed.
            SQLPLUS> oradebug TRACEFILE_NAME
            /app/oracle/admin/orcl/bdump/pmon_1436.trc
    
    
            SQLPLUS> REM List semaphores and shared memory segments in use
            SQLPLUS> oradebug ipc
    
    
            SQLPLUS> REM Dump Error Stack
            SQLPLUS> oradebug setospid <pid>
            SQLPLUS> oradebug event immediate trace name errorstack level 3
    
    
            SQLPLUS> REM Dump Parallel Server DLM locks
            SQLPLUS> oradebug lkdebug -a convlock
            SQLPLUS> oradebug lkdebug -a convres
            SQLPLUS> oradebug lkdebug -r <resource handle> (i.e 0x8066d338 from convres dump)
    

  • Back to top of file

  • Are there any undocumented commands in Oracle?

    Sure there are, but it is hard to find them. Look at these examples:
  • Back to top of file

  • What is in all those X$ tables?

    The following list attempts to describe some x$ tables. The list may not be complete or accurate, but represents an attempt to figure out what information they contain. One should generally not write queries against these tables as they are internal to Oracle, and Oracle may change them without any prior notification.
  • Back to top of file

  • Handy X$table queries

    Some handy queries based on the X$ memory tables:

  • Largest # blocks you can write at any given time:
    	select kviival write_batch_size
    	from   x$kvii where kviitag = 'kcbswc';

  • See the gets and waits for different types of enqueues:
    	select * from x$ksqst
    	where  ksqstget > 0;

  • Back to top of file

  • Oracle Kernel Subsystems

    Listed below are some of the important subsystems in the Oracle kernel. This table might help you to read those dreaded trace files and internal messages. For example, if you see messages like this, you will at least know where they come from:

            OPIRIP: Uncaught error 447. Error stack:
            KCF: write/open error block=0x3e800 online=1
    
    Kernel Subsystems:
  • Back to top of file
  • HOME | ASK QUESTION | ADD FAQ | SEARCH | E-MAIL US