Thursday, December 7, 2017

9) # "TOP 10 DB-CPU ACTIVITY"

9) # "TOP 10 DB-CPU ACTIVITY"

echo ${ECHO} ">--------------------------------------------------------------------------------------------------${RED} ${OPTION} ${BLACK}"
echo ${ECHO} "${RED} TOP 20 DB-CPU ACTIVITY ${BLACK}"
echo ${ECHO} ">--------------------------------------------------------------------------------------------------${RED} ${OPTION} ${BLACK}"
${LOADING}
sqlplus -S /nolog <<EOF
conn / as sysdba
set pages 700 lines 700 timing on colsep '|'
col STAT_NAME for a50
col "% PERC" for a10
SELECT STAT_NAME
   , TIME_WAITED
   , case when pct_waited >= 0.5 then 'Critical' when pct_waited >= 0.2 then 'Warning' end as "Status"
   , to_char(round(pct_waited*100,1), '999D00') || '%' as "% PERC"
from (select STAT_NAME, time_waited, TIME_WAITED / sum(time_waited) over () pct_waited
from (select STAT_NAME, round(sum(VALUE)/(1000*1000)) AS time_waited
from GV\$SYS_TIME_MODEL
group by STAT_NAME)
order by 2 desc)
where rownum <= 20;
quit;
EOF

No comments:

Post a Comment