Little oradebug enhancement in Oracle 11g

There’s a command called: ORADEBUG SETORAPNAME in 11g.

It allows you to attach to a named background process as shown below, so you don’t need to figure out what’s the PID or SPID of the target process.

SQL> oradebug setorapname dbw0
Oracle pid: 9, Unix process pid: 5506, image: oracle@linux03 (DBW0)
SQL>
SQL> oradebug setorapname pmon
Oracle pid: 2, Unix process pid: 5490, image: oracle@linux03 (PMON)
SQL>

Even though you probably don’t want to mess around with background processes in production DBs, in demos and just Oracle research it can help you save couple of seconds every now and then.

Note that this year’s only Advanced Oracle Troubleshooting class takes place in the end of April/May 2014, so sign up now if you plan to attend this year!

This entry was posted in Oracle and tagged , , , . Bookmark the permalink.

6 Responses to Little oradebug enhancement in Oracle 11g

  1. A reader says:

    Thank You;-)
    Nice improvement to oradebug.

  2. Miladin says:

    In the past I have to wakeup SMON:

    SQL> oradebug setorapname smon
    Oracle pid: 19, Unix process pid: 12777, image: oracle@demo01 (SMON)
    SQL> oradebug wakeup 19
    Statement processed.

    Save me time running this query:

    SQL> select pid
    from v$process p, v$bgprocess b
    where b.paddr = p.addr
    and name=’SMON’; 2 3 4

    PID
    ———-
    19

  3. Tanel-

    Nice find with oradebug. I enjoy your blog since we both have a passion for database internals.

    Cheers,
    Ben

  4. prodlife says:

    Is there a way to name the shadow process from within a session? (In a dedicated connection environment, of course). That could really make life easier when doing demos, research, etc.

  5. Tanel Poder says:

    Hi Chen,

    I have such a script which accepds SID as parameter as attaches to its corresponding process like this:

    SQL> @odsid 170
    Oracle pid: 2, Windows thread id: 2920, image: ORACLE.EXE (PMON)

    The script contents are following:

    —————————-

    SET TERMOUT OFF
    COL spid NEW_VALUE odsid_spid
    SELECT spid FROM v$process WHERE addr = (SELECT /*+ NO_UNNEST */ paddr FROM v$session WHERE sid = &1);
    COL spid CLEAR
    SET TERMOUT ON

    ORADEBUG SETOSPID &odsid_spid

    —————————-

    Also you could write an “init” script which intializes sqlplus variables like lgwr, dbw0 etc.

    so you could just run “@odsid &lgwr” when doing the demo

  6. niccisweden says:

    informative for me, like that

    injectable filler

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>