Getting Oracle stack using Oradebug short_stack
To collect stack traces for debugging I normaly use on OS debuggers like (pstacke, gdb, dbx – it depends on which platform Oracle runs ) .From Oracle I would run oradebug commands
dump errorstack
or oradebug short_stack command.Today I will focus on oradebug short_stack
This is very fast way to obtain a stack.Some of the OS debuggers tend to be slower.
sqlplus / as as sysdba
oradebug setospid ospid ( ospid is the OS process id of the related process)
oradebug short_stack
e.g. stack for SMON process
SQL> oradebug short_stack
<-ksedsts()+315<-ksdxfstk()+32<-ksdxcb()+1764<-sspuser()+112<-000000321F40DE70<-semtimedop()+10<-sskgpwwait()+265<-skgpwwait()+135<-ksliwat()+1396<-kslwait()+574<-ktmmon()+698<-ktmSmonMain()+33<-ksbrdp()+1487<-opirip()+609<-opidrv()+554<-sou2o()+90<-opimai_real()+275<-ssthrdmain()+177<-main()+215<-__libc_start_main()+244<-_start()+41
and output is right there.No need to look trace files.If you need to record everything you can run
oradebug direct_access enable trace
oradebug tracefile_name
now I will get stack for the same process using pstack command
pstack 18632
0×0000000007793787 in sskgpwwait ()
0×0000000007792339 in skgpwwait ()
0x000000000749ceb2 in ksliwat ()
0x000000000749c49c in kslwait ()
0x0000000000ac0988 in ktmmon ()
0x0000000000ac06b1 in ktmSmonMain ()
0x000000000141ad85 in ksbrdp ()
0x0000000001552c8d in opirip ()
0x0000000000e3b186 in opidrv ()
0x00000000011e2342 in sou2o ()
0x00000000009556e5 in opimai_real ()
0x00000000011e6279 in ssthrdmain ()
0x000000000095558f in main ()
More information about these functions can be found on my previous blog Analysis of Oracle Call Stack