oradebug

Oracle ORADEBUG
Version 11.1
 
GENERAL
Background Processes ListSELECT b.name, p.pid
FROM gv$bgprocess b, gv$process p
WHERE b.paddr = p.addr
ORDER BY 1;
Dispatcher Processes ListSELECT d.name, p.pid
FROM gv$dispatcher d, gv$process p
WHERE d.paddr = p.addr;
Job Queue Process ListSELECT s.paddr, s.sid, j.job
FROM gv$session s, dba_jobs_running j
WHERE s.sid = j.sid;

SELECT pid
FROM gv$process
WHERE addr = '17';
Parallel Execution Slave  Processes ListSELECT pid, server_name, status
FROM gv$px_process;
Shared Server Processes ListSELECT s.name, p.pid
FROM gv$shared_server s, gv$process p
WHERE s.paddr = p.addr;
SGA Variables ListSELECT ksmfsnam
FROM x$ksmfsv
WHERE ksmfsnam LIKE '%\_' ESCAPE '\';
Switches
SwitchFormatDescription
-G<Inst-List | def | all>Parallel oradebug command prefix
-R<Inst-List | def | all>Parallel oradebug prefix return output
 
CALL
Invoke function with argumentsoradebug call <func> [arg1] ... [argn]
SQL> oradebug call ?
 
CLOSE_TRACE
Close trace fileoradebug close_trace
SQL> oradebug close_trace
 
CORE
Dump core without crashing processoradebug core
SQL> oradebug core
 
CURRENT_SQL

Get current SQL
oradebug current_sql
SYSUWCLASS
conn / as sysdbaconn uwclass/uwclass
GRANT execute ON dbms_support
TO uwclass;
 
 SELECT pid
FROM gv$process
WHERE addr = (
  SELECT paddr
  FROM gv$session
  WHERE sid = 
  sys.dbms_support.mysid);
oradebug setorapid 26 
 SELECT t.tablespace_name
FROM all_tables t, all_indexes i
WHERE t.tablespace_name = i.tablespace_name;
oradebug core 
 
DELETE
Delete a watchpointoradebug delete <local|global|target> watchpoint <id>
SQL> oradebug delete ?
 
DIRECT_ACCESS
Fixed table accessoradebug direct_access <set/enable/disable command | select query>
TBD
 
DMPCOWSGA
Dump & map SGA as COWoradebug dmpcowsga <SGA dump dir>
SQL> oradebug dmpcowsga "c: emp"
 
DUMP
Invoke named dumporadebug dump <dump_name> <lvl> [addr]
-- dump_name values can be obtained from oradebug dumplist

SQL> oradebug setmypid
SQL> oradebug dump library_cache 4
Invoke ASH dumpSQL> oradebug setmypid
SQL> oradebug dump ashdump 10
 
DUMPLIST

Print a list of available dumps
oradebug dumplist
SQL> oradebug dumplist
 

Available Dumps

