What is DB time in AWR?

AWR中有 DB time这个术语,那么什么是DB time呢?

Oracle10gR2 官方文档 给出了详细解释(Oracle10gPerformance Tuning Guide 5.1.1.2 Time Model Statistics)

The most important of the time model statistics is DB time. This statistics represents the total time spent in
database calls and is a 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 CPU+ DB waiting time(no-idle time)

那么下面我挑一个session来验证一下

SQL> select sid,stat_id,stat_name,value/1000000/60 from V$sess_TIME_MODEL where sid=194;

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

19 rows selected.

Elapsed: 00:00:01.61

SQL> select (sysdate-logon_time)*24*60 minutes, username,machine,sid,serial#,event,p1,p2,p3
  2  from v$session where sid=194;

MINUTES USERNAME             MACHINE                     SID    SERIAL# EVENT                     P1    P2         P3
---------- -------------------- -------------------- ---------- ---------- -------------------- ---------- ---------- ----------
34.4833333 WHSUSRGL             NA/BDC-KALIDO001            194      28391 direct path read tem        202      89709          1
                                                                           p

Elapsed: 00:00:01.15

Session 194连接到数据库已经34.4833333分钟,DB time=33.5681982 , CPU time=32.9633455

现在来查询一下ASH,我们知道ASH是每隔1秒钟采样一次

SQL> select count(*)
  2         from v$active_session_history ash, v$event_name enm
  3         where ash.event#=enm.event#
  4         and SESSION_ID=194;

COUNT(*)
----------
        47

那么194这个session大概等待了47秒,也就是等待了大约。78333333分钟

SQL> select 47/60 from dual;

47/60
----------
.783333333

SQL> select 32.9633455+.783333333 from dual;

32.9633455+.783333333
---------------------
           33.7466788

DB CPU + 等待时间=33.7466788 ,而 DB time=33.5681982 他们相差不大,基本上可以说明

DB time=DB CPU+ DB waiting time(no-idle time)

注意:AWR中的DB time等于所有session DB time之和(除去后台进程)

SQL> select SESSION_ID,NAME,P1,P2,P3
  2         from v$active_session_history ash, v$event_name enm
  3         where ash.event#=enm.event#
  4         and SESSION_ID=194;

SESSION_ID NAME                                        P1         P2         P3
---------- ----------------------------------- ---------- ---------- ----------
       194 db file sequential read                    202     106634          1
       194 db file sequential read                    202      53541          1
       194 db file sequential read                    202     204387          1
       194 db file sequential read                    202     242316          1
       194 db file sequential read                    202     251848          1
       194 db file sequential read                    202     201689          1
       194 db file scattered read                      45     480505         16
       194 db file scattered read                      44     169145         16
       194 db file scattered read                      45      32489         16
       194 db file scattered read                      44     316585         16
       194 db file scattered read                      46     255817         16
       194 db file scattered read                      47     204105         16
       194 db file scattered read                      44     236633         16
       194 db file scattered read                      46     222761         16
       194 db file scattered read                      44     232969         16
       194 db file scattered read                      44     230489         16
       194 db file scattered read                      44     227673         16
       194 db file scattered read                      45     177785         16
       194 db file scattered read                      44     292121         16
       194 db file scattered read                      45     136041         16
       194 db file scattered read                      28      17177         16
       194 db file scattered read                      47     233513         16
       194 db file scattered read                      44     222233         16
       194 db file scattered read                      46     211289         16
       194 db file scattered read                      47     152889         16
       194 db file scattered read                      45     164921         16
       194 db file scattered read                      47     149609         16
       194 db file scattered read                      44     312873         16
       194 db file scattered read                      45     157289         16
       194 db file scattered read                      45     155225         16
       194 db file sequential read                     50      30400          1
       194 db file sequential read                     43       8763          1
       194 db file scattered read                      36     518441         16
       194 db file scattered read                      37     504992          4
       194 db file scattered read                      38     195257         16
       194 db file scattered read                      37     209776          9
       194 db file scattered read                      41     119561         16
       194 db file scattered read                      39      62041         16
       194 db file scattered read                      41       4765          2
       194 db file scattered read                      38     438857         16
       194 read by other session                       38     335097          1
       194 latch: cache buffers chains         1.3835E+19        122          0
       194 db file sequential read                     27      52122          1
       194 db file sequential read                     41     140105          1
       194 read by other session                       36      97230          1
       194 db file scattered read                      38      17369         16
       194 db file sequential read                     37       1889          1

47 rows selected.

看AWR的时候,可以拿DB time和采样时间间隔做比较,如果DB time高出采样时间间隔很多,说明数据库负载很大

