Answer:
Use SYS.DBMS_SYSTEM.SET_EV() procedure. Here is the specification for this procedure:
- SID: V$SESSION.SID
- SE: V$SESSION.SERIAL#
- EV: Event number. For example:
- 10046: SQL traces.
- 10053: Optimizer traces.
- NNN : ORA-NNN errors.
- 65535: IMMEDIATE traces.
- LE: Event level. For Event 10046 events:
- 0: Disable event.
- 1: PARSE, FETCH, EXEC, EXECUTION PLAN
- 4: Level 1 + BINDS
- 8: Level 1 + WAITS
- 12: Level 4 + Level 8
- NM: Event name. For example:
- ERRORSTACK.......: For error stack traces.
- PROCESSSTATE...: For process states
- SYSTEMSTATE.......: For System states.
- ''..................................: For CONTEXT FOREVER.
Sample:
Dumps PROCESSSTATE trace IMMEDIATELY in LEVEL 10:
Dumps ERRORSTACK trace in LEVEL 3 on ORA-942 error:
Dumps Event 10046 trace in LEVEL 8 for CONTEXT FOREVER:
|