Oracle PL/SQL Tutorial/System Tables Data Dictionary/SESSION LONGOPS

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

Find Long Running Queries

SQL>
SQL>
SQL>
SQL>
SQL> SELECT username,sid, serial#,
  2         TO_CHAR(CURRENT_TIMESTAMP,"HH24:MI:SS") AS curr,
  3         TO_CHAR(start_time,"HH24:MI:SS") AS logon,
  4         (sysdate - start_time)*24*60 AS mins
  5  FROM V$SESSION_LONGOPS
  6  WHERE    username is not NULL
  7    AND (SYSDATE - start_time)*24*60 > 1 ;
USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:53
74.1833333
SYS                                    38       1678 20:23:04 19:08:53
74.1833333
SYS                                    38       1678 20:23:04 19:08:53
74.1833333

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:54
74.1666667
SYS                                    38       1678 20:23:04 19:08:54
74.1666667
SYS                                    38       1678 20:23:04 19:08:54
74.1666667

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:54
74.1666667
SYS                                    38       1678 20:23:04 19:08:54
74.1666667
SYS                                    38       1678 20:23:04 19:08:54
74.1666667

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15
SYS                                    38       1678 20:23:04 19:08:55
     74.15

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333
SYS                                    38       1678 20:23:04 19:08:56
74.1333333

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:57
74.1166667
SYS                                    38       1678 20:23:04 19:08:57
74.1166667
SYS                                    38       1678 20:23:04 19:08:57
74.1166667

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
SYS                                    38       1678 20:23:04 19:08:57
74.1166667
SYS                                    38       1678 20:23:04 19:08:57
74.1166667
SYS                                    38       1678 20:23:04 19:08:57
74.1166667

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
sqle                                 27          6 20:23:04 19:29:02
54.0333333
sqle                                 27          6 20:23:04 19:29:23
53.6833333
sqle                                 27          6 20:23:04 19:29:23
53.6833333

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
sqle                                 28         96 20:23:04 19:41:08
41.9333333
sqle                                 27        525 20:23:04 19:47:15
35.8166667
sqle                                 28        357 20:23:04 20:16:37
      6.45

USERNAME                              SID    SERIAL# CURR     LOGON
------------------------------ ---------- ---------- -------- --------
      MINS
----------
sqle                                 28        357 20:23:04 20:17:53
5.18333333
sqle                                 28        359 20:23:04 20:21:36
1.46666667

44 rows selected.
SQL>
SQL>