Little oradebug enhancement in Oracle 11g

November 3rd, 2008

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.

  • Share/Bookmark

Tanel Poder
Administration, Internals, Oracle, Oracle 11g, Troubleshooting

  1. Trackbacks

  2. No trackbacks yet.
  1. Comments

  2. A reader
    November 4th, 2008 at 14:43 | #1

    Thank You;-)
    Nice improvement to oradebug.

  3. November 7th, 2008 at 05:29 | #2

    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

  4. November 11th, 2008 at 04:54 | #3

    Tanel-

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

    Cheers,
    Ben

  5. prodlife
    November 12th, 2008 at 13:03 | #4

    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.

  6. November 13th, 2008 at 07:10 | #5

    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

  7. August 18th, 2009 at 10:07 | #6

    informative for me, like that

    injectable filler