To use oradebug one first needs to connect to a session using the process id or ora pid.
One can do so by doing one of the following, the following example shows how to connect using OS process id or oracle PID or current session.
SELECT a.username, a.sid, a.serial#, b.spid, b.pid
FROM v$session a, v$process b
WHERE a.paddr = b.addr
AND a.username = 'SCOTT';
USERNAME SID SERIAL# SPID PID
—————————— ———- ———- ———— ———-
SCOTT 25 920 7106 14
SQL> !ps -ef | grep 7106
oracle 7106 6778 0 21:05 ? 00:00:00 oracleTEST (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
Connect using operating system (OS) process id:
SQL> oradebug setospid 7106
Oracle pid: 14, Unix process pid: 7106, image: oracle@localhost.localdomain (TNS V1-V3)
Connecting using oracle pid:
SQL> oradebug setorapid 14
Unix process pid: 7106, image: oracle@localhost.localdomain (TNS V1-V3)
Connect to current session
SQL> oradebug setmypid
Statement processed.