From 2d012907db70ff8df4df1334e7690bb8c7423b70 Mon Sep 17 00:00:00 2001 From: Yacine31 Date: Thu, 9 Nov 2023 02:38:26 +0100 Subject: [PATCH] Update 31_who_is_connected.sql --- Daily/sql/31_who_is_connected.sql | 63 ++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/Daily/sql/31_who_is_connected.sql b/Daily/sql/31_who_is_connected.sql index 4b15eb9..2b55294 100644 --- a/Daily/sql/31_who_is_connected.sql +++ b/Daily/sql/31_who_is_connected.sql @@ -1,4 +1,65 @@ -- Qui est connecté à la base : +prompt

Sessions Aggregate per User and Type

+WITH x as ( +SELECT COUNT(*), + --con_id, + username, + inst_id, + type, + server, + status, + state + FROM gv$session + GROUP BY + --con_id, + username, + inst_id, + type, + server, + status, + state +) +SELECT x.* + --,c.name con_name +FROM x + --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id + ORDER BY + 1 DESC, + --x.con_id, + x.username, x.inst_id, x.type, x.server, x.status, x.state; + + +prompt

Sessions Aggregate per Module and Action

+WITH x AS ( +SELECT COUNT(*), + --con_id, + module, + action, + inst_id, + type, + server, + status, + state + FROM gv$session + GROUP BY + --con_id, + module, + action, + inst_id, + type, + server, + status, + state +) +SELECT x.* + --,c.name con_name +FROM x + --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id + ORDER BY + 1 DESC, + --x.con_id, + x.module, x.action, x.inst_id, x.type, x.server, x.status, x.state; + prompt

Who is connected ?

set pages 999 lines 200 @@ -6,5 +67,5 @@ col PROGRAM for a35 col MACHINE for a20 col OSUSER for a10 alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; -select OSUSER, MACHINE, PROGRAM, STATE, LOGON_TIME from v$session order by LOGON_TIME asc; +select OSUSER, MACHINE, PROGRAM, STATE, LOGON_TIME, EVENT from v$session order by LOGON_TIME asc; exit