ADJUST_SCNHANGDIAG_HEADERMMAN_ALLOC_MEMORY
ALRT_TESTHEAPDUMPMMAN_CREATE_DEF_REQUEST
ARCHIVE_ERRORHEAPDUMP_ADDRMMAN_CREATE_IMM_REQUEST
ASHDUMPHM_FW_TRACEMMAN_IMM_REQUEST
ATSK_TESTINSTANTIATIONSTATEMMON_TEST
AWR_FLUSH_TABLE_OFFIOERREMULMODIFIED_PARAMETERS
AWR_FLUSH_TABLE_ONIOERREMULRNGNEXT_SCN_WRAP
AWR_TESTIR_FW_TRACEOBJECT_CACHE
BC_SANITY_CHECKJAVAINFOOCR
BG_MESSAGESKCBO_OBJ_CHECK_DUMPOLAP_DUMP
BLK0_FMTCHGKDLIDMPOPEN_FILES
BUFFERKRA_OPTIONSPGA_DETAIL_CANCEL
BUFFERSKRA_TRACEPGA_DETAIL_DUMP
CALLSTACKKRB_BSET_DAYSPGA_DETAIL_GET
CHECK_ROREUSE_SANITYKRB_CORRUPT_INTERVALPIN_BLOCKS
CONTEXTAREAKRB_CORRUPT_REPEATPIN_RANDOM_BLOCKS
CONTROLFKRB_CORRUPT_SIZEPOKE_ADDRESS
CROSSICKRB_CORRUPT_SPBAD_INTERVALPOKE_LENGTH
CRSKRB_CORRUPT_SPBAD_REPEATPOKE_VALUE
CSSKRB_CORRUPT_SPBITMAP_INTERPOKE_VALUE0
CURSOR_STATSKRB_CORRUPT_SPBITMAP_REPEAPOOL_SIMULATOR
CURSORDUMPKRB_CORRUPT_SPHEADER_INTERPROCESSSTATE
CURSORTRACEKRB_CORRUPT_SPHEADER_REPEAREALFREEDUMP
DATA_ERR_OFFKRB_FAIL_INPUT_FILENORECORD_CALLSTACK
DATA_ERR_ONKRB_OPTIONSRECOVERY
DBSCHEDULERKRB_OVERWRITE_ACTIONREDOHDR
DROP_SEGMENTSKRB_PIECE_FAILREDOLOGS
DUMP_ADV_SNAPSHOTSKRB_SET_TIME_SWITCHREFRESH_OS_STATS
DUMP_ALL_COMP_GRANULESKRB_SIMULATE_NODE_AFFINITYROW_CACHE
DUMP_ALL_COMP_GRANULE_ADDRKRB_TRACERULESETDUMP
DUMP_ALL_OBJSTATSKRB_UNUSED_OPTIONRULESETDUMP_ADDR
DUMP_ALL_REQSKRBMRSR_LIMITSAVEPOINTS
DUMP_PINNED_BUFFER_HISTORYKRBMROR_LIMITSELFTESTASM
DUMP_TEMPKRC_TRACESET_NBLOCKS
DUMP_TRANSFER_OPSKSDTRADV_TESTSET_TSN_P1
DUMPGLOBALDATAKSFQP_LIMITSHARED_SERVER_STATE
ENQUEUESKSKDUMPTRACESIMULATE_EOV
ERRORSTACKKTPR_DEBUGSYSTEMSTATE 
EVENT_TSM_TESTKSTDUMPALLPROCSSYSTEMSTATE_GLOBAL
EXCEPTION_DUMPKSTDUMPALLPROCS_CLUSTERTEST_DB_ROBUSTNESS
FAILOVERKSTDUMPCURPROCTEST_GET_CALLER
FBHDRKUPPLATCHTESTTEST_SPACEBG
FBINCKXFPCLEARSTATSTEST_STACK_DUMP
FBTAILKXFPDUMPTRACETR_CRASH_AFTER_WRITE 
FILE_HDRSKXFPBLATCHTESTTR_CORRUPT_ONE_SIDE
FLASHBACK_GENKXFXCURSORSTATETR_READ_ONE_SIDE 
FLUSH_CACHEKXFXSLAVESTATETR_SET_ALL_BLOCKS
FLUSH_JAVA_POOLLATCHESTR_SET_BLOCK 
FULL_DUMPSLDAP_KERNEL_DUMPTR_SET_SIDE
GC_ELEMENTSLDAP_USER_DUMPTRACE_BUFFER_OFF 
GES_STATELIBRARY_CACHETRACE_BUFFER_ON
GLOBAL_AREALOCKSTREEDUMP 
HANGANALYZELOGERRORTR_RESET_NORMAL
HANGANALYZE_PROCLOGHISTUPDATE_BLOCK0_FORMAT
HANGANALYZE_GLOBALLONGF_CREATEWORKAREATAB_DUMP
 
DUMPSGA
Dump fixed SGAoradebug dumpsga

oradebug dumpsga <bytes>
SQL> oradebug dumpsga
c:\oracle\product\admin\orabase\udump\orabase_ora_2120.trc
 
DUMPTYPE
Print/dump an address with type infooradebug dumptype <address> <type> <count>
TBD
 
DUMPVAR
Print/dump a fixed PGA/SGA/UGA variableoradebug dumpvar <pga|sga|uga> <name> [level]
SQL> oradebug setmypid
SQL> oradebug dumpvar SGA kcbnbh
 
EVENT
Set trace event in processoradebug EVENT <event> 
TRACE NAME CONTEXT FOREVER, LEVEL <level>
SQL> oradebug setmypid

SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12

SQL> oradebug unlimit
 
FFBEGIN
Flash Freeze the Instanceoradebug ffbegin
SQL> oradebug ffbegin
 
FFDEREGISTER
FF deregister instance from clusteroradebug ffderegistger
SQL> oradebug ffderegister
 
FFRESUMEINST
Resume the flash frozen instanceoradebug ffresumeinst
SQL> oradebug ffresumeinst
 
FFSTATUS
Flash freeze status of instanceoradebug ffstatus
SQL> oradebug ffstatus
 
FFTERMINST
Call exit and terminate instanceoradebug ffterminst
SQL> oradebug ffterminst
 
FLUSH
Flush the current contents of the trace buffer to the trace file useoradebug flush
SQL> oradebug flush
 
HANGANALYZE

Analyze system hang for stand-alone
oradebug hanganalzye [level] [syslevel]
SQL> oradebug setmypid;
SQL> oradebug hanganalyze;
SQL> oradebug flush;
Analyze system hang for RACSQL> oradebug setmypid;
SQL> oradebug -g def hanganalyze 1
SQL> oradebug flush;
 
HELP
Describe one or all commands oradebug help

oradebug help <command>
SQL> oradebug help
SQL> oradebug help flush
 
LKDEBUG
Invoke global enqueue service debuggeroradebug lkdebug
SQL> oradebug lkdebug
 
MAPCOWSGA
Map SGA as COWoradebug mapcowsga <SGA dump dir>
SQL> oradebug mapcowsga "c: emp"
 
NSDBX
Invoke CGS name-service debuggeroradebug nsdbx
SQL> oradebug nsdbx
 
PEEK
Print/Dump memoryoradebug peek <addr> <len> [level]
SQL> oradebug peek 0x20005F0C 12
 
POKE
Modify memory. Never perform this function on a production database!oradebug poke <addr> <len> <value>
SQL> oradebug poke 0x20005F0C 4 0x46495845
 
PROCSTAT
Dump process statisticsoradebug procstat
SQL> oradebug setmypid

SQL> oradebug procstat
 
RESUME
Resume executionoradebug resume
SQL> oradebug resume
 
SESSION_EVENT
Set trace event in sessionoradebug session_event <text>
SQL> oradebug session_event 10053 TRACE NAME CONTEXT FOREVER, LEVEL 1
 
SETINST
Set instance listoradebug setinst <instance# .. | all>
SQL> oradebug setinst "1"
 
SETMYPID
Sets the oradebug PID to the current processoradebug setmypid
SQL> oradebug setmypid
 
SETORAPID

Set PID of Oracle process to debug
oradebug setorapid <orapid> ['force']
SELECT pid
FROM gv$process 
WHERE addr = (
  SELECT paddr
  FROM gv$session
  WHERE sid = DBMS_SUPPORT.MYSID);

or

SELECT pid
FROM gv$process 
WHERE addr = (
  SELECT paddr
  FROM gv$session
  WHERE sid = (SELECT sid FROM gv$mystat WHERE ROWNUM = 1));

/*
or one of the processes from the background, dispatcher, job queue, parallel, or shared server process lists
*/

SQL> oradebug setorapid 19
 
SETOSPID
Set OS pid of process to debug

The operating system process ID is the PID on Unix systems and the thread number for Windows systems
oradebug setospid <ospid>
Do not use as it often fails. Use setorapid instead.
 
SETORAPNAME
Set Oracle process name to debugoradebug setorapname <orapname>
TBD
 
SETVAR
Modify a fixed PGA/SGA/UGA variableoradebug setvar <pga|sga|uga> <name> <value>
SQL> oradebug setvar SGA kcfdfk 200
 
SGATOFILE
Dump SGA to fileoradebug sgatofile <SGA dump dir>
SQL> oradebug ffbegin
SQL> oradebug sgatofile "c: emp"
SQL> oradebug ffresumeinst
 
SHORT_STACK
Get abridged OS stackoradebug short_stack
SQL> oradebug short_stack
 
SHOW
Show watchpointsoradebug show <local|global|target> watchpoint <id>
SQL> oradebug show?
 
SKDSTTPCS
Helps translate PCs to namesoradebug skdsttpcs <ifname> <ofname>
SQL> oradebug skdsttpcs?
 
SUSPEND
Suspends the current processoradebug suspend
SQL> oradebug suspend
 
TRACEFILE_NAME
Get trace file name

Will not return a value on Windows systems
oradebug tracefile_name
SQL> oradebug tracefile_name
 
UNLIMIT
Unlimit the size of the trace fileoradebug unlimit
SQL> oradebug unlimit
 
WAKEUP
Wake up Oracle processoradebug wakeup <orapid>
SELECT pid
FROM gv$process
WHERE addr = (
  SELECT paddr
  FROM gv$bgprocess
  WHERE name = 'SMON');

SQL> oradebug wakeup 7
 
WATCH
Watch a region of memoryoradebug watch <address> <len> <self|exist|all|target>
SQL> oradebug watch?
 
Demo

Taking a heap dump during a large (sorting) query
-- This example requires two sessions, session 1 logged on SYS AS SYSDBA and session 2 which 
-- executes the query. In session 2 identify the PID using


SELECT pid
FROM gv$process
WHERE addr IN (
  SELECT paddr 
  FROM gv$session
  WHERE sid = dbms_support.mysid);

In this example the PID was 12

In session 1 set the Oracle PID using

ORADEBUG SETORAPID 12

In session 2 start the query

SELECT ... FROM t1 ORDER BY ....

In session 1 suspend session 2

ORADEBUG SUSPEND

The query in session 2 will be suspended

In session 1 run the heap dump

ORADEBUG DUMP HEAPDUMP 1

The heapdump will show the memory structures allocated for the sort. At this point further dumps e.g. subheap dumps can be taken.

In session 1 resume session 2

ORADEBUG RESUME

The query in session 2 will resume execution
 
Related Topics
Dumping Oracle
Trace & TKPROF

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值