Oracle PL/SQL/System Tables Views/session event — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 13:45, 26 мая 2010

Query v$session_event

 
SQL>
SQL> set echo on
SQL>
SQL> create global temporary table sess_event on commit preserve rows as select * from v$session_event where 1=0;
Table created.
SQL>
SQL> truncate table sess_event;
Table truncated.
SQL>
SQL> insert into sess_event select * from v$session_event where sid = ( select sid from v$mystat where rownum = 1 );
22 rows created.
SQL>
SQL> select a.event,
  2         (a.total_waits-nvl(b.total_waits,0)) total_waits,
  3         (a.time_waited-nvl(b.time_waited,0)) time_waited
  4    from ( select * from v$session_event where sid = (select sid from v$mystat where rownum = 1 )) a,
  5         sess_event b
  6   where a.event = b.event(+) and (a.total_waits-nvl(b.total_waits,0)) > 0
  7  /
EVENT
--------------------------------------------------
TOTAL_WAITS TIME_WAITED
----------- -----------
SQL*Net message to client
          5           0
SQL*Net message from client
          4          11

2 rows selected.
SQL>
SQL>
SQL> drop table sess_event;
drop table sess_event
           *
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an
index on temporary table already in use

SQL> --