Tanel Poder’s blog: Core IT for Geeks and Pros

November 3, 2008

Little oradebug enhancement in Oracle 11g

Filed under: Administration, Internals, Oracle, Oracle 11g, Troubleshooting — Tanel Poder @ 2:47 am

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.

Bookmark and Share

5 Comments »

  1. Thank You;-)
    Nice improvement to oradebug.

    Comment by A reader — November 4, 2008 @ 2:43 pm

  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

    Comment by Miladin — November 7, 2008 @ 5:29 am

  3. Tanel-

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

    Cheers,
    Ben

    Comment by Ben Prusinski — November 11, 2008 @ 4:54 am

  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.

    Comment by prodlife — November 12, 2008 @ 1:03 pm

  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

    Comment by Tanel Poder — November 13, 2008 @ 7:10 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress