Tuesday, March 20, 2012

WHICH SESSIONS GENERATING MORE REDO LOGS IN ORACLE

##################################################
WHICH SESSIONS GENERATING MORE REDO LOGS IN ORACLE
##################################################

SELECT s.sid, s.serial#, s.username, s.program,
i.block_changes
FROM v$session s, v$sess_io i
WHERE s.sid = i.sid
ORDER BY 5 desc;

SELECT s.sid, s.serial#, s.username, s.program,
t.used_ublk, t.used_urec
FROM v$session s, v$transaction t
WHERE s.taddr = t.addr
ORDER BY 5,6 desc;

According to the Redo generation size.
-----------------------------------------
select sid, name,
round(value/1024/1024) redo_mb
from v$statname n, v$sesstat s
where n.name like 'redo size'
and s.statistic# = n.statistic#
/



Below Query will list the top 10 redo generated sessions info.
----------------------------------------------------------------
select b.inst_id, b.SID, b.serial# sid_serial, b.username, machine, b.osuser, b.status, a.redo_mb MB
from (select n.inst_id, sid, round(value/1024/1024) redo_mb from gv$statname n, gv$sesstat s
where n.inst_id=s.inst_id and n.statistic#=134 and s.statistic# = n.statistic# order by value desc) a, gv$session b
where b.inst_id=a.inst_id
  and a.sid = b.sid
and   rownum <= 10;

2 comments:

Unknown said...

The previouse script is good but it does not give you exact redo generation size.
Below SQL can manage this:

select sid, name,
round(value/1024/1024) redo_mb
from v$statname n, v$sesstat s
where n.name like 'redo size'
and s.statistic# = n.statistic#
/

Kirill Loifman, dadbm.com

Oracle Applications DBA said...

Thanks kirill for sharing the script which specifies the size of redo generation w.r.t SID.

Regards,
Jagadish.

Post a Comment