Databases Reference
In-Depth Information
READ_EV Procedure
This procedure reads the level at which an event has been enabled. It returns zero for
disabled events.
Syntax
DBMS_SYSTEM.READ_EV(
iev IN BINARY_INTEGER,
oev OUT BINARY_INTEGER);
Parameters
Parameter
Description
iev
Event number; usually between 10000 and 10999
oev
Level at which the event is set; level=0 means the event is disabled
Usage Notes
DBMS_SYSTEM.READ_EV
works as expected when SQL trace has been enabled by setting event
10046, e.g., with
ALTER
SESSION
,
DBMS_MONITOR.SESSION_TRACE_ENABLE
, or
DBMS_SYSTEM.SET_EV
.
DBMS_SYSTEM.READ_EV
does not work in conjunction with
ALTER
SESSION
SET
SQL_TRACE=TRUE
in Oracle10
g
and Oracle11
g
, since the
oev
returned by
DBMS_SYSTEM.READ_EV
remains 0 when
this statement is executed (in Oracle9
i
oev=1
is returned, i.e., it works as expected in Oracle9
i
).
In the latter case,
SELECT
value
FROM
v$parameter
WHERE
name='sql_trace'
can be used to find
out whether SQL trace is switched on or not in both releases.
Examples
The following example shows that using
DBMS_MONITOR
in Oracle10
g
to enable tracing of SQL
statements and wait events sets event 10046 at level 8:
SQL> VARIABLE lev number
SQL> SET AUTOPRINT ON
SQL> EXECUTE sys.dbms_system.read_ev(10046, :lev)
PL/SQL procedure successfully completed.
LEV
----------
0
SQL> EXEC dbms_monitor.session_trace_enable
PL/SQL procedure successfully completed.
SQL> SELECT sql_trace, sql_trace_waits, sql_trace_binds FROM v$session
WHERE sid=userenv('sid')