当数据库出现一些挂起状态时,如果sqlplus仍然可以连接,可能视图查询没有相应,但是可以通过oradebug工具来进行进程及系统状态信息的转储,从而可以进行Hang分析。
DUMP进程状态可以使用:
alter sessions set events 'immediate trace name processstate level
或者使用:
oradebug setmypid当诊断数据库挂起条件时可以DUMP系统状态:
oradebug ulimit
oradebug dump processstate
alter sessions set events 'immediate trace name systemstate level
或:
oradebug setmypid
oradebug ulimit
oradebug dump systemstate
如果为了获取全面一点的信息,可以使用Level 10。
SQL>oradebug setmypid
SQL>oradebug unlimit
SQL>oradebug dump systemstate 10
今天一个朋友的请求帮助,获得的系统状态如下: System State 1
~~~~~~~~~~~~~~~~
1:
2: waiting for 'pmon timer' wait
3: waiting for 'rdbms ipc message' wait
4: waiting for 'rdbms ipc message' wait
5: waiting for 'rdbms ipc message' wait
6: waiting for 'rdbms ipc message' wait
7: waiting for 'rdbms ipc message' wait
8: waiting for 'buffer busy waits' (2,9,11) wait
9: waiting for 'rdbms ipc message' wait
10: waiting for 'rdbms ipc message' wait
11: waiting for 'log file switch (archiving needed)' wait
12: waiting for 'rdbms ipc message' wait
13:
14:
15: waiting for 'log file switch (archiving needed)' wait
16: waiting for 'library cache lock' [LOCK: handle=20e750ca8] wait
17: waiting for 'rdbms ipc message' wait
18: waiting for 'rdbms ipc message' wait
19: waiting for 'buffer busy waits' (2,59,1b) wait
Cmd: Select
20: waiting for 'log file switch (archiving needed)' wait
21: waiting for 'Streams AQ: qmn coordinator idle wait' wait
22: waiting for 'SQL*Net message from client' wait
23: waiting for 'SQL*Net message from client' wait
24: waiting for 'library cache lock' [LOCK: handle=20e750ca8] wait
25: waiting for 'buffer busy waits' (1,2ba2,1) wait
26: last wait for 'SQL*Net message from client'
…………………………………………………………………
243:waiting for 'log file switch (archiving needed)' wait
Cmd: Select
248:waiting for 'SQL*Net message from client' wait
249:waiting for 'SQL*Net message from client' wait
250:waiting for 'SQL*Net message from client' wait
251:waiting for 'SQL*Net message from client' wait
252:waiting for 'log file switch (archiving needed)' wait
…………………………………………………………………
273:waiting for 'log file switch (archiving needed)' wait
Cmd: Insert
Blockers
~~~~~~~~
Above is a list of all the processes. If they are waiting for a resource
then it will be given in square brackets. Below is a summary of the
waited upon resources, together with the holder of that resource.
Notes:
~~~~~
o A process id of '???' implies that the holder was not found in the
systemstate.
Resource Holder State
LOCK: handle=20e750ca8 15: waiting for 'log file switch (archiving needed)'
Object Names
~~~~~~~~~~~~
LOCK: handle=20e750ca8 TABL:EXFSYS.RLM$EVTCLEANUP
显然是归档满了,导致了系统挂起。