Using “oradebug dump errorstack <dump level>” one can dump the call stack of the process after attaching to a running session. There are 3 values that can be passed as dump level
0 – dump error buffer
1 – level 0 with call stack
2 – level 1 with process state
3 – level 2 with context area
Example:
— Attach to a process
SQL> oradebug setospid 21906;
Oracle pid: 17, Unix process pid: 21906, image: [email protected] (TNS V1-V3)
SQL> oradebug dump errorstack 3;
Statement processed.
SQL> oradebug tracefile_name;
/u01/oradata/admin/TEST/udump/test_ora_21906.trc
Information in the trace file:
…
*** 2020-03-30T04:18:37.721348-07:00 (CDB$ROOT(1))
Received ORADEBUG command (#12) 'DUMP HANGANALYZE_PROC 1' from process '22275'
*** 2020-03-30T04:18:37.735302-07:00 (CDB$ROOT(1))
-------------------------------------------------------------------------------
HUNG PROCESS DIAGNOSTIC DUMP BEGIN:
-------------------------------------------------------------------------------
----- Current SQL Statement for this session (sql_id=31ukahvuufxzt) -----
/* SQL Analyze(1526,0) */ SELECT /*+PARALLEL(1) NO_STATEMENT_QUEUING */ * FROM X$KXFTASK /*kpdbInstanceTas
k,PDB_INSTANCE_TASK*/
*** 2020-03-30T04:18:37.735440-07:00 (CDB$ROOT(1))
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
-------------------- -------- -------------------- ----------------------------
ksedst1()+95 call kgdsdst() 7FFEA079C1C0 000000003
7FFEA07964F0 ? 7FFEA0796608 ?
...