同样,可以拿DB time和DB CPU比较,如果 DB time高出DB CPU很多,说明数据库出现了显而易见的性能问题

因为等待时间过多。

参考: http://blog.csdn.net/robinson1988/article/details/6077944

时间: 2024-12-29 11:25:00

What is DB time in AWR?的相关文章

ocp 1Z0-043 61-130题解析

61. You are working in an online transaction processing (OLTP) environment. You realize that the salary for an employee, John, has been accidentally modified in the EMPLOYEES table. Two days ago, the data was in the correct state. Flashback logs gene

ocp 1Z0-042 121-178题解析

121. You want to create a new optimized database for your transactional production environment to be used by a financial application. While creating the database, you want the Oracle software to take care of all basic settings to optimize the databas

使用awrextr.sql导出awr原始数据

1.AWR原始数据与AWR报告的区别 AWR原始数据: 是oracle数据库mmon进程定期将统计量从内存转储至磁盘,并以结构化的形式存入若干张表组成自动工作负荷存储仓库(AutomaticWorkload repository﹐简写为AWR)的原始数据,有经验的DBA可以自由的查询所需要的历史数据 AWR报告: 使用awrrpt.sql.awrrpti.sql.awrddrpt.sql.awrddrpi.sql所生成的为AWR报告,一般为保存为HTML或TXT格式文件,使用Toad等工具生成的

db file sequential read

db file sequential read这个等待事件在实际生产库非常常见,是个与User I/O相关的等待事件,通常显示与单个数据块相关的读取操作,在大多数情况下,读取一个索引块或者通过索引读取一个数据块时,都会记录这个等待.当Oracle 需要每次I/O只读取单个数据块这样的操作时,会产生这个等待事件.最常见的情况有索引的访问(除IFFS外的方式),回滚操作,以ROWID的方式访问表中的数据,重建控制文件,对文件头做DUMP等. 在V$SESSION_WAIT这个视图里面,这个等待事件有

ORACLE AWR报告数据的导入导出实践

关于AWR的快照数据可以导出.导入,一直没有亲手实践过.今天动手测试了一下如何导出.导入AWR数据,将AWR的数据从一测试服务器,导入到另外一台测试服务器. SQL> @?/rdbms/admin/awrextr.sql ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Disclaimer: T

关于AWR报告的解析

其实,网上关于AWR的解析已经足够多了.但总觉得通过收集资料,再加工写出来的资料能便于自己理解其中的各项内容,因此我对AWR进行一篇详尽的解析.希望能分几次完成 从AWR报告的第一部分包含了数据库的名称.数据库的ID号.实例名.实例数.启动的时间.数据库版本和是否为RAC.此外也包含了系统的部分信息. 该部分最关键的内容是第三个模块,里面记录了snapshot的开始时间和结束时间,以及数据库运行时间和用户级别调用(session)所消耗的时间. DB CPU:Amount of CPU time

[转]Oracle DB 用户

? 创建和管理数据库用户帐户: – 验证用户 – 分配默认存储区(表空间) 1.数据库用户帐户 要访问数据库,用户必须指定有效的数据库用户帐户,而且还要根据该用户帐户的要求成功通过验证.每个数据库用户都有一个唯一的数据库帐户. Oracle 建议采用这种做法,从而避免潜在的安全漏洞,并为特定的审计活动提供有意义的数据.但是,有时候若干用户会共享一个公用数据库帐户. 在这些罕见的情况下,操作系统和应用程序必须为数据库提供足够的安全性. 每个用户帐户都包括以下项: ? 唯一的用户名:用户名不能超过3

浅谈ORACLE AWR single instance 一

Oracle中的AWR,全称为Automatic Workload Repository,自动负载信息库. AWR是DBA了解其运行状态的重要工具之一,根据AWR报告可以对oracle数据库性能整体了解并针对性优化,此文章主要是介绍AWR相关部分的内容. DB Name         DB Id    Instance     Inst Num Startup Time    Release     RAC ------------ ----------- ------------ -----

使用AWR生成一条sql的执行统计报告

我们都知道Oracle的AWR报告是一个很强大的功能通过分析AWR报告可以打出Oracle数据运行过程中出现的问题和可能存在的隐患.但是AWR报告中没有关于单个SQL执行计划.统计信息的详细描述,但不代表AWR不能提供这种功能. 本文介绍的是如何使用AWR报告生成一条sql的详细执行统计报告. 实验环境11.2.0.4 1.调整AWR关于SQL收集的设置,调整的目的是因为默认情况下AWR并非捕获所有的sql语句,此调整是为了让AWR可以收集实验过程中的SQL语句 [email protected