forked from fatdba/Oracle-Database-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sessions_active.sql
40 lines (37 loc) · 1.17 KB
/
sessions_active.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
PROMPT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROMPT------ /) (\
PROMPT------ .-._((,~~.))_.-,
PROMPT------ `-. @@ ,-'
PROMPT------ / ,o--o. \
PROMPT------ ( ( .__. ) )
PROMPT------ ) `----' (
PROMPT------ / \
PROMPT------ / \
PROMPT------ / \
PROMPT------ "The Silly Cow"
PROMPT----- Script: sessions_active.sql
PROMPT----- Author: Prashant 'The FatDBA'
PROMPT----- Version: V1.1 (Date: 04-02-2019)
PROMPT-----
PROMPT-----
PROMPT-----
set linesize 200 trimspool on
set pagesize 50
col username for a30
col event format a30
SELECT
NVL(s.username,s.program) username
, s.sid sid
, s.serial# serial
, s.sql_hash_value sql_hash_value
, SUBSTR(DECODE(w.wait_time
, 0, w.event
, 'ON CPU'),1,15) event
, w.p1 p1
, w.p2 p2
, w.p3 p3
from v$session s
, v$session_wait w
where w.sid=s.sid
and s.status='ACTIVE'
AND s.type='USER';