Also, see these important notes in
100% CPU utilization.
The DB CPU Oracle metric is the amount of
CPU time (in microseconds) spent on database
user-level calls. This does not include the
CPU time spent on instance background
processes such as PMON.
The most important time model statistics are
DB time and DB CPU . The DB time statistic
shows the elapsed processing time
accumulated from the elapsed times of
non-idle sessions. DB CPU presents the
cumulative CPU time from all non-idle
sessions. Both statistics directly show
database workload and describe overall
database response time.
The most
important statistics within the time model
views are DB time and DB CPU. The DB time
statistic in the v$sess_time_model
view determines the total elapsed processing
time spent by database for a particular
session.
You will
also see the DB CPU statistic in the v$sys_time_model
view represents the total cumulative time
spent by Oracle for all sessions’ CPU times
and wait times spent for non-idle wait
events. Therefore, the system-wide DB CPU
time can exceed the elapsed time since the
last instance startup. Use the
following script to retrieve DB CPU
statistics available in
v$sys_time_model:
select
stat_name,
Round(value/1000000) "Time (Sec)"
from v$sys_time_model
where stat_name = 'DB CPU';
STAT_NAME
Time (Sec)
------------------------------------------
----------
DB CPU 299,352
Inside Oracle, you can display CPU for any Oracle user session with this
script:
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;
For complete scripts to monitor CPU, see the
Oracle script download.