在之前的HangAnalyze 中有使用oradebug命令,在这篇文章里,我们主要是重点看一下这个oradebug命令:
Oracle HANGANALYZE 功能诊断 DB hanging
http://blog.csdn.net/tianlesoftware/archive/2011/04/13/6321961.aspx
一. Oradebug 命令 帮助文档
SYS@dave2(db2)> oradebug help
Command
|
Arguments
|
Description
|
HELP
|
[command]
|
Describe one or all commands
|
SETMYPID
|
|
Debug current process
|
SETOSPID
|
<ospid>
|
Set OS pid of process to debug
|
SETORAPID
|
<orapid> ['force']
|
Set Oracle pid of process to debug
|
DUMP
|
<dump_name> <lvl> [addr]
|
Invoke named dump
|
DUMPSGA
|
[bytes]
|
Dump fixed SGA
|
DUMPLIST
|
|
Print a list of available dumps
|
EVENT
|
<text>
|
Set trace event in process
|
SESSION_EVENT
|
<text>
|
Set trace event in session
|
DUMPVAR
|
<p|s|uga> <name> [level]
|
Print/dump a fixed PGA/SGA/UGA variable
|
SETVAR
|
<p|s|uga> <name> <value>
|
Modify a fixed PGA/SGA/UGA variable
|
PEEK
|
<addr> <len> [level]
|
Print/Dump memory
|
POKE
|
<addr> <len> <value>
|
Modify memory
|
WAKEUP
|
<orapid>
|
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
|
<Inst-List | def | all>
|
Parallel oradebug command prefix
|
-R
|
<Inst-List | def | all>
|
Parallel oradebug prefix (return output)
|
SETINST
|
<instance# .. | all>
|
Set instance list in double quotes
|
SGATOFILE
|
<SGA dump dir>
|
Dump SGA to file; dirname in double quotes
|
DMPCOWSGA
|
<SGA dump dir>
|
Dump & map SGA as COW; dirname in double quotes
|
MAPCOWSGA
|
<SGA dump dir>
|
Map SGA as COW; dirname in double quotes
|
HANGANALYZE
|
[level]
|
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
|
<ifname> <ofname>
|
Helps translate PCs to names
|
WATCH
|
<address> <len> <self|exist|all|target>
|
Watch a region of memory
|
DELETE
|
<local|global|target> watchpoint <id>
|
Delete a watchpoint
|
SHOW
|
<local|global|target> watchpoints
|
Show watchpoints
|
CORE
|
|
Dump core without crashing process
|
UNLIMIT
|
|
Unlimit the size of the trace file
|
PROCSTAT
|
|
Dump process statistics
|
CALL
|
<func> [arg1] ... [argn]
|
Invoke function with arguments
|
1.1 TRACEFILE_NAME command
This command prints the name of the current trace file e.g.
SQL>oradebug tracefile_name
For example
/export/home/admin/SS92003/udump/ss92003_ora_14917.trc
This command does not work on Windows 2000 (Oracle 9.2)
1.2 UNLIMIT command
In Oracle 8.1.5 and below the maximum size of the trace file is restricted by default. This means that large dumps (LIBRARY_CACHE, BUFFERS) may fail.
To remove the limitation on the size of the trace file use
SQL>oradebug unlimit
In Oracle 8.1.6 and above the maximum size of the trace file defaults to UNLIMITED
1.3 FLUSH command
To flush the current contents of the trace buffer to the trace file use
SQL>oradebug flush
1.4 CLOSE_TRACE command
To close the current trace file use
SQL>oradebug close_trace
二. 追踪进程
如果是系统的进程ID,可以使用oradebug setospid id.
如果是根据Oracle ID,可以使用oradebug setorapid id 来追踪。
2.1 查询进程ID
可以查询Linux系统的pid或是oracle自己的pid:
SYS@dave2(db2)> select a.username,a.sid ,a.serial#,b.spid from v$session a,v$process b where a.paddr=b.addr;
USERNAME SID SERIAL# SPID
---------- ---------- ---------- ------------
SYS 159 1702 27028
查询spid
SYS@dave2(db2)> select pid,spid,username from v$process;
PID SPID USERNAME
---------- ------------ ----------
18 27028 oracle
v$process 下的pid 是Oracle 的ID。spid 是系统的ID。
2.2 设定追踪
SYS@dave2(db2)> oradebug setospid 27028 -- 根据系统ID
Oracle pid: 18, Unix process pid: 27028, image: oracledave2@db2
或者使用,他们是一样的:
SYS@dave2(db2)> oradebug setorapid 18 --根据Oracle ID
Unix process pid: 27028, image: oracledave2@db2
2.3 dump 相关文件信息
指定为SID 之后,就可以使用dump 将相关的信息,这些dump 内容很多。 可以使用dumplist 把所有的dump 可列出来。
具体使用,可以参考:
http://psoug.org/reference/oradebug.html
SYS@dave2(db2)> oradebug dumplist
EVENTS
TRACE_BUFFER_ON
TRACE_BUFFER_OFF
HANGANALYZE
LATCHES
PROCESSSTATE
SYSTEMSTATE
INSTANTIATIONSTATE
REFRESH_OS_STATS
CROSSIC
CONTEXTAREA
HEAPDUMP
HEAPDUMP_ADDR
POKE_ADDRESS
POKE_LENGTH
POKE_VALUE
POKE_VALUE0
GLOBAL_AREA
MEMORY_LOG
REALFREEDUMP
FLUSH_JAVA_POOL
POOL_SIMULATOR
PGA_DETAIL_GET
PGA_DETAIL_DUMP
PGA_DETAIL_CANCEL
MODIFIED_PARAMETERS
EVENT_TSM_TEST
ERRORSTACK
CALLSTACK
HANGANALYZE_PROC
TEST_STACK_DUMP
TEST_GET_CALLER
RECORD_CALLSTACK
EXCEPTION_DUMP
BG_MESSAGES
ENQUEUES
KSTDUMPCURPROC
KSTDUMPALLPROCS
SIMULATE_EOV
KSFQP_LIMIT
KSKDUMPTRACE
DBSCHEDULER
LDAP_USER_DUMP
LDAP_KERNEL_DUMP
DUMP_ALL_OBJSTATS
DUMPGLOBALDATA
HANGANALYZE_GLOBAL
GES_STATE
OCR
CSS
CRS
CREATE_DUMMY_REQUEST
MMAN_ALLOC_MEMORY
MMAN_CREATE_REQUEST
MMAN_CREATE_IMM_REQUEST
DUMP_ALL_COMP_GRANULE_ADDRS
DUMP_ALL_COMP_GRANULES
DUMP_ALL_REQS
DUMP_TRANSFER_OPS
DUMP_ADV_SNAPSHOTS
ADJUST_SCN
NEXT_SCN_WRAP
CONTROLF
FLUSH_CACHE
FULL_DUMPS
BUFFERS
RECOVERY
SET_TSN_P1
BUFFER
PIN_BLOCKS
BC_SANITY_CHECK
PIN_RANDOM_BLOCKS
SET_NBLOCKS
CHECK_ROREUSE_SANITY
DUMP_PINNED_BUFFER_HISTORY
REDOLOGS
LOGHIST
ARCHIVE_ERROR
REDOHDR
LOGERROR
OPEN_FILES
DATA_ERR_ON
DATA_ERR_OFF
BLK0_FMTCHG
UPDATE_BLOCK0_FORMAT
TR_SET_BLOCK
TR_SET_ALL_BLOCKS
TR_SET_SIDE
TR_CRASH_AFTER_WRITE
TR_READ_ONE_SIDE
TR_CORRUPT_ONE_SIDE
TR_RESET_NORMAL
TEST_DB_ROBUSTNESS
LOCKS
GC_ELEMENTS
FILE_HDRS
KRB_CORRUPT_INTERVAL
KRB_CORRUPT_SIZE
KRB_CORRUPT_REPEAT
KRB_PIECE_FAIL
KRB_OPTIONS
KRB_FAIL_INPUT_FILENO
KRB_SIMULATE_NODE_AFFINITY
KRB_TRACE
KRB_BSET_DAYS
KRB_SET_TIME_SWITCH
KRBMRSR_LIMIT
KRBMROR_LIMIT
KRC_TRACE
KRA_OPTIONS
KRA_TRACE
FBTAIL
FBINC
FBHDR
FLASHBACK_GEN
DROP_SEGMENTS
KTPR_DEBUG
TREEDUMP
LONGF_CREATE
ROW_CACHE
LIBRARY_CACHE
CURSORDUMP
CURSORTRACE
CURSOR_STATS
SHARED_SERVER_STATE
JAVAINFO
KXFPCLEARSTATS
KXFPDUMPTRACE
KXFPBLATCHTEST
KXFXSLAVESTATE
KXFXCURSORSTATE
WORKAREATAB_DUMP
KUPPLATCHTEST
OBJECT_CACHE
SAVEPOINTS
RULESETDUMP
RULESETDUMP_ADDR
OLAP_DUMP
SELFTESTASM
IOERREMUL
ALRT_TEST
AWR_TEST
AWR_FLUSH_TABLE_ON
AWR_FLUSH_TABLE_OFF
ASHDUMP
MMON_TEST
SYS@dave2(db2)>
在这些dump选项中,大部分都有2,4,6,8,10,12等几个跟踪级别。在使用的时候要根据具体的情况来选择级别,不同级别的影响不一样。
2.3.1 获得系统状态
如果为了获取全面一点的信息,可以使用Level 10。
SYS@dave2(db2)> oradebug setospid 27028
Oracle pid: 18, Unix process pid: 27028, image: oracledave2@db2
SYS@dave2(db2)> oradebug unlimit
Statement processed.
SYS@dave2(db2)> oradebug dump systemstate 10
Statement processed.
SYS@dave2(db2)> oradebug TRACEFILE_NAME
/u01/app/oracle/admin/dave2/udump/dave2_ora_27028.trc
SYS@dave2(db2)> oradebug close_trace
Statement processed.
[oracle@db2 ~]$ tail -50 /u01/app/oracle/admin/dave2/udump/dave2_ora_27028.trc
last process to post me: none
last post sent: 0 0 0
last post sent-location: No post
last process posted by me: none
(latch info) wait_event=0 bits=0
Process Group: DEFAULT, pseudo proc: 0x2e24c604
O/S info: user: , term: , ospid:
OSD pid info: Unix process pid: 0, image: PSEUDO
Dump of memory from 0x2E207970 to 0x2E207AF4
2E207970 00000000 00000000 00000000 00000000 [................]
Repeat 23 times
2E207AF0 00000000 [....]
NO DETACHED BRANCHES.
NO DETACHED NETWORK CONNECTIONS.
CLEANUP STATE OBJECTS:
----------------------------------------
SO: 0x2e03465c, type: 1, owner: (nil), flag: INIT/-/-/0x00
(cleanup state object) description: instance enqueue anchor state
latch: 0x2000502c
----------------------------------------
SO: 0x2e3b9bc0, type: 5, owner: 0x2e03465c, flag: INIT/-/-/0x00
(enqueue) TA-00000006-00000001 DID: 0001-000F-0000000D
lv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 flag: 0x2
res: 2d8362f4, mode: X, prv: 2d8362fc, own: 0, sess: 0
----------------------------------------
SO: 0x2e0346a0, type: 1, owner: (nil), flag: INIT/-/-/0x00
(cleanup state object) description: switchable channel handle anch
latch: 0x200059cc
----------------------------------------
SO: 0x2d87ac7c, type: 11, owner: 0x2e0346a0, flag: INIT/-/-/0x00
(broadcast handle) flag: (c2) ACTIVE SUBSCRIBER, owner: (nil),
<span
分享到:
相关推荐
Oracle错误代码大全是一个庞大的知识库,囊括了各种Oracle错误代码的解释说明。下面是 Oracle 错误代码大全中的部分知识点: 会话错误 * ORA-00001: 违反唯一约束条件(.) * ORA-00021: 会话附属于其它某些进程;...
设置完毕后,可以通过oraDEBUG命令启动跟踪并记录特定的会话信息,或打开和关闭数据库跟踪。这些操作要求用户对Oracle数据库有深入了解,并且具备一定的操作权限。 文档还介绍了Oracle数据库中的基本概念和名词解释...
### Oracle 11g 错误码大全解析 #### ORA-00001: 违反唯一约束条件 **描述**: 当尝试插入或更新一个已经存在的唯一键值时触发此错误。确保数据符合唯一性约束。 **解决方法**: - 检查并修改数据,确保不会重复...
- **DIAG:** 数据库诊断进程,维护诊断转储文件,执行oradebug命令。 - **DIA0:** 另一个数据库诊断进程,检测Oracle数据库中的挂起和死锁问题。 - **PSP0:** 进程生成器,用于产生Oracle进程。 - **SMCO:** 空间...
如果在ORADEBUG命令中使用了无效的例程号,会抛出此错误。确保例程号正确。 #### ORA-00090: 未能将内存分配给群集数据库ORADEBUG命令 如果无法为群集数据库的ORADEBUG命令分配内存,会触发此错误。检查内存分配...
当在ORADEBUG命令中使用的例程号无效时触发。 #### ORA-00090: 未能将内存分配给群集数据库ORADEBUG命令 当未能为群集数据库分配内存时触发。 #### ORA-00091: LARGE_POOL_SIZE至少必须为 当 `LARGE_POOL_SIZE` 的...
在执行ORADEBUG命令操作时,若不能为群集数据库分配内存,则会遇到该错误,可能需要检查集群环境配置或内存资源状况。 - ORA-00096: 值对参数无效,它必须来自之间。该错误表明某个参数的值不在预定的有效范围内。...
**ORA-00090: 未能将内存分配给群集数据库ORADEBUG命令** - **描述**: 无法为ORADEBUG命令分配内存。 - **解决方法**: 确保有足够的内存资源。 **ORA-00091: LARGE_POOL_SIZE至少必须为...** - **描述**: LARGE_...
##### 4、使用`Oradebug`设置 示例: - 首先查找会话的spid ``` SQL> SELECT ADDR, PID, SPID FROM V$PROCESS WHERE ADDR = C000000084435AD8'; ``` #### 深入解析10053事件 10053事件是Oracle用于跟踪硬解析...
##### orA-00090: 未能将内存分配给群集数据库orADEBUG命令 - **描述**:未能为orADEBUG命令分配内存。 - **解决方法**:确保有足够的可用内存。 ##### orA-00091: LARGE_POOL_SIZE至少必须为... - **描述**:LARGE...
### ORACLE错误一览表知识点详解 ...- **描述**:在群集数据库环境下,ORADEBUG命令未能成功分配内存。 - **解决方法**: - 检查内存资源是否足够。 - 考虑增加相关内存配额。 ##### ORA-00091: LARGE_POOL...
#### ORA-00090: 未能将内存分配给群集数据库ORADEBUG命令 在尝试为群集数据库分配内存以执行ORADEBUG命令时失败。 #### ORA-00091: LARGE_POOL_SIZE至少必须为 `LARGE_POOL_SIZE`参数的值低于系统要求的最小值,...
在使用ORADEBUG命令时,如果提供的例程号无效,则会触发此错误。确认例程号的正确性。 #### ORA-00090:未能将内存分配给群集数据库ORADEBUG命令 当ORADEBUG命令试图在群集数据库环境中分配内存,但因资源限制失败...
- 事件10046是一个常用的跟踪事件,可以收集详细的执行计划和调用堆栈信息,使用`ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER,LEVEL 12`命令开启。 3. **收集性能数据**: - SQL Trace工具能够收集SQL语句...