1、诊断事件
#10046
oradebug setospid 12345 #setospid 指的是spid (v$process)
#或oradebug setorapid 12345 #setorapid 指的是pid (v$process)
oradebug unlimt #解除对追踪文件大小限制
oradebug event 10046 trace name context forever ,level 12
...
oradebug event 10046 trace name context off
oradebug tracefile_name
#10053
oradebug setospid 12345
oradebug setorapid 12345
oradebug unlimt
oradebug event 10053 trace name context forever ,level 1
...
oradebug event 10053 trace name context off
oradebug tracefile_name
example:
SQL> select spid,pid from v$process where addr=(select paddr from v$session where sid=493); --对sid=493回话进行监控
SPID PID
------------------------ ----------
12787 42
SQL> oradebug help
SQL> oradebug setospid 12787 #12787 是回话spid 号(v$process)
Oracle pid: 42, Unix process pid: 12787, image: [email protected]
SQL> oradebug unlimit;
Statement processed.
SQL> oradebug tracefile_name
/oracle/app/oracle/diag/rdbms/shihfa1/shihfa/trace/shihfa_ora_12787.trc
SQL> oradebug event 10046 trace name context forever ,level 12
Statement processed.
----sid=493执行操作
SQL> oradebug event 10046 trace name context off;
Statement processed.
2、诊断系统信息
模拟系统hang住
[[email protected] bdump]$ sqlplus -prelim ‘/ as sysdba‘
SQL*Plus: Release 10.2.0.5.0 - Production on Fri May 20 10:48:32 2016
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug dump systemstate 266
Statement processed.
SQL> oradebug dump systemstate 266
Statement processed.
SQL> oradebug tracefile_name
/u01/app/oracle/admin/db1/udump/db1_ora_11807.trc