Sunday, April 20, 2008

10g Time Model

Time model statistics show the amount of CPU time that has been required to complete each type of database processing work. Examples include sql execute elapsed time, parse time elapsed and PL/SQL execution elapsed time statistics.

The most important time model statistic is DB time, which represents the total time spent by Oracle to process all database calls. In fact, it describes the total database workload. DB time is calculated by aggregating the CPU and all non-idle wait times for all sessions in the database after the last startup.

Because DB_TIME is an aggregate value gathered for all non-idle sessions, the total time will nearly always exceed the total elapsed time since instance startup.

For example, an
instance that has been up for 10 hours may have had 60 sessions that were active for 30 minutes each. These would show a total time of 60 × 30 minutes, or 30 hours.

Oracle Database 10g introduces time models for identifying the time spent in various places. The overall system time spent is recorded in the viewV$SYS_TIME_MODEL. Here is the query and its output:
SQL> select * from v$sys_time_model;

This view shows the overall system times as well; however, you may be interested in a more granular view: the session level times. The timing stats are captured at the session level as well, as shown in the viewV$SESS_TIME_MODEL, where all the stats of the current connected sessions, both active and inactive, are visible. The additional column SID specifies the SID of the sessions for which the stats are shown:
SQL> select * from v$sess_time_model where sid=335;


The challenge ahead is how to drill down the interval to same as snapshot's . ! ? This is especially good to certain critical period while cyclical critical job runs.