1.immediate dump:
alter session set events 'immediate trace name level '
这里的可以是controlf、redohdr、file_hdrs、systemstate、processstate
如:alter session set events 'immediate trace name controlf level 10';
同理的:oradebug dump controlf 10;
同理的:exec dbms_system.set_ev(7,10,65535,10,'controlf');
上面的65535指immediate。因此:alter session set events '65535 trace name controlf level 10';也是可以的。
2.on-error dump:
event=" trace name errorstack level "
alter session set events ' trace name errorstack level ';
oradebug event trace name errorstack level ;
注意ora-3113的errornum不适用,ora-3113是"end-of-file on communication channel"
on-error dump的level 级别有3个:
1.error stack and function call stack(if implemented)
2. as 1 plus process states
3. as 2 plus context area(all cursor and current cursor highlighted)
3.change behavior:
通常用在初始化文件中。
event=" trace name context forever,level"
4.trace events:
event=" trace name context forever,level "
alter session set events ' trace name context forever,level ';
alter system set events ' trace name context forever,level ';
trace eventd level 有4个级别:
1.enable standard sql_trace functionality(默认)
4.as 1 plus trace bind values
8.as level 1 plus wait
12.as level 1 plus both bind values and wait
hang和loop的区别:
1、hang:
等待的东西never happen.
cpu使用比较低。
用v$session_wait/v$lock/v$latch/v$latchholder来诊断。
2、loop:
等待的东西not going to happen。
cpu使用常常100%,且有大量active事务。
也用v$session_wait/v$lock/v$latch/v$latchholder来诊断。
对于hang问题,用v$session_wait来诊断