select /*+ RULE CURSOR_SHARING_EXACT */
'DB BLOCK BUFFER (TOAD)' DB_RESOURCE,
to_char(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)),'999,999,999,999') HIT,
to_char(sum(decode(name,'physical reads',value,0)),'999,999,999,999') MISS,
to_char((sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)))/(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0))+sum(decode(name,'physical reads',value,0)))*100,'999.99')||'%' RATIO
from v$sysstat
union all
select
'LIBRARY GETS',
to_char(sum(gets),'999,999,999,999'),
to_char(sum(gets)-sum(gethits),'999,999,999,999'),
to_char(sum(gets)/(sum(gets)+(sum(gets)-sum(gethits)))*100,'999.99')||'%'
from v$librarycache
union all
select
'LIBRARY PINS',
to_char(sum(pinhits),'999,999,999,999'),
to_char(sum(pins)-sum(pinhits),'999,999,999,999'),
to_char(sum(pinhits)/(sum(pinhits)+(sum(pins)-sum(pinhits)))*100,'999.99')||'%'
from v$librarycache
union all
select
'DICTIONARY',
to_char(sum(gets)-sum(getmisses),'999,999,999,999'),
to_char(sum(getmisses),'999,999,999,999'),to_char(sum(gets)/(sum(gets)+sum(getmisses))*100,'999.99')||'%'
from v$rowcache
union all
select
'INDEX UTILIZATION',
to_char(sum(decode(name,'table fetch by rowid',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'table scan rows gotten',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'table fetch by rowid',value,0))/(sum(decode(name,'table fetch by rowid',value,0))+sum(decode(name,'table scan rows gotten',value,0)))*100,'999.99')||'%'
from v$sysstat
union all
select
'REDOLOG WRITES',
to_char(sum(decode(name,'redo writes',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'redo log space requests',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'redo writes',value,0))
/(greatest(1,sum(decode(name,'redo writes',value,0))+sum(decode(name,'redo log space requests',value,0))))*100,'999.99')||'%'
from v$sysstat
union all
select
'MEMORY SORTS',
to_char(sum(decode(name,'sorts (memory)',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'sorts (disk)',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'sorts (memory)',value,0))/(sum(decode(name,'sorts (memory)',value,0))+sum(decode(name,'sorts (disk)',value,0)))*100,'999.99')||'%'
from v$sysstat
union all
select
'CURSOR REUSE',
to_char(count(*),'999,999,999,999'),
to_char(sum(decode(executions,0,0,1,0,1)),'999,999,999,999'),
to_char((sum(decode(executions,0,0,1,0,1))/count(*))*100,'999.99')||'%'
from v$sqlarea
union all
select
'PARSE/EXEC',
to_char(vss1.value,'999,999,999,999'),
to_char(vss2.value,'999,999,999,999'),
to_char(100*(1-vss1.value/vss2.value),'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'parse count (total)'
and vss2.name = 'execute count'
union all
select
'PARSE HARD/TOT',
to_char(vss1.value,'999,999,999,999'),
to_char(vss2.value,'999,999,999,999'),
to_char((vss1.value/vss2.value)*100,'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'parse count (hard)'
and vss2.name = 'parse count (total)'
union all
select
'DB BLOCK MISS RATIO',
to_char(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'physical reads',value,0)),'999,999,999,999'),
to_char(
(sum(decode(name,'physical reads',value,0))/
(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0))))*100
,'999.99')||'%' RATIO
from v$sysstat
union all
select
'DB BLOCK BUFFER',
to_char(vss2.value,'999,999,999,999'),
to_char(vss1.value,'999,999,999,999'),
to_char(100*(1-vss1.value/vss2.value),'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'physical reads'
and vss2.name = 'consistent gets'
order by 4 asc
/
'DB BLOCK BUFFER (TOAD)' DB_RESOURCE,
to_char(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)),'999,999,999,999') HIT,
to_char(sum(decode(name,'physical reads',value,0)),'999,999,999,999') MISS,
to_char((sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)))/(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0))+sum(decode(name,'physical reads',value,0)))*100,'999.99')||'%' RATIO
from v$sysstat
union all
select
'LIBRARY GETS',
to_char(sum(gets),'999,999,999,999'),
to_char(sum(gets)-sum(gethits),'999,999,999,999'),
to_char(sum(gets)/(sum(gets)+(sum(gets)-sum(gethits)))*100,'999.99')||'%'
from v$librarycache
union all
select
'LIBRARY PINS',
to_char(sum(pinhits),'999,999,999,999'),
to_char(sum(pins)-sum(pinhits),'999,999,999,999'),
to_char(sum(pinhits)/(sum(pinhits)+(sum(pins)-sum(pinhits)))*100,'999.99')||'%'
from v$librarycache
union all
select
'DICTIONARY',
to_char(sum(gets)-sum(getmisses),'999,999,999,999'),
to_char(sum(getmisses),'999,999,999,999'),to_char(sum(gets)/(sum(gets)+sum(getmisses))*100,'999.99')||'%'
from v$rowcache
union all
select
'INDEX UTILIZATION',
to_char(sum(decode(name,'table fetch by rowid',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'table scan rows gotten',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'table fetch by rowid',value,0))/(sum(decode(name,'table fetch by rowid',value,0))+sum(decode(name,'table scan rows gotten',value,0)))*100,'999.99')||'%'
from v$sysstat
union all
select
'REDOLOG WRITES',
to_char(sum(decode(name,'redo writes',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'redo log space requests',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'redo writes',value,0))
/(greatest(1,sum(decode(name,'redo writes',value,0))+sum(decode(name,'redo log space requests',value,0))))*100,'999.99')||'%'
from v$sysstat
union all
select
'MEMORY SORTS',
to_char(sum(decode(name,'sorts (memory)',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'sorts (disk)',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'sorts (memory)',value,0))/(sum(decode(name,'sorts (memory)',value,0))+sum(decode(name,'sorts (disk)',value,0)))*100,'999.99')||'%'
from v$sysstat
union all
select
'CURSOR REUSE',
to_char(count(*),'999,999,999,999'),
to_char(sum(decode(executions,0,0,1,0,1)),'999,999,999,999'),
to_char((sum(decode(executions,0,0,1,0,1))/count(*))*100,'999.99')||'%'
from v$sqlarea
union all
select
'PARSE/EXEC',
to_char(vss1.value,'999,999,999,999'),
to_char(vss2.value,'999,999,999,999'),
to_char(100*(1-vss1.value/vss2.value),'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'parse count (total)'
and vss2.name = 'execute count'
union all
select
'PARSE HARD/TOT',
to_char(vss1.value,'999,999,999,999'),
to_char(vss2.value,'999,999,999,999'),
to_char((vss1.value/vss2.value)*100,'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'parse count (hard)'
and vss2.name = 'parse count (total)'
union all
select
'DB BLOCK MISS RATIO',
to_char(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0)),'999,999,999,999'),
to_char(sum(decode(name,'physical reads',value,0)),'999,999,999,999'),
to_char(
(sum(decode(name,'physical reads',value,0))/
(sum(decode(name,'db block gets',value,0))+sum(decode(name,'consistent gets',value,0))))*100
,'999.99')||'%' RATIO
from v$sysstat
union all
select
'DB BLOCK BUFFER',
to_char(vss2.value,'999,999,999,999'),
to_char(vss1.value,'999,999,999,999'),
to_char(100*(1-vss1.value/vss2.value),'999.99')||'%'
from v$sysstat vss1, v$sysstat vss2
where vss1.name = 'physical reads'
and vss2.name = 'consistent gets'
order by 4 asc
/
No comments:
Post a Comment