Social Buttons

LightBlog

Breaking

LightBlog

samedi 6 juin 2020

Oracle Script

aws-senior.com
-- Description : Displays information on all database sessions ordered by execu


-- -----------------------------------------------------------------------------
------
-- Author : aws-senior.com
-- Description : Displays information on all database sessions ordered by execu
tions.
-- Requirements : Access to the V$ views.
-- Call Syntax : @top_sessions.sql (reads, execs or cpu)
-- -----------------------------------------------------------------------------
------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF

COLUMN username FORMAT A15
COLUMN machine FORMAT A25
COLUMN logon_time FORMAT A20

SELECT NVL(a.username, '(oracle)') AS username,
a.osuser,
a.sid,
a.serial#,
c.value AS &1,
a.lockwait,
a.status,
a.module,
a.machine,
a.program,
TO_CHAR(a.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
FROM v$session a,
v$sesstat c,
v$statname d
WHERE a.sid = c.sid
AND c.statistic# = d.statistic#
AND d.name = DECODE(UPPER('&1'), 'READS', 'session logical reads',
'EXECS', 'execute count',
'CPU', 'CPU used by this session',
'CPU used by this session')
ORDER BY c.value DESC;

SET PAGESIZE 14


--------------------------------------------------------------------------------------
-- File Name : https://github.com/Zaalouni/OracleDba
-- Author : Zaalouni
-- website : http://www.aws-senior.com
-- Github : https://github.com/Zaalouni/OracleDba
--------------------------------------------------------------------------------------


Aucun commentaire:

Enregistrer un commentaire

Nombre total de pages vues

Adbox