set pages 1000 lines 120
select total_sessions, active_sessions,
(total_sessions - active_sessions) inactive_sessions,
round( 100 * active_sessions / total_sessions, 2) pct_active,
round( 100 * (total_sessions - active_sessions) / total_sessions, 2) pct_inactive
from
(select count(*) total_sessions
from sys.v_$session
where type <> 'BACKGROUND') st,
(select count(*) active_sessions
from sys.v_$session
where status = 'ACTIVE'
and type <> 'BACKGROUND') sa
/
-- Sessoes ativas por Owner
select username,status, count(*)
from v$session
group by username,status
/
alter session set nls_date_format='dd/mm hh:mi:ss';
select username, sid,serial#,osuser,machine, program,
TO_CHAR(logon_time,'DD/MM HH:MI')Logon_time ,
TO_CHAR(sysdate,'DD/MM HH:MI') Sys_date
from v$session
where status='ACTIVE' AND USERNAME IS NOT NULL
/
-- I/O Sessão
select s.username Oracle_User, s.sid Sess,
i.block_gets Block_Gets, i.consistent_gets Consistent_Gets,
i.physical_reads Physical_Reads, i.block_changes Block_Changes,
i.consistent_changes Consistent_Changes,
s.machine Computer, s.program Program, s.logon_time Logon_Time
from sys.v_$sess_io i, sys.v_$session s
where i.sid = s.sid and s.status='ACTIVE'
and s.username is not null
ORDER BY 3 desc
/
-- Sqls Longos
select sl.sid,s.username,sl.opname,sl.start_time,
(sl.sofar/sl.totalwork)*100 as percent_complete
from v$session_longops sl, v$session s
where sl.sid=s.sid
and s.status='ACTIVE' AND s.USERNAME IS NOT NULL
/
set recsep off
column "WHO" format A35
column "TEXT" format A40 word_wrapped
column "RB BLKS/S RUNNING" format A17
clear breaks
break on "WHO" on "ROLLBACK BLOCKS" on "RB BLKS/S RUNNING" on "TEXT" skip 1
select to_char(se.sid ) || ',' || to_char(se.serial#) || ' ' || se.username
|| '/' ||
decode(ltrim(se.module || ' ' || se.action || ' ' || se.client_info),
'', se.program,
ltrim(se.module || ' ' || se.action || ' ' || se.client_info))
"WHO",
s.sql_text "TEXT",
to_char(x.used_ublk )||'/'||
to_char((sysdate-to_date(x.start_time,'MM/DD/RR HH24:MI:SS'))*86400)
"RB BLKS/S RUNNING",
o.name "TABLE"
from v$sqlarea s,
v$session se,
sys.obj$ o,
v$locked_object l,
v$transaction x,
v$lock l2
where se.sql_address = s.address
and x.ses_addr = se.saddr
and o.obj# = l.object_id
and l.xidusn = x.xidusn
and l.xidslot = x.xidslot
and l.xidsqn = x.xidsqn
and l2.id2 = x.xidsqn
and l2.id1 = 65536 * x.xidusn + x.xidslot
and l2.type = 'TX'
order by (sysdate-to_date(x.start_time,'MM/DD/RR HH24:MI:SS'))*86400 desc, 1, 4
/
-- Verifica Eventos em espera
Select event, total_waits, time_waited from v$system_event
where time_waited> 0
order by 3 desc
/
select
sql_exec_id,
sql_plan_line_id as plan_line,
decode(event,null,session_state,event) as event,
count(*),
to_char(min(sample_time),'HH24:MI') as min_time,
to_char(max(sample_time),'HH24:MI') as max_time,
round(sum(delta_time)/1000000,2) as delta
FROM
dba_hist_active_sess_history
WHERE
sql_id = '2b1y41hau5qhr'
AND
sample_time >= trunc(sysdate) -1
GROUP BY
trunc(sample_time),
sql_exec_id,
sql_plan_line_id,
event,
session_state
ORDER BY 5 asc;
SELECT
A.SID,
A.SERIAL#,
A.USERNAME,
A.SERVER,
B.SPID,
A.OSUSER,
A.MACHINE,
A.PROGRAM,
A.LOGON_TIME
FROM
V$SESSION A,
V$PROCESS B
WHERE
A.PADDR = B.ADDR
AND
A.SID in
(SELECT
A.SID
FROM
V$SESSION A,
V$PROCESS B
WHERE
A.STATUS = 'ACTIVE'
AND
A.USERNAME IS NOT NULL
AND
A.PADDR=B.ADDR);
Nenhum comentário:
Postar um comentário