|
1. Monitor Shared Pool Information:
select to_number(value) shared_pool_size, sum_obj_size, sum_sql_size, sum_user_size,
(sum_obj_size + sum_sql_size+sum_user_size)* 1.3 min_shared_pool
from (select sum(sharable_mem) sum_obj_size
from v$db_object_cache where type <> 'CURSOR'),
(select sum(sharable_mem) sum_sql_size from v$sqlarea),
(select sum(250 * users_opening) sum_user_size from v$sqlarea), v$parameter
where name = 'shared_pool_size';
2. Monitor SGA Information:
SELECT SUM(VALUE)/1024/1024 "Size in MB" from SYS.v_$sga;
select NAME, BYTES from v$sgastat order by NAME;
3. Monitor PGA Information:
Select st.sid "SID", sn.name "TYPE", ceil(st.value / 1024 / 1024/1024) "GB"
from v$sesstat st, v$statname sn where st.statistic# = sn.statistic#
and sid in (select sid from v$session where username like UPPER('hrms'))
and upper(sn.name) like '%PGA%' order by st.sid, st.value desc;
4. Monitor CPU Usage Information:
select ss.username, se.SID, VALUE/100 cpu_usage_seconds
from v$session ss, v$sesstat se, v$statname sn where se.STATISTIC# = sn.STATISTIC#
and NAME like '%CPU used by this session%' and se.SID = ss.SID
and ss.status='ACTIVE' and ss.username is not null order by VALUE desc;
5. Disk I/O Report:
WITH totreadwrite AS (SELECT SUM (phyrds) phys_reads, SUM (phywrts) phys_wrts FROM v$filestat)
SELECT NAME, phyrds, phyrds * 100 / trw.phys_reads read_pct,
phywrts, phywrts * 100 / trw.phys_wrts write_pct
FROM totreadwrite trw, v$datafile df, v$filestat fs
WHERE df.file# = fs.file# ORDER BY phyrds DESC;
6. IO Usage for a Query:
select b.sql_text "Statement ", a.Disk_reads "Disk Reads", a.executions "Executions",
a.disk_reads/decode(a.executions,0,1,a.executions) "Ratio",c.username
from v$sqlarea a, v$sqltext_with_newlines b,dba_users c
where a.parsing_user_id = c.user_id and a.address=b.address and a.disk_reads>100000
order by a.disk_reads desc,b.piece;
7. Monitor Disk I/O Contention:
select NAME, PHYRDS "Physical Reads",
round((PHYRDS / PD.PHYS_READS)*100,2) "Read %", PHYWRTS "Physical Writes",
round(PHYWRTS * 100 / PD.PHYS_WRTS,2) "Write %", fs.PHYBLKRD+FS.PHYBLKWRT "Total Block I/O's" from ( select sum(PHYRDS) PHYS_READS, sum(PHYWRTS) PHYS_WRTS
from v$filestat ) pd, v$datafile df, v$filestat fs
where df.FILE# = fs.FILE#
order by fs.PHYBLKRD+fs.PHYBLKWRT desc;
|