In Oracle 10g,What is Time Model?

shiyihai發表於2008-04-09

When you have a performance problem, what comes to mind first to reduce the response time? Obviously, you want to eliminate (or reduce) the root cause of the factor that adds to the time. How do you know where the time was spent--not waiting, but actually doing the work?

[@more@]

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

STAT_ID STAT_NAME VALUE
---------- ---------------------------------------------------------------- ----------
3649082374 DB time 2143550881
2748282437 DB CPU 1951777844
4157170894 background elapsed time 4080469804
2451517896 background cpu time 1865255527
4127043053 sequence load elapsed time 1026175
1431595225 parse time elapsed 849801681
372226525 hard parse elapsed time 490874711
2821698184 sql execute elapsed time 2264766505
1990024365 connection management call elapsed time 3882388
1824284809 failed parse elapsed time 1631105
4125607023 failed parse (out of shared memory) elapsed time 0
3138706091 hard parse (sharing criteria) elapsed time 49206314
268357648 hard parse (bind mismatch) elapsed time 9883006
2643905994 PL/SQL execution elapsed time 1930995310
290749718 inbound PL/SQL rpc elapsed time 0
1311180441 PL/SQL compilation elapsed time 18741343
751169994 Java execution elapsed time 0
1159091985 repeated bind elapsed time 15912603
2411117902 RMAN cpu time (backup/restore) 0

19 rows selected

SQL>

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 view V$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;

SID STAT_ID STAT_NAME VALUE
---------- ---------- ---------------------------------------------------------------- ----------
335 3649082374 DB time 0
335 2748282437 DB CPU 0
335 4157170894 background elapsed time 409577624
335 2451517896 background cpu time 409557844
335 4127043053 sequence load elapsed time 0
335 1431595225 parse time elapsed 0
335 372226525 hard parse elapsed time 0
335 2821698184 sql execute elapsed time 0
335 1990024365 connection management call elapsed time 0
335 1824284809 failed parse elapsed time 0
335 4125607023 failed parse (out of shared memory) elapsed time 0
335 3138706091 hard parse (sharing criteria) elapsed time 0
335 268357648 hard parse (bind mismatch) elapsed time 0
335 2643905994 PL/SQL execution elapsed time 0
335 290749718 inbound PL/SQL rpc elapsed time 0
335 1311180441 PL/SQL compilation elapsed time 0
335 751169994 Java execution elapsed time 0
335 1159091985 repeated bind elapsed time 0
335 2411117902 RMAN cpu time (backup/restore) 0

19 rows selected

SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/38542/viewspace-1002128/,如需轉載,請註明出處,否則將追究法律責任。

相關文章