Database Reference
In-Depth Information
Attaching to a process that belongs to a RAC instance on another node in the same cluster
is not implemented. The commands, their arguments, and how to obtain argument values are
summarized in Table 37-1.
Table 37-1. Attaching to a Process with ORADEBUG
Command
Purpose
ORADEBUG SETMYPID
Attach to your own server process
ORADEBUG SETORAPID pid
Attach to a foreign process, where pid equals V$PROCESS.PID
ORADEBUG SETOSPID spid
Attach to a foreign process, where spid equals V$PROCESS.SPID
SETMYPID
In case you wanted to run a few SQL or PL/SQL statements in your own session to record
performance metrics and execution plans, you would use ORADEBUG SETMYPID .
SQL> ORADEBUG SETMYPID
Statement processed.
SQL> ORADEBUG UNLIMIT
Statement processed.
SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 8
Statement processed.
SQL> SELECT ... /* run whatever statements you want to trace */
SQL> ORADEBUG TRACEFILE_NAME
/opt/oracle/obase/admin/TEN/udump/ten1_ora_24953.trc
SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT OFF
Statement processed.
The preceding example is a full-fledged scenario for tracing your own session. ORADEBUG
UNLIMIT has the same effect as ALTER SESSION SET MAX_DUMP_FILE_SIZE=UNLIMITED , except that it
affects the attached process. ORADEBUG EVENT sets an event in the attached process (see also Part
3 of this topic). ORADEBUG TRACEFILE_NAME retrieves the trace file name used by the attached
process. Note that the trace file name is subject to change by the session-level parameter
TRACEFILE_IDENTIFIER . Tracing with ORADEBUG EVENT occurs at process level, not database session
level. When using a dedicated server, the effect is the same. Yet, when tracing is enabled in a
shared server process, all the database sessions serviced by a certain shared server process are
traced. When dealing with Shared Server, use the package DBMS_SYSTEM to set events at session
level (see Chapter 20).
SETOSPID
A scenario for SETOSPID is when you see an ORACLE process that consumes a lot of CPU with a
tool such as top (any UNIX platform), prstat (Solaris), glance (HP-UX), or nmon (AIX). You would
then attach to the process and enable SQL trace with event 10046 at level 8 or 12. Here's an
example:
 
Search WWH ::




Custom Search