When tuning an Oracle database, each component has its own set of statistics. To look at the system as a whole, it is necessary to have a common scale for comparisons. For this reason, most Oracle Database advisories and reports describe statistics in terms of time. In addition, the V$SESS_TIME_MODEL and V$SYS_TIME_MODEL views provide time model statistics. Using the common time instrumentation helps to identify quantitative effects on the database operations.

The most important of the time model statistics is DB time. This statistics represents the total time spent in database calls and is an indicator of the total instance workload. It is calculated by aggregating the CPU and wait times of all sessions not waiting on idle wait events (non-idle user sessions).

在时间模型统计信息中,DB TIME占用非常重要的地位。DB TIME表示所有花费在数据库调用上的时间总和,可以作为数据库实例负载的度量工具。DB TIME 是所有用户进程花费在cpu和非空闲等待事件上的时间总和。
DB time is measured cumulatively from the time of instance startup. Because DB time it is calculated by combining the times from all non-idle user sessions, it is possible that the DB time can exceed the actual time elapsed after the instance started. For example, an instance that has been running for 30 minutes could have four active user sessions whose cumulative DB time is approximately 120 minutes.

DB TIME的统计是从实例启动的那一刻开始的。因为db time是所有非空闲用户进程的时间总和,因此其值可能会超过实例运行时间。例如,一个运行30分钟的实例,其DB TIME可能会是120分钟,因为该实例具有4个活动用户进程。
The objective for tuning an Oracle system could be stated as reducing the time that users spend in performing some action on the database, or simply reducing DB time.
Other time model statistics provide quantitative effects (in time) on specific actions, such as logon operations and hard and soft parses.

数据库调优的目的便是降低用户执行某些操作所花费的时间,简单一点来说,就是降低DB TIME。除DB TIME 之外,oracle还为我们提供了其他的时间模型信息,例如,用来记录用户登录花费时间的统计信息和记录软硬解析花费时间的统计信息。


在某种意义上,我们可以认为db time为oracle数据库对用户请求的响应时间。但是db time可以在不同的级别进行累计操作(在session级别,service 级别,instance级别),此时再称之为响应时间就不太合适了。





基于响应时间的Oracle优化原则:尽量减少等待时间(Wait time),提高服务时间(Service time)。这也是基于Oracle等待事件的分析方法的基本原则:尽量消除各种等待事件对系统的影响,从而提高系统性能和响应时间。

如果数据库系统除了CPU和IO以外的等待时间超过DB time的5%以上的话,可能存在某些性能问题,需要DBA采用等待事件的分析方法,对系统或应用进行优化。