一,Oradebug 命令 帮助文档
SQL> oradebug help
HELP [command] Describe one or all commands
SETMYPID Debug current process
SETOSPID Set OS pid of process to debug
SETORAPID ['force'] Set Oracle pid of process to debug
SETORAPNAME Set Oracle process name to debug
SHORT_STACK Get abridged OS stack--查找系统内存堆栈
CURRENT_SQL Get current SQL
DUMP [addr] Invoke named dump
DUMPSGA [bytes] Dump fixed SGA
DUMPLIST Print a list of available dumps
EVENT Set trace event in process
SESSION_EVENT Set trace event in session
DUMPVAR [level] Print/dump a fixed PGA/SGA/UGA variable
DUMPTYPE
Print/dump an address with type info
SETVAR Modify a fixed PGA/SGA/UGA variable
PEEK [level] Print/Dump memory
POKE Modify memory
WAKEUP Wake up Oracle process
SUSPEND Suspend execution
RESUME Resume execution
FLUSH Flush pending writes to trace file
CLOSE_TRACE Close trace file
TRACEFILE_NAME Get name of trace file
LKDEBUG Invoke global enqueue service debugger
NSDBX Invoke CGS name-service debugger
-G Parallel oradebug command prefix
-R Parallel oradebug prefix (return output
SETINST Set instance list in double quotes
SGATOFILE Dump SGA to file; dirname in double quotes
DMPCOWSGA Dump & map SGA as COW; dirname in double quotes
MAPCOWSGA Map SGA as COW; dirname in double quotes
HANGANALYZE [level] [syslevel] Analyze system hang
FFBEGIN Flash Freeze the Instance
FFDEREGISTER FF deregister instance from cluster
FFTERMINST Call exit and terminate instance
FFRESUMEINST Resume the flash frozen instance
FFSTATUS Flash freeze status of instance
SKDSTTPCS Helps translate PCs to names
WATCH
Watch a region of memory
DELETE watchpoint Delete a watchpoint
SHOW watchpoints Show watchpoints
DIRECT_ACCESS Fixed table access
CORE Dump core without crashing process
IPC Dump ipc information
UNLIMIT Unlimit the size of the trace file
PROCSTAT Dump process statistics
CALL [-t count] [arg1]...[argn] Invoke function with arguments
二, 跟踪当前会话信息
oradebug setmypid --跟踪当前会话
oradebug setospid --跟踪系统进程
oradebug setorapid --跟踪ORACLE进程
oradebug unlimit --取消trace文件大小限制
oradebug tracefile_name --查看trace文件名及位置
三,用oradebug做session级10046或10053
oradebug setmypid
oradebug unlimit
oradebug session_event 10046 trace name context forever ,level 4 --启用会话级10046
oradebug event 10046 trace name context off --关闭10046事件
oradebug tracefile_name --查看tracefile文件位置及文件名
四, 用oradebug做oracle process级10046
oradebug setorapid
oradebug unlimit
oradebug event 10046 trace name context forever ,level 4
oradebug event 10046 trace name context off
oradebug tracefile_name
五,oradebug系统hang住原因分析
如果系统HANG住,只要sys用户可以登陆,那么用oradebug做原因分析是非常有用的
oradebug setmypid
oradebug unlimit
oradebug setinst all --RAC环境
oradebug hanganalyze 3 -- 级别一般指定为3足够了
oradebug -g def dump systemstate 10 --RAC环境
oradebug tracefile_name
六,获取某进程的状态信息
oradebug setospid 22180
oradebug dump processstate 10
oradebug tracefile_name
七,获取进程错误信息状态
oradebug setospid 22180
oradebug dump errorstack 3
八, 追踪造成错误信息的原因,如ORA-04031
oradebug event 4031 trace name errorstack level 3
九,实例:
sqlplus / as sysdba
SQL> oradebug setmypid
Statement processed.
SQL> oradebug hanganalyze 3
等1-2分钟
SQL>oradebug hanganalyze 3
等1-2分钟
SQL> oradebug tracefile_name
Hang Analysis in /usr/app/oracle/admin/ora10g/bdump/ora10g1_diag_7056.trc
SQL> exit
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25373498/viewspace-1836818/
,如需转载,请注明出处,否则将追究法律责任。