【性能调优】Oracle AWR报告指标全解析

来源:互联网 发布:淘宝联盟没有跟踪返利 编辑:程序博客网 时间:2024/05/16 03:09

【性能调优】Oracle AWR报告指标全解析


 

 

啥是AWR?

=====================================================================================================

 

AWR (Automatic Workload Repository)

一堆历史性能数据,放在SYSAUX表空间上, AWR和SYSAUX都是10g出现的,是Oracle调优的关键特性; 大约1999年左右开始开发,已经有15年历史

默认快照间隔1小时,10g保存7天、11g保存8天; 可以通过DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS修改

DBA_HIST_WR_CONTROL

AWR程序核心是dbms_workload_repository包

@?/rdbms/admin/awrrpt    本实例

@?/rdbms/admin/awrrpti   RAC中选择实例号

 

 

 

谁维护AWR?

 

 

主要是MMON(Manageability Monitor Process)和它的小工进程(m00x)

MMON的功能包括:
1.启动slave进程m00x去做AWR快照
2.当某个度量阀值被超过时发出alert告警
3.为最近改变过的SQL对象捕获指标信息

 

 

AWR小技巧

 

 

手动执行一个快照:

Exec dbms_workload_repository.create_snapshot; (这个要背出来哦,用的时候去翻手册,丢脸哦 J!)

创建一个AWR基线

Exec DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE(start_snap_id,end_snap_id ,baseline_name);

@?/rdbms/admin/awrddrpt     AWR比对报告

@?/rdbms/admin/awrgrpt       RAC 全局AWR

自动生成AWR HTML报告:

http://www.oracle-base.com/dba/10g/generate_multiple_awr_reports.sql

 

 

 

1、报告总结

 

[sql] view plaincopy在CODE上查看代码片派生到我的代码片
  1. WORKLOAD REPOSITORY report for  
  2.   
  3. DB Name         DB Id    Instance     Inst Num Startup Time    Release     RAC  
  4. ------------ ----------- ------------ -------- --------------- ----------- ---  
  5. MAC           2629627371 askmaclean.com            1 22-Jan-13 16:49 11.2.0.3.0  YES  
  6.   
  7. Host Name        Platform                         CPUs Cores Sockets Memory(GB)  
  8. ---------------- -------------------------------- ---- ----- ------- ----------  
  9. MAC10            AIX-Based Systems (64-bit)        128    32             320.00  
  10.   
  11.               Snap Id      Snap Time      Sessions Curs/Sess  
  12.             --------- ------------------- -------- ---------  
  13. Begin Snap:      5853 23-Jan-13 15:00:56     3,520       1.8  
  14.   End Snap:      5854 23-Jan-13 15:30:41     3,765       1.9  
  15.    Elapsed:               29.75 (mins)  
  16.    DB Time:            7,633.76 (mins)  


 

Elapsed 为该AWR性能报告的时间跨度(自然时间的跨度,例如前一个快照snapshot是4点生成的,后一个快照snapshot是6点生成的,则若使用@?/rdbms/admin/awrrpt 脚本中指定这2个快照的话,那么其elapsed = (6-4)=2 个小时),一个AWR性能报告 至少需要2个AWR snapshot性能快照才能生成 ( 注意这2个快照时间 实例不能重启过,否则指定这2个快照生成AWR性能报告 会报错),AWR性能报告中的 指标往往是 后一个快照和前一个快照的 指标的delta,这是因为 累计值并不能反映某段时间内的系统workload。

 

 

DB TIME= 所有前台session花费在database调用上的总和时间:

  • 注意是前台进程foreground sessions
  • 包括CPU时间、IO Time、和其他一系列非空闲等待时间,别忘了cpu on queue time

DB TIME 不等于 响应时间,DB TIME高了未必响应慢,DB TIME低了未必响应快

DB Time描绘了数据库总体负载,但要和elapsed time逝去时间结合其他来。

Average Active Session AAS= DB time/Elapsed Time
DB Time =60 min , Elapsed Time =60 min AAS=60/60=1 负载一般
DB Time= 1min , Elapsed Time= 60 min AAS= 1/60 负载很轻
DB Time= 60000 min,Elapsed Time= 60 min AAS=1000  系统hang了吧?

 

DB TIME= DB CPU + Non-Idle Wait +  Wait on CPU queue

 

如果仅有2个逻辑CPU,而2个session在60分钟都没等待事件,一直跑在CPU上,那么:

 

DB CPU= 2 * 60 mins  , DB Time = 2* 60 + 0 + 0 =120

AAS = 120/60=2  正好等于OS load 2。

如果有3个session都100%仅消耗CPU,那么总有一个要wait on queue

DB CPU = 2* 60 mins  ,wait on CPU queue= 60 mins

AAS= (120+ 60)/60=3 主机load 亦为3,此时vmstat 看waiting for run time

 

真实世界中?  DB Cpu = xx mins , Non-Idle Wait= enq:TX + cursor pin S on X + latch : xxx + db file sequential read + ……….. 阿猫阿狗

[sql] view plaincopy在CODE上查看代码片派生到我的代码片
  1. 1-1  内存参数大小  
  2.   
  3.    
  4.   
  5.    
  6. Cache Sizes                       Begin        End  
  7. ~~~~~~~~~~~                  ---------- ----------  
  8.                Buffer Cache:    49,152M    49,152M  Std Block Size:         8K  
  9.            Shared Pool Size:    13,312M    13,312M      Log Buffer:   334,848K  
  10.   
  11.    
  12.   
  13.    
  14.   
  15. 内存管理方式:MSMM、ASMM(sga_target)、AMM(memory_target)  
  16.   
  17.    
  18.   
  19. 小内存有小内存的问题, 大内存有大内存的麻烦! ORA-04031???!!  
  20.   
  21.    
  22.   
  23. Buffer cache和shared pool size的 begin/end值在ASMM、AMM和11gR2 MSMM下可是会动的哦!  
  24.   
  25.    
  26.   
  27. 这里说 shared pool一直收缩,则在shrink过程中一些row cache 对象被lock住可能导致前台row cache lock等解析等待,最好别让shared pool shrink。如果这里shared pool一直在grow,那说明shared pool原有大小不足以满足需求(可能是大量硬解析),结合下文的解析信息和SGA breakdown来一起诊断问题。  
  28.   
  29.    
  30.   
  31.    
  32.   
  33. 1-2   Load Profile  
  34.   
  35.    
  36.   
  37.    
  38. Load Profile              Per Second    Per Transaction   Per Exec   Per Call  
  39. ~~~~~~~~~~~~         ---------------    --------------- ---------- ----------  
  40.       DB Time(s):              256.6                0.2       0.07       0.03  
  41.        DB CPU(s):                3.7                0.0       0.00       0.00  
  42.        Redo size:        1,020,943.0              826.5  
  43.    Logical reads:          196,888.0              159.4  
  44.    Block changes:            6,339.4                5.1  
  45.   Physical reads:            5,076.7                4.1  
  46.  Physical writes:              379.2                0.3  
  47.       User calls:           10,157.4                8.2  
  48.           Parses:              204.0                0.2  
  49.      Hard parses:                0.9                0.0  
  50. W/A MB processed:                5.0                0.0  
  51.           Logons:                1.7                0.0  
  52.         Executes:            3,936.6                3.2  
  53.        Rollbacks:            1,126.3                0.9  
  54.     Transactions:            1,235.3  
  55.   
  56.   % Blocks changed per Read:   53.49    Recursive Call %:    98.04  
  57.  Rollback per transaction %:   36.57       Rows per Sort:    73.70  
  58.   
  59.    
  60.   
  61.    
  62.   
  63.    
  64.   
  65.    
  66.   
  67.    
  68.   
  69.   
  70.   
  71.   
  72. 指标 指标含义   
  73. redo size 单位 bytes,redo size可以用来估量update/insert/delete的频率,大的redo size往往对lgwr写日志,和arch归档造成I/O压力, Per Transaction可以用来分辨是  大量小事务, 还是少量大事务。如上例每秒redo 约1MB ,每个事务800 字节,符合OLTP特征   
  74. Logical Read 单位  次数*块数, 相当于 “人*次”, 如上例  196,888 * db_block_size=1538MB/s , 逻辑读耗CPU,主频和CPU核数都很重要,逻辑读高则DB CPU往往高,也往往可以看到latch: cache buffer chains等待。  大量OLTP系统(例如siebel)可以高达几十乃至上百Gbytes。   
  75. Block changes 单位 次数*块数 , 描绘数据变化频率   
  76. Physical Read 单位次数*块数, 如上例 5076 * 8k = 39MB/s, 物理读消耗IO读,体现在IOPS和吞吐量等不同纬度上;但减少物理读可能意味着消耗更多CPU。好的存储 每秒物理读能力达到几GB,例如Exadata。  这个physical read包含了physical reads cache和physical reads direct   
  77. Physical writes 单位  次数*块数,主要是DBWR写datafile,也有direct path write。 dbwr长期写出慢会导致定期log file switch(checkpoint no complete) 检查点无法完成的前台等待。  这个physical write 包含了physical writes direct +physical writes from cache   
  78. User Calls 单位次数,用户调用数,more details from internal   
  79. Parses 解析次数,包括软解析+硬解析,软解析优化得不好,则夸张地说几乎等于每秒SQL执行次数。 即执行解析比1:1,而我们希望的是 解析一次 到处运行哦!   
  80. Hard Parses 万恶之源. Cursor pin s on X, library cache: mutex X , latch: row cache objects /shared pool……………..。 硬解析最好少于每秒20次   
  81. W/A MB processed 单位MB  W/A workarea  workarea中处理的数据数量  
  82.  结合 In-memory Sort%, sorts (disk) PGA Aggr一起看   
  83. Logons 登陆次数, logon storm 登陆风暴,结合AUDIT审计数据一起看。短连接的附带效应是游标缓存无用   
  84. Executes 执行次数,反应执行频率   
  85. Rollback 回滚次数, 反应回滚频率, 但是这个指标不太精确,参考而已,别太当真   
  86. Transactions 每秒事务数,是数据库层的TPS,可以看做压力测试或比对性能时的一个指标,孤立看无意义   
  87. % Blocks changed per Read 每次逻辑读导致数据块变化的比率;如果’redo size’, ‘block changes’ ‘pct of blocks changed per read’三个指标都很高,则说明系统正执行大量insert/update/delete;  
  88.  pct of blocks changed per read =  (block changes ) /( logical reads)   
  89. Recursive Call % 递归调用的比率;Recursive Call % = (recursive calls)/(user calls)   
  90. Rollback per transaction % 事务回滚比率。  Rollback per transaction %= (rollback)/(transactions)   
  91. Rows per Sort 平均每次排序涉及到的行数 ;  Rows per Sort= ( sorts(rows) ) / ( sorts(disk) + sorts(memory))   
  92.   
  93.    
  94.   
  95. 注意这些Load Profile 负载指标 在本环节提供了 2个维度 per second 和 per transaction。  
  96.   
  97. per Second:   主要是把 快照内的delta值除以 快站时间的秒数 , 例如 在 A快照中V$SYSSTAT视图反应 table scans (long tables) 这个指标是 100 ,在B快照中V$SYSSTAT视图反应 table scans (long tables) 这个指标是 3700, 而A快照和B快照 之间 间隔了一个小时 3600秒,  则  对于  table scans (long tables) per second  就是 (  3700- 100) /3600=1。  
  98.   
  99. pert Second是我们审视数据的主要维度 ,任何性能数据脱离了 时间模型则毫无意义。  
  100.   
  101. 在statspack/AWR出现之前 的调优 洪荒时代, 有很多DBA 依赖 V$SYSSTAT等视图中的累计 统计信息来调优,以当前的调优眼光来看,那无异于刀耕火种。  
  102.   
  103.    
  104.   
  105. per transaction  :  基于事务的维度, 与per second相比 是把除数从时间的秒数改为了该段时间内的事务数。 这个维度的很大用户是用来 识别应用特性的变化 ,若2个AWR性能报告中该维度指标 出现了大幅变化,例如 redo size从本来per transaction  1k变化为  10k per transaction,则说明SQL业务逻辑肯定发生了某些变化。  
  106.   
  107.    
  108.   
  109. 注意AWR中的这些指标 并不仅仅用来孤立地了解 Oracle数据库负载情况, 实施调优工作。   对于 故障诊断 例如HANG、Crash等, 完全可以通过对比问题时段的性能报告和常规时间来对比,通过各项指标的对比往往可以找出 病灶所在。  
  110.   
  111.    
  112. SELECT VALUE FROM DBA_HIST_SYSSTAT WHERE SNAP_ID = :B4 AND DBID = :B3 AND INSTANCE_NUMBER = :B2 AND STAT_NAME  in ( "db block changes","user calls","user rollbacks","user commits",redo size","physical reads direct","physical writes","parse count (hard)","parse count (total)","session logical reads","recursive calls","redo log space requests","redo entries","sorts (memory)","sorts (disk)","sorts (rows)","logons cumulative","parse time cpu","parse time elapsed","execute count","logons current","opened cursors current","DBWR fusion writes","gcs messages sent","ges messages sent","global enqueue gets sync","global enqueue get time","gc cr blocks received","gc cr block receive time","gc current blocks received","gc current block receive time","gc cr blocks served","gc cr block build time","gc cr block flush time","gc cr block send time","gc current blocks served","gc current block pin time","gc current block flush time","gc current block send time","physical reads","physical reads direct (lob)",  
  113.   
  114. SELECT TOTAL_WAITS FROM DBA_HIST_SYSTEM_EVENT WHERE SNAP_ID = :B4 AND DBID = :B3 AND INSTANCE_NUMBER = :B2 AND EVENT_NAME in ("gc buffer busy","buffer busy waits"  
  115.   
  116. SELECT VALUE FROM DBA_HIST_SYS_TIME_MODEL WHERE DBID = :B4 AND SNAP_ID = :B3 AND INSTANCE_NUMBER = :B2 AND STAT_NAME  in  ("DB CPU","sql execute elapsed time","DB time"  
  117.   
  118. SELECT VALUE FROM DBA_HIST_PARAMETER WHERE SNAP_ID = :B4 AND DBID = :B3 AND INSTANCE_NUMBER = :B2 AND PARAMETER_NAME  in ("__db_cache_size","__shared_pool_size","sga_target","pga_aggregate_target","undo_management","db_block_size","log_buffer","timed_statistics","statistics_level"  
  119.   
  120. SELECT BYTES FROM DBA_HIST_SGASTAT WHERE SNAP_ID = :B4 AND DBID = :B3 AND INSTANCE_NUMBER = :B2 AND POOL IN ('shared pool''all pools'AND NAME  in ("free memory",  
  121.   
  122. SELECT BYTES FROM DBA_HIST_SGASTAT WHERE SNAP_ID = :B4 AND DBID = :B3 AND INSTANCE_NUMBER = :B2 AND NAME = :B1 AND POOL IS NULL  
  123.   
  124. SELECT (E.BYTES_PROCESSED - B.BYTES_PROCESSED) FROM DBA_HIST_PGA_TARGET_ADVICE B, DBA_HIST_PGA_TARGET_ADVICE E WHERE B.DBID = :B4 AND B.SNAP_ID = :B3 AND B.INSTANCE_NUM  
  125. BER = :B2 AND B.ADVICE_STATUS = 'ON' AND E.DBID = B.DBID AND E.SNAP_ID = :B1 AND E.INSTANCE_NUMBER = B.INSTANCE_NUMBER AND E.PGA_TARGET_FACTOR = 1 AND B.PGA_TARGET_FACT  
  126. OR = 1 AND E.ADVICE_STATUS = 'ON'  
  127.   
  128. SELECT SUM(E.TOTAL_WAITS - NVL(B.TOTAL_WAITS, 0)) FROM DBA_HIST_SYSTEM_EVENT B, DBA_HIST_SYSTEM_EVENT E WHERE B.SNAP_ID(+) = :B4 AND E.SNAP_ID = :B3 AND B.DBID(+) = :B2  
  129. AND E.DBID = :B2 AND B.INSTANCE_NUMBER(+) = :B1 AND E.INSTANCE_NUMBER = :B1 AND B.EVENT_ID(+) = E.EVENT_ID AND (E.EVENT_NAME = 'latch free' OR E.EVENT_NAME LIKE 'latch  
  130. :%')  
  131.   
  132. SELECT DECODE(B.TOTAL_SQL, 0, 0, 100*(1-B.SINGLE_USE_SQL/B.TOTAL_SQL)), DECODE(E.TOTAL_SQL, 0, 0, 100*(1-E.SINGLE_USE_SQL/E.TOTAL_SQL)), DECODE(B.TOTAL_SQL_MEM, 0, 0, 1  
  133. 00*(1-B.SINGLE_USE_SQL_MEM/B.TOTAL_SQL_MEM)), DECODE(E.TOTAL_SQL_MEM, 0, 0, 100*(1-E.SINGLE_USE_SQL_MEM/E.TOTAL_SQL_MEM)) FROM DBA_HIST_SQL_SUMMARY B, DBA_HIST_SQL_SUMM  
  134. ARY E WHERE B.SNAP_ID = :B4 AND E.SNAP_ID = :B3 AND B.INSTANCE_NUMBER = :B2 AND E.INSTANCE_NUMBER = :B2 AND B.DBID = :B1 AND E.DBID = :B1  
  135.   
  136. SELECT EVENT, WAITS, TIME, DECODE(WAITS, NULL, TO_NUMBER(NULL), 0, TO_NUMBER(NULL), TIME/WAITS*1000) AVGWT, PCTWTT, WAIT_CLASS FROM (SELECT EVENT, WAITS, TIME, PCTWTT,  
  137. WAIT_CLASS FROM (SELECT E.EVENT_NAME EVENT, E.TOTAL_WAITS - NVL(B.TOTAL_WAITS,0) WAITS, (E.TIME_WAITED_MICRO - NVL(B.TIME_WAITED_MICRO,0)) / 1000000 TIME, 100 * (E.TIME  
  138. _WAITED_MICRO - NVL(B.TIME_WAITED_MICRO,0)) / :B1 PCTWTT, E.WAIT_CLASS WAIT_CLASS FROM DBA_HIST_SYSTEM_EVENT B, DBA_HIST_SYSTEM_EVENT E WHERE B.SNAP_ID(+) = :B5 AND E.S  
  139. NAP_ID = :B4 AND B.DBID(+) = :B3 AND E.DBID = :B3 AND B.INSTANCE_NUMBER(+) = :B2 AND E.INSTANCE_NUMBER = :B2 AND B.EVENT_ID(+) = E.EVENT_ID AND E.TOTAL_WAITS > NVL(B.TO  
  140. TAL_WAITS,0) AND E.WAIT_CLASS != 'Idle' UNION ALL SELECT 'CPU time' EVENT, TO_NUMBER(NULL) WAITS, :B6 /1000000 TIME, 100 * :B6 / :B1 PCTWTT, NULL WAIT_CLASS FROM DUAL W  
  141. HERE :B6 > 0) ORDER BY TIME DESC, WAITS DESCWHERE ROWNUM <= :B7  
  142.   
  143. SELECT SUM(E.TIME_WAITED_MICRO - NVL(B.TIME_WAITED_MICRO,0)) FROM DBA_HIST_SYSTEM_EVENT B, DBA_HIST_SYSTEM_EVENT E WHERE B.SNAP_ID(+) = :B4 AND E.SNAP_ID = :B3 AND B.DB  
  144. ID(+) = :B2 AND E.DBID = :B2 AND B.INSTANCE_NUMBER(+) = :B1 AND E.INSTANCE_NUMBER = :B1 AND B.EVENT_ID(+) = E.EVENT_ID AND E.WAIT_CLASS = 'User I/O'  
  145.   
  146. SELECT (E.ESTD_LC_TIME_SAVED - B.ESTD_LC_TIME_SAVED) FROM DBA_HIST_SHARED_POOL_ADVICE B, DBA_HIST_SHARED_POOL_ADVICE E WHERE B.DBID = :B3 AND B.INSTANCE_NUMBER = :B2 AN  
  147. D B.SNAP_ID = :B4 AND E.DBID = :B3 AND E.INSTANCE_NUMBER = :B2 AND E.SNAP_ID = :B1 AND E.SHARED_POOL_SIZE_FACTOR = 1 AND B.SHARED_POOL_SIZE_FACTOR = 1  
  148.   
  149.    
  150.   
  151.    
  152.   
  153.  1-3  Instance Efficiency Percentages (Target 100%)  
  154.   
  155.    
  156.   
  157.    
  158.   
  159.    
  160. Instance Efficiency Percentages (Target 100%)  
  161. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  162.             Buffer Nowait %:   99.97       Redo NoWait %:  100.00  
  163.             Buffer  Hit   %:   97.43    In-memory Sort %:  100.00  
  164.             Library Hit   %:   99.88        Soft Parse %:   99.58  
  165.          Execute to Parse %:   94.82         Latch Hit %:   99.95  
  166. Parse CPU to Parse Elapsd %:    1.75     % Non-Parse CPU:   99.85  
  167.   
  168.    
  169.   
  170.    
  171.   
  172.    
  173.   
  174. 上述所有指标 的目标均为100%,即越大越好,在少数bug情况下可能超过100%或者为负值。  
  175.   
  176.    
  177. ◾80%以上  %Non-Parse CPU  
  178. ◾90%以上  Buffer Hit%, In-memory Sort%, Soft Parse%  
  179. ◾95%以上  Library Hit%, Redo Nowait%, Buffer Nowait%  
  180. ◾98%以上  Latch Hit%  
  181.   
  182.    
  183.   
  184. 1、 Buffer Nowait %  session申请一个buffer(兼容模式)不等待的次数比例。 需要访问buffer时立即可以访问的比率,  不兼容的情况 在9i中是 buffer busy waits,从10g以后 buffer busy waits 分离为 buffer busy wait 和 read by other session2个等待事件 :  
  185.   
  186.    
  187.   
  188.    
  189. 9i 中 waitstat的总次数基本等于buffer busy waits等待事件的次数  
  190.   
  191. SQL> select sum(TOTAL_WAITS) from v$system_event where event='buffer busy waits';  
  192. SUM(TOTAL_WAITS)  
  193. —————-  
  194. 33070394  
  195.   
  196. SQL> select sum(countfrom v$waitstat;  
  197. SUM(COUNT)  
  198. ———-  
  199. 33069335  
  200.   
  201. 10g waitstat的总次数基本等于 buffer busy waits 和  read by other session 等待的次数总和  
  202.   
  203. SQL> select sum(TOTAL_WAITS) from v$system_event where event='buffer busy waits' or event='read by other session';  
  204. SUM(TOTAL_WAITS)  
  205. —————-  
  206. 60675815  
  207.   
  208. SQL> select sum(countfrom v$waitstat;  
  209.   
  210. SUM(COUNT)  
  211. ———-  
  212. 60423739  
  213.   
  214.    
  215.   
  216.    
  217.   
  218.    
  219.   
  220. Buffer Nowait %的计算公式是 sum(v$waitstat.wait_count) / (v$sysstat statistic session logical reads),例如在AWR中:  
  221.   
  222.    
  223.   
  224.    
  225.   
  226.   
  227. Class  
  228.   
  229. Waits  
  230.   
  231. Total Wait Time (s)  
  232.   
  233. Avg Time (ms)  
  234.   
  235. data block 24,543 2,267 92   
  236. undo header 743 2 3   
  237. undo block 1,116 0 0   
  238. 1st level bmb 35 0 0   
  239.   
  240.    
  241.   
  242. session logical reads 40,769,800 22,544.84 204.71   
  243.   
  244.    
  245.   
  246. Buffer Nowait %: 99.94   
  247.   
  248.    
  249.   
  250.    
  251.   
  252. Buffer Nowait= (  40,769,800 – (24543+743+1116+35))/ ( 40,769,800) = 0.99935= 99.94%  
  253.   
  254.    
  255.   
  256. SELECT SUM(WAIT_COUNT) FROM DBA_HIST_WAITSTAT WHERE SNAP_ID = :B3 AND DBID = :B2 AND INSTANCE_NUMBER = :B1  
  257.   
  258.    
  259.   
  260.    
  261.   
  262. 2、buffer HIT%: 经典的经典,高速缓存命中率,反应物理读和缓存命中间的纠结,但这个指标即便99% 也不能说明物理读等待少了  
  263.   
  264. 不合理的db_cache_size,或者是SGA自动管理ASMM /Memory 自动管理AMM下都可能因为db_cache_size过小引起大量的db file sequential /scattered read等待事件; maclean曾经遇到过因为大量硬解析导致ASMM 下shared pool共享池大幅度膨胀,而db cache相应缩小shrink的例子,最终db cache收缩到只有几百兆,本来没有的物理读等待事件都大幅涌现出来 。  
  265.   
  266. 此外与 buffer HIT%相关的指标值得关注的还有 table scans(long tables) 大表扫描这个统计项目、此外相关的栏目还有Buffer Pool Statistics 、Buffer Pool Advisory等(如果不知道在哪里,直接找一个AWR 去搜索这些关键词即可)。  
  267.   
  268.    
  269.   
  270.    
  271.   
  272. buffer HIT%在 不同版本有多个计算公式:  
  273.   
  274. 在9i中  
  275.   
  276. Buffer Hit Ratio = 1 – ((physical reads – physical reads direct – physical reads direct (lob)) / (db block gets + consistent gets – physical reads direct – physical reads direct (lob))  
  277.   
  278. 在10g以后:  
  279.   
  280. Buffer Hit Ratio=  1 – ((‘physical reads cache’) / (‘consistent gets from cache’ + ‘db block gets from cache’)  
  281.   
  282. 注意:但是实际AWR中 似乎还是按照9i中的算法,虽然算法的区别对最后算得的比率影响不大。  
  283.   
  284. 对于buffer hit % 看它的命中率有多高没有意义,主要是关注 未命中的次数有多少。通过上述公式很容易反推出未命中的物理读的次数。  
  285.   
  286. db block gets 、consistent gets 以及 session logical reads的关系如下:  
  287.   
  288. db block gets=db block gets direct+ db block gets from cache  
  289.   
  290. consistent gets = consistent gets from cache+ consistent gets direct  
  291.   
  292. consistent gets from cache= consistent gets – examination  + else  
  293.   
  294. consistent gets – examination==>指的是不需要pin buffer直接可以执行consistent get的次数,常用于索引,只需要一次latch get  
  295.   
  296.    
  297.   
  298. session logical reads = db block gets +consistent gets  
  299.   
  300.    
  301.   
  302. 其中physical reads 、physical reads cache、physical reads direct、physical reads direct (lob)几者的关系为:  
  303.   
  304. physical reads = physical reads cache + physical reads direct  
  305.   
  306. 这个公式其实说明了 物理读有2种 :  
  307. ◾物理读进入buffer cache中 ,是常见的模式 physical reads cache  
  308. ◾物理读直接进入PGA 直接路径读, 即physical reads direct  
  309.   
  310.    
  311.   
  312. physical reads 8 Total number of data blocks read from disk. This value can be greater than the value of “physical reads direct” plus “physical reads cache” as reads into process private buffers also included in this statistic.   
  313.   
  314. physical reads cache 8 Total number of data blocks read from disk into the buffer cache. This is a subset of “physical reads” statistic.   
  315.   
  316. physical reads direct 8 Number of reads directly from disk, bypassing the buffer cache. For example, in high bandwidth, data-intensive operations such as parallel query, reads of disk blocks bypass the buffer cache to maximize transfer rates and to prevent the premature aging of shared data blocks resident in the buffer cache.   
  317.   
  318.    
  319.   
  320.    
  321.   
  322. physical reads direct = physical reads direct (lob) + physical reads direct temporary tablespace +  physical reads direct(普通)  
  323.   
  324. 这个公式也说明了 直接路径读 分成三个部分:  
  325. ◾physical reads direct (lob) 直接路径读LOB对象  
  326. ◾physical reads direct temporary tablespace  直接路径读临时表空间  
  327. ◾physical read direct(普通)   普通的直接路径读, 一般是11g开始的自动的大表direct path read和并行引起的direct path read  
  328.   
  329.    
  330.   
  331. physical writes direct= physical writes direct (lob)+ physical writes direct temporary tablespace  
  332.   
  333. DBWR checkpoint buffers written = DBWR thread checkpoint buffers written+ DBWR tablespace checkpoint buffers written+ DBWR PQ tablespace checkpoint buffers written+….  
  334.   
  335.    
  336.   
  337. 3、Redo nowait%: session在生成redo entry时不用等待的比例,redo相关的资源争用例如redo space request争用可能造成生成redo时需求等待。此项数据来源于v$sysstat中的(redo log space requests/redo entries)。 一般来说10g以后不太用关注log_buffer参数的大小,需要关注是否有十分频繁的 log switch ; 过小的redo logfile size 如果配合较大的SGA和频繁的commit提交都可能造成该问题。 考虑增到redo logfile 的尺寸 : 1~4G 每个,7~10组都是合适的。同时考虑优化redo logfile和datafile 的I/O。  
  338.   
  339.    
  340.   
  341.    
  342.   
  343. 4、In-memory Sort%:这个指标因为它不计算workarea中所有的操作类型,所以现在越来越鸡肋了。 纯粹在内存中完成的排序比例。数据来源于v$sysstat statistics sorts (disk) 和 sorts (memory),  In-memory Sort% =  sort(memory) / ( sort(disk)+ sort(memory) )  
  344.   
  345.    
  346.   
  347. 5、  
  348.   
  349. Library Hit%:  library cache命中率,申请一个library cache object例如一个SQL cursor时,其已经在library cache中的比例。 数据来源  V$librarycache的pins和pinhits。 合理值:>95%       ,该比例来源于1- ( Σ(pin Requests * Pct Miss) / Sum(Pin Requests) )  
  350.   
  351.    
  352.   
  353.    
  354.   
  355. 维护这个指标的重点是 保持shared pool共享池有足够的Free Memory,且没有过多的内存碎片,具体可以参考这里。  显然过小的shared pool可用空间会导致library cache object被aged out换出共享池。  
  356.   
  357.    
  358.   
  359. 此外保证SQL语句绑定变量和游标可以共享也是很重要的因素。  
  360.   
  361.    
  362.   
  363.    
  364. Library Cache Activity                DB/Inst: G10R25/G10R25  Snaps: 2964-2965  
  365. -> "Pct Misses"  should be very low  http://www.askmaclean.com  
  366.   
  367.                          Get    Pct            Pin    Pct             Invali-  
  368. Namespace           Requests   Miss       Requests   Miss    Reloads  dations  
  369. --------------- ------------ ------ -------------- ------ ---------- --------  
  370. BODY                       5    0.0              6   16.7          1        0  
  371. CLUSTER                   10    0.0             26    0.0          0        0  
  372. SQL AREA             601,357   99.8        902,828   99.7         47        2  
  373. TABLE/PROCEDURE           83    9.6        601,443    0.0         48        0  
  374.   
  375.    
  376.   
  377. GETS NUMBER Number of times a lock was requested for objects of this namespace   
  378. GETHITS NUMBER Number of times an object’s handle was found in memory   
  379. GETHITRATIO NUMBER Ratio of GETHITS to GETS   
  380. PINS NUMBER Number of times a PIN was requested for objects of this namespace   
  381. PINHITS NUMBER Number of times all of the metadata pieces of the library object were found in memory   
  382. PINHITRATIO NUMBER Ratio of PINHITS to PINS   
  383. RELOADS NUMBER Any PIN of an object that is not the first PIN performed since the object handle was created, and which requires loading the object from disk   
  384. INVALIDATIONS NUMBER Total number of times objects in this namespace were marked invalid because a dependent object was modified   
  385.   
  386.    
  387.   
  388. SELECT SUM(PINS), SUM(PINHITS) FROM DBA_HIST_LIBRARYCACHE WHERE SNAP_ID = :B3 AND DBID = :B2 AND INSTANCE_NUMBER = :B1  
  389.   
  390.    
  391.   
  392. 6、  
  393.   
  394. Soft Parse: 软解析比例,无需多说的经典指标,数据来源v$sysstat statistics的parse count(total)和parse count(hard)。 合理值>95%  
  395.   
  396. Soft Parse %是AWR中另一个重要的解析指标,该指标反应了快照时间内 软解析次数 和 总解析次数 (soft+hard 软解析次数+硬解析次数)的比值,若该指标很低,那么说明了可能存在剧烈的hard parse硬解析,大量的硬解析会消耗更多的CPU时间片并产生解析争用(此时可以考虑使用cursor_sharing=FORCE); 理论上我们总是希望 Soft Parse % 接近于100%, 但并不是说100%的软解析就是最理想的解析状态,通过设置 session_cached_cursors参数和反复重用游标我们可以让解析来的更轻量级,即通俗所说的利用会话缓存游标实现的软软解析(soft soft parse)。  
  397.   
  398.    
  399.   
  400. 7、  
  401.   
  402. Execute  to Parse% 指标反映了执行解析比 其公式为 1-(parse/execute) , 目标为100% 及接近于只 执行而不解析。 数据来源v$sysstat statistics parse count (total) 和execute count  
  403.   
  404. 在oracle中解析往往是执行的先提工作,但是通过游标共享 可以解析一次 执行多次, 执行解析可能分成多种场景:  
  405. 1.hard coding => 硬编码代码 硬解析一次 ,执行一次, 则理论上其执行解析比 为 1:1 ,则理论上Execute to Parse =0 极差,且soft parse比例也为0%  
  406. 2.绑定变量但是仍软解析=》 软解析一次,执行一次 , 这种情况虽然比前一种好 但是执行解析比(这里的parse,包含了软解析和硬解析)仍是1:1, 理论上Execute to Parse =0 极差, 但是soft parse比例可能很高  
  407. 3.使用 静态SQL、动态绑定、session_cached_cursor、open cursors等技术实现的 解析一次,执行多次, 执行解析比为N:1, 则 Execute to Parse= 1- (1/N) 执行次数越多 Execute to Parse越接近100% ,这种是我们在OLTP环境中喜闻乐见的!  
  408.   
  409. 通俗地说 soft parse% 反映了软解析率, 而软解析在oracle中仍是较昂贵的操作, 我们希望的是解析1次执行N次,如果每次执行均需要软解析,那么虽然soft parse%=100% 但是parse time仍可能是消耗DB TIME的大头。  
  410.   
  411. Execute to Parse反映了 执行解析比,Execute to Parse和soft parse% 都很低 那么说明确实没有绑定变量 , 而如果 soft parse% 接近99% 而Execute to Parse 不足90% 则说明没有执行解析比低, 需要通过 静态SQL、动态绑定、session_cached_cursor、open cursors等技术减少软解析。  
  412.   
  413.    
  414.   
  415. 8、  
  416.   
  417. Latch Hit%: willing-to-wait latch闩申请不要等待的比例。 数据来源V$latch gets和misses  
  418.   
  419.    
  420.   
  421.    
  422. Latch Name  
  423. ----------------------------------------  
  424.   Get Requests      Misses      Sleeps  Spin Gets   Sleep1   Sleep2   Sleep3  
  425. -------------- ----------- ----------- ---------- -------- -------- --------  
  426. shared pool  
  427.      9,988,637         364          23        341        0        0        0  
  428. library cache  
  429.      6,753,468         152           6        146        0        0        0  
  430. Memory Management Latch  
  431.            369           1           1          0        0        0        0  
  432. qmn task queue latch  
  433.             24           1           1          0        0        0        0  
  434.   
  435.    
  436.   
  437.    
  438.   
  439. Latch Hit%:=  (1 – (Sum(misses) / Sum(gets)))  
  440.   
  441. 关于Latch的更多信息内容可以参考 AWR后面的专栏Latch Statistics, 注意对于一个并发设计良好的OLTP应用来说,Latch、Enqueue等并发控制不应当成为系统的主要瓶颈, 同时对于这些并发争用而言 堆积硬件CPU和内存 很难有效改善性能。  
  442.   
  443. SELECT SUM(GETS), SUM(MISSES) FROM DBA_HIST_LATCH WHERE SNAP_ID = :B3 AND DBID = :B2 AND INSTANCE_NUMBER = :B1  
  444.   
  445. 9、  
  446.   
  447. Parse CPU To Parse Elapsd:该指标反映了 快照内解析CPU时间和总的解析时间的比值(Parse CPU Time/ Parse Elapsed Time); 若该指标水平很低,那么说明在整个解析过程中 实际在CPU上运算的时间是很短的,而主要的解析时间都耗费在各种其他非空闲的等待事件上了(如latch:shared pool,row cache lock之类等)   数据来源 V$sysstat 的 parse time cpu和parse time elapsed  
  448.   
  449.    
  450.   
  451. 10、  
  452.   
  453. %Non-Parse CPU 非解析cpu比例,公式为  (DB CPU – Parse CPU)/DB CPU,  若大多数CPU都用在解析上了,则可能好钢没用在刃上了。 数据来源 v$sysstat 的 parse time cpu和 cpu used by this session  
  454.   
  455.    
  456.   
  457.    
  458.   
  459.    
  460.   
  461.  1-4    Shared Pool Statistics  
  462.   
  463.    
  464.   
  465.    
  466.  Shared Pool Statistics        Begin    End  
  467.                               ------  ------  
  468.              Memory Usage %:   84.64   79.67  
  469.     % SQL with executions>1:   93.77   24.69  
  470.   % Memory for SQL w/exec>1:   85.36   34.8  
  471.   
  472.    
  473.   
  474.    
  475.   
  476. 该环节提供一个大致的SQL重用及shared pool内存使用的评估。 应用是否共享SQL? 有多少内存是给只运行一次的SQL占掉的,对比共享SQL呢?  
  477.   
  478. 如果该环节中% SQL with executions>1的 比例 小于%90 , 考虑用下面链接的SQL去抓 硬编码的非绑定变量SQL语句。  
  479.   
  480. 利用FORCE_MATCHING_SIGNATURE捕获非绑定变量SQL  
  481.   
  482. Memory Usage %:    (shared pool 的实时大小- shared pool free memory)/ shared pool 的实时大小, 代表shared pool的空间使用率,虽然有使用率但没有标明碎片程度  
  483.   
  484. % SQL with executions>1      复用的SQL占总的SQL语句的比率,数据来源 DBA_HIST_SQL_SUMMARY 的 SINGLE_USE_SQL和TOTAL_SQL:1 – SINGLE_USE_SQL / TOTAL_SQL  
  485.   
  486. % Memory for SQL w/exec>1   执行2次以上的SQL所占内存占总的SQL内存的比率,数据来源DBA_HIST_SQL_SUMMARY 的SINGLE_USE_SQL_MEM和TOTAL_SQL_MEM:1 – SINGLE_USE_SQL_MEM / TOTAL_SQL_MEM  
  487.   
  488. ==》上面2个指标也可以用来大致了解shared pool中的内存碎片程序,因为SINGLE_USE_SQL 单次执行的SQL多的话,那么显然可能有较多的共享池内存碎片  
  489.   
  490. SQL复用率低的原因一般来说就是硬绑定变量(hard Coding)未合理使用绑定变量(bind variable),对于这种现象短期无法修改代表使用绑定变量的可以ALTER SYSTEM SET CURSOR_SHARING=FORCE; 来绕过问题,对于长期来看还是要修改代码绑定变量。   Oracle 从11g开始宣称今后将废弃CURSOR_SHARING的SIMILAR选项,同时SIMILAR选项本身也造成了很多问题,所以一律不推荐用CURSOR_SHARING=SIMILAR。  
  491.   
  492. 如果memory usage%比率一直很高,则可以关注下后面sga breakdown中的shared pool free memory大小,一般推荐至少让free memroy有个300~500MB 以避免隐患。  
  493.   
  494.    
  495.   
  496.    
  497.   
  498. 1-5 Top 5 Timed Events  
  499.   
  500.    
  501.   
  502.    
  503. Top 5 Timed Events                                         Avg %Total  
  504. ~~~~~~~~~~~~~~~~~~                                        wait   Call  
  505. Event                                 Waits    Time (s)   (ms)   Time Wait Class  
  506. ------------------------------ ------------ ----------- ------ ------ ----------  
  507. gc buffer busy                       79,083      73,024    923   65.4    Cluster  
  508. enq: TX - row lock contention        35,068      17,123    488   15.3 Applicatio  
  509. CPU time                                         12,205          10.9             
  510. gc current request                    2,714       3,315   1221    3.0    Cluster  
  511. gc cr multi block request            83,666       1,008     12    0.9    Cluster  
  512.   
  513.    
  514.   
  515.    
  516.   
  517. 基于Wait Interface的调优是目前的主流!每个指标都重要!  
  518.   
  519. 基于命中比例的调优,好比是统计局的报告, 张财主家财产100万,李木匠家财产1万, 平均财产50.5万。  
  520.   
  521. 基于等待事件的调优,好比马路上100辆汽车的行驶记录表,上车用了几分钟, 红灯等了几分钟,拥堵塞了几分钟。。。  
  522.   
  523. 丰富的等待事件以足够的细节来描绘系统运行的性能瓶颈,这是Mysql梦寐以求的东西……  
  524.   
  525.    
  526.   
  527. Waits : 该等待事件发生的次数, 对于DB CPU此项不可用  
  528.   
  529. Times : 该等待事件消耗的总计时间,单位为秒, 对于DB CPU 而言是前台进程所消耗CPU时间片的总和,但不包括Wait on CPU QUEUE  
  530.   
  531. Avg Wait(ms)  :  该等待事件平均等待的时间, 实际就是  Times/Waits,单位ms, 对于DB CPU此项不可用  
  532.   
  533. % Total Call Time, 该等待事件占总的call time的比率  
  534.   
  535. total call time  =  total CPU time + total wait time for non-idle events  
  536.   
  537. % Total Call Time  =  time for each timed event / total call time  
  538.   
  539. Wait Class: 等待类型:  
  540.   
  541. Concurrency,System I/O,User I/O,Administrative,Other,Configuration,Scheduler,Cluster,Application,Idle,Network,Commit  
  542.   
  543.    
  544.   
  545.    
  546.   
  547.    
  548.   
  549. CPU 上在干什么?  
  550.   
  551. 逻辑读? 解析?Latch spin? PL/SQL、函数运算?  
  552.   
  553. DB CPU/CPU timeTop 1 是好事情吗?  未必!  
  554.   
  555. 注意DB CPU不包含 wait on cpu queue!  
  556.   
  557.    
  558.   
  559.    
  560.   SELECT e.event_name event,  
  561.          e.total_waits - NVL (b.total_waits, 0) waits,  
  562.          DECODE (  
  563.             e.total_waits - NVL (b.total_waits, 0),  
  564.             0, TO_NUMBER (NULL),  
  565.             DECODE (  
  566.                e.total_timeouts - NVL (b.total_timeouts, 0),  
  567.                0, TO_NUMBER (NULL),  
  568.                  100  
  569.                * (e.total_timeouts - NVL (b.total_timeouts, 0))  
  570.                / (e.total_waits - NVL (b.total_waits, 0))))  
  571.             pctto,  
  572.          (e.time_waited_micro - NVL (b.time_waited_micro, 0)) / 1000000 time,  
  573.          DECODE (  
  574.             (e.total_waits - NVL (b.total_waits, 0)),  
  575.             0, TO_NUMBER (NULL),  
  576.             ( (e.time_waited_micro - NVL (b.time_waited_micro, 0)) / 1000)  
  577.             / (e.total_waits - NVL (b.total_waits, 0)))  
  578.             avgwt,  
  579.          DECODE (e.wait_class, 'Idle', 99, 0) idle  
  580.     FROM dba_hist_system_event b, dba_hist_system_event e  
  581.    WHERE     b.snap_id(+) = &bid  
  582.          AND e.snap_id = &eid  
  583.          --AND b.dbid(+) = :dbid  
  584.          --AND e.dbid = :dbid  
  585.          AND b.instance_number(+) = 1  
  586.          AND e.instance_number = 1  
  587.          AND b.event_id(+) = e.event_id  
  588.          AND e.total_waits > NVL (b.total_waits, 0)  
  589.          AND e.event_name NOT IN  
  590.                 ('smon timer',  
  591.                  'pmon timer',  
  592.                  'dispatcher timer',  
  593.                  'dispatcher listen timer',  
  594.                  'rdbms ipc message')  
  595. ORDER BY idle,  
  596.          time DESC,  
  597.          waits DESC,  
  598.          event  
  599.   
  600.    
  601.   
  602.    
  603.   
  604.    
  605.   
  606. 几种常见的等待事件  
  607.   
  608. =========================>  
  609.   
  610.    
  611.   
  612. db file scattered read,  Avg wait time应当小于20ms  如果数据库执行全表扫描或者是全索引扫描会执行 Multi block I/O ,此时等待物理I/O 结束会出现此等待事件。一般会从应用程序(SQL),I/O 方面入手调整; 注意和《Instance Activity Stats》中的index fast full scans (full) 以及 table scans (long tables)集合起来一起看。  
  613.   
  614.    
  615.   
  616. db file sequential read ,该等待事件Avg wait time平均单次等待时间应当小于20ms  
  617.   
  618. ”db file sequential read”单块读等待是一种最为常见的物理IO等待事件,这里的sequential指的是将数据块读入到相连的内存空间中(contiguous memory space),而不是指所读取的数据块是连续的。该wait event可能在以下情景中发生:  
  619.   
  620. http://www.askmaclean.com/archives/db-file-sequential-read-wait-event.html  
  621.   
  622.    
  623.   
  624. latch free  其实是未获得latch ,而进入latch sleep,见《全面解析9i以后Oracle Latch闩锁原理》  
  625.   
  626.    
  627.   
  628.    
  629.   
  630. enq:XX           队列锁等待,视乎不同的队列锁有不同的情况:  
  631.   
  632.    
  633.   
  634.    
  635. ◾你有多了解Oracle Enqueue lock队列锁机制?  
  636. ◾Oracle队列锁: Enqueue HW  
  637. ◾Oracle队列锁enq:US,Undo Segment  
  638. ◾enq: TX – row lock/index contention、allocate ITL等待事件  
  639. ◾enq: TT – contention等待事件  
  640. ◾Oracle队列锁enq:TS,Temporary Segment (also TableSpace)  
  641. ◾enq: JI – contention等待事件  
  642. ◾enq: US – contention等待事件  
  643. ◾enq: TM – contention等待事件  
  644. ◾enq: RO fast object reuse等待事件  
  645. ◾enq: HW – contention等待事件  
  646.   
  647.    
  648.   
  649.    
  650.   
  651. free buffer waits:是由于无法找到可用的buffer cache 空闲区域,需要等待DBWR 写入完成引起  
  652.   
  653.    
  654.   
  655.    
  656. ◾一般是由于  
  657. ◾低效的sql  
  658. ◾过小的buffer cache  
  659. ◾DBWR 工作负荷过量  
  660.   
  661.    
  662.   
  663.    
  664.   
  665. buffer busy wait/ read by other session  一般以上2个等待事件可以归为一起处理,建议客户都进行监控 。 以上等待时间可以由如下操作引起  
  666. select/select —- read by other session: 由于需要从 数据文件中将数据块读入 buffer cache 中引起,有可能是 大量的 逻辑/物理读  ;或者过小的 buffer cache 引起  
  667. select/update —- buffer busy waits/ read by other session  是由于更新某数据块后 需要在undo 中 重建构建 过去时间的块,有可能伴生 enq:cr-contention 是由于大量的物理读/逻辑读造成。  
  668. update/update —- buffer busy waits 由于更新同一个数据块(非同一行,同一行是enq:TX-contention) 此类问题是热点块造成  
  669. insert/insert —- buffer busy waits  是由于freelist 争用造成,可以将表空间更改为ASSM 管理 或者加大freelist 。  
  670.   
  671.    
  672.   
  673.    
  674.   
  675. write complete waits :一般此类等待事件是由于 DBWR 将脏数据写入 数据文件,其他进程如果需要修改 buffer cache会引起此等待事件,一般是 I/O 性能问题或者是DBWR 工作负荷过量引起  
  676.   
  677. Wait time  1 Seconds.  
  678.   
  679.    
  680.   
  681.    
  682.   
  683. control file parallel write:频繁的更新控制文件会造成大量此类等待事件,如日志频繁切换,检查点经常发生,nologging 引起频繁的数据文件更改,I/O 系统性能缓慢。  
  684.   
  685.    
  686.   
  687.    
  688.   
  689. log file sync:一般此类等待时间是由于 LGWR 进程讲redo log buffer 写入redo log 中发生。如果此类事件频繁发生,可以判断为:  
  690. commit 次数是否过多  
  691. ◾I/O 系统问题  
  692. ◾重做日志是否不必要被创建  
  693. ◾redo log buffer 是否过大  
  694.   
  695.    
  696.   
  697.    
  698.   
  699.    
  700.   
  701.  2-1 Time Model Statistics  
  702.   
  703.    
  704.   
  705.    
  706. Time Model Statistics             DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  707. -> Total time in database user-calls (DB Time): 883542.2s  
  708. -> Statistics including the word "background" measure background process  
  709.    timeand so do not contribute to the DB time statistic  
  710. -> Ordered by % or DB time desc, Statistic name  
  711.   
  712. Statistic Name                                       Time (s) % of DB Time  
  713. ------------------------------------------ ------------------ ------------  
  714. sql execute elapsed time                            805,159.7         91.1  
  715. sequence load elapsed time                           41,159.2          4.7  
  716. DB CPU                                               20,649.1          2.3  
  717. parse time elapsed                                    1,112.8           .1  
  718. hard parse elapsed time                                 995.2           .1  
  719. hard parse (sharing criteria) elapsed time              237.3           .0  
  720. hard parse (bind mismatch) elapsed time                 227.6           .0  
  721. connection management call elapsed time                  29.7           .0  
  722. PL/SQL execution elapsed time                             9.2           .0  
  723. PL/SQL compilation elapsed time                           6.6           .0  
  724. failed parse elapsed time                                 2.0           .0  
  725. repeated bind elapsed time                                0.4           .0  
  726. DB time                                             883,542.2  
  727. background elapsed time                              25,439.0  
  728. background cpu time                                   1,980.9  
  729.           -------------------------------------------------------------  
  730.   
  731.    
  732.   
  733. Time Model Statistics几个特别有用的时间指标:  
  734.   
  735.    
  736. ◾parse time elapsed、hard parse elapsed time 结合起来看解析是否是主要矛盾,若是则重点是软解析还是硬解析  
  737. sequence load elapsed time sequence序列争用是否是问题焦点  
  738. ◾PL/SQL compilation elapsed time PL/SQL对象编译的耗时  
  739. ◾注意PL/SQL execution elapsed time  纯耗费在PL/SQL解释器上的时间。不包括花在执行和解析其包含SQL上的时间  
  740. connection management call elapsed time 建立数据库session连接和断开的耗时  
  741. ◾failed parse elapsed time 解析失败,例如由于ORA-4031  
  742. ◾hard parse (sharing criteria) elapsed time  由于无法共享游标造成的硬解析  
  743. ◾hard parse (bind mismatch) elapsed time  由于bind type or bind size 不一致造成的硬解析  
  744.   
  745.    
  746.   
  747. 注意该时间模型中的指标存在包含关系所以Time Model Statistics加起来超过100%再正常不过  
  748.   
  749.    
  750.   
  751.    
  752. 1) background elapsed time  
  753.     2) background cpu time  
  754.           3) RMAN cpu time (backup/restore)  
  755. 1) DB time  
  756.     2) DB CPU  
  757.     2) connection management call elapsed time  
  758.     2) sequence load elapsed time  
  759.     2) sql execute elapsed time  
  760.     2) parse time elapsed  
  761.           3) hard parse elapsed time  
  762.                 4) hard parse (sharing criteria) elapsed time  
  763.                     5) hard parse (bind mismatch) elapsed time  
  764.           3) failed parse elapsed time  
  765.                 4) failed parse (out of shared memory) elapsed time  
  766.     2) PL/SQL execution elapsed time  
  767.     2) inbound PL/SQL rpc elapsed time  
  768.     2) PL/SQL compilation elapsed time  
  769.     2) Java execution elapsed time  
  770.     2) repeated bind elapsed time  
  771.   
  772.    
  773.   
  774.    
  775.   
  776.    
  777.   
  778. 2-2 Foreground Wait Class  
  779.   
  780.    
  781.   
  782.    
  783.   
  784.    
  785. Foreground Wait Class               
  786. -> s  - second, ms - millisecond -    1000th of a second  
  787. -> ordered by wait time desc, waits desc  
  788. -> %Timeouts: value of 0 indicates value was < .5%.  Value of null is truly 0   
  789. -> Captured Time accounts for        102.7%  of Total DB time     883,542.21 (s)  
  790. -> Total FG Wait Time:           886,957.73 (s)  DB CPU time:      20,649.06 (s)  
  791.   
  792.                                                                   Avg  
  793.                                       %Time       Total Wait     wait  
  794. Wait Class                      Waits -outs         Time (s)     (ms)  %DB time  
  795. -------------------- ---------------- ----- ---------------- -------- ---------  
  796. Cluster                     9,825,884     1          525,134       53      59.4  
  797. Concurrency                   688,375     0          113,782      165      12.9  
  798. User I/O                   34,405,042     0           76,695        2       8.7  
  799. Commit                        172,193     0           62,776      365       7.1  
  800. Application                    11,422     0           57,760     5057       6.5  
  801. Configuration                  19,418     1           48,889     2518       5.5  
  802. DB CPU                                                20,649                2.3  
  803. Other                       1,757,896    94              924        1       0.1  
  804. System I/O                     30,165     0              598       20       0.1  
  805. Network                   171,955,673     0              400        0       0.0  
  806. Administrative                      2   100                0      101       0.0  
  807.           -------------------------------------------------------------  
  808.   
  809. select distinct wait_class from v$event_name;  
  810.   
  811. WAIT_CLASS  
  812. ----------------------------------------------------------------  
  813. Concurrency  
  814. User I/O  
  815. System I/O  
  816. Administrative  
  817. Other  
  818. Configuration  
  819. Scheduler  
  820. Cluster  
  821. Application  
  822. Queueing  
  823. Idle  
  824. Network  
  825. Commit  
  826.   
  827.    
  828.   
  829.    
  830. ◾Wait Class: 等待事件的类型,如上查询所示,被分作12个类型。  10.2.0.5有916个等待事件,其中Other类型占622个。  
  831. ◾Waits:  该类型所属等待事件在快照时间内的等待次数  
  832. ◾%Time Out  等待超时的比率, 未 超时次数/waits  * 100 (%)  
  833. ◾Total Wait Time: 该类型所属等待事件总的耗时,单位为秒  
  834. Avg Wait(ms) : 该类型所属等待事件的平均单次等待时间,单位为ms ,实际这个指标对commit 和 user i/o 以及system i/o类型有点意义,其他等待类型由于等待事件差异较大所以看平均值的意义较小  
  835. ◾waits / txn:   该类型所属等待事件的等待次数和事务比  
  836.   
  837.    
  838.   
  839. Other 类型,遇到该类型等待事件 的话 常见的原因是Oracle Bug或者 网络、I/O存在问题, 一般推荐联系Maclean。  
  840.   
  841. Concurrency 类型   并行争用类型的等待事件,  典型的如 latch: shared pool、latch: library cache、row cache lock、library cache pin/lock  
  842.   
  843. Cluster 类型  为Real Application Cluster RAC环境中的等待事件, 需要注意的是 如果启用了RAC option,那么即使你的集群中只启动了一个实例,那么该实例也可能遇到 Cluster类型的等待事件, 例如gc buffer busy  
  844.   
  845. System I/O  主要是后台进程维护数据库所产生的I/O,例如control file parallel write 、log file parallel write、db file parallel write。  
  846.   
  847. User I/O    主要是前台进程做了一些I/O操作,并不是说后台进程不会有这些等待事件。 典型的如db file sequential/scattered  read、direct path read  
  848.   
  849. Configuration  由于配置引起的等待事件,  例如 日志切换的log file switch completion (日志文件 大小/数目 不够),sequence的enq: SQ – contention (Sequence 使用nocache) ; Oracle认为它们是由于配置不当引起的,但实际未必真是这样的配置引起的。  
  850.   
  851. Application  应用造成的等待事件, 例如enq: TM – contention和enq: TX – row lock contention; Oracle认为这是由于应用设计不当造成的等待事件, 但实际这些Application class 等待可能受到 Concurrency、Cluster、System I/O 、User I/O等多种类型等待的影响,例如本来commit只要1ms ,则某一行数据仅被锁定1ms, 但由于commit变慢 从而释放行锁变慢,引发大量的enq: TX – row lock contention等待事件。  
  852.   
  853.    
  854.   
  855. Commit  仅log file sync ,log file sync的影响十分广泛,值得我们深入讨论。  
  856.   
  857.    
  858.   
  859. Network :  网络类型的等待事件 例如 SQL*Net more data to client  、SQL*Net more data to dblink  
  860.   
  861. Idle 空闲等待事件 ,最为常见的是rdbms ipc message (等待实例内部的ipc通信才干活,即别人告知我有活干,我才干,否则我休息==》Idle), SQL*Net message from client(等待SQL*NET传来信息,否则目前没事干)  
  862.   
  863.    
  864.   
  865.    
  866.   
  867.  2-3 前台等待事件  
  868.   
  869.    
  870.   
  871.    
  872. Foreground Wait Events          Snaps: 70719-70723  
  873. -> s  - second, ms - millisecond -    1000th of a second  
  874. -> Only events with Total Wait Time (s) >= .001 are shown  
  875. -> ordered by wait time desc, waits desc (idle events last)  
  876. -> %Timeouts: value of 0 indicates value was < .5%.  Value of null is truly 0  
  877.   
  878.                                                              Avg  
  879.                                         %Time Total Wait    wait    Waits   % DB  
  880. Event                             Waits -outs   Time (s)    (ms)     /txn   time  
  881. -------------------------- ------------ ----- ---------- ------- -------- ------  
  882. gc buffer busy acquire        3,274,352     3    303,088      93     13.3   34.3  
  883. gc buffer busy release          387,673     2    128,114     330      1.6   14.5  
  884. enq: TX - index contention      193,918     0     97,375     502      0.8   11.0  
  885. cell single block physical   30,738,730     0     63,606       2    124.8    7.2  
  886. log file sync                   172,193     0     62,776     365      0.7    7.1  
  887. gc current block busy           146,154     0     53,027     363      0.6    6.0  
  888. enq: TM - contention              1,060     0     47,228   44555      0.0    5.3  
  889. enq: SQ - contention             17,431     0     35,683    2047      0.1    4.0  
  890. gc cr block busy                105,204     0     33,746     321      0.4    3.8  
  891. buffer busy waits               279,721     0     12,646      45      1.1    1.4  
  892. enq: HW - contention              1,201     3     12,192   10151      0.0    1.4  
  893. enq: TX - row lock content        9,231     0     10,482    1135      0.0    1.2  
  894. cell multiblock physical r      247,903     0      6,547      26      1.0     .7  
  895.   
  896.    
  897.   
  898. Foreground Wait Events 前台等待事件,数据主要来源于DBA_HIST_SYSTEM_EVENT  
  899.   
  900. Event 等待事件名字  
  901.   
  902. Waits  该等待事件在快照时间内等待的次数  
  903.   
  904. %Timeouts :  每一个等待事件有其超时的设置,例如buffer busy waits 一般为3秒, Write Complete Waits的 timeout为1秒,如果等待事件 单次等待达到timeout的时间,则会进入下一次该等待事件  
  905.   
  906. Total Wait Time  该等待事件 总的消耗的时间 ,单位为秒  
  907.   
  908. Avg wait(ms): 该等待事件的单次平均等待时间,单位为毫秒  
  909.   
  910. Waits/Txn: 该等待事件的等待次数和事务比  
  911.   
  912.    
  913.   
  914.    
  915.   
  916.    
  917.   
  918.  2-4 后台等待事件  
  919.   
  920.    
  921.   
  922.    
  923. Background Wait Events              Snaps: 70719-70723  
  924. -> ordered by wait time desc, waits desc (idle events last)  
  925. -> Only events with Total Wait Time (s) >= .001 are shown  
  926. -> %Timeouts: value of 0 indicates value was < .5%.  Value of null is truly 0  
  927.   
  928.                                                              Avg  
  929.                                         %Time Total Wait    wait    Waits   % bg  
  930. Event                             Waits -outs   Time (s)    (ms)     /txn   time  
  931. -------------------------- ------------ ----- ---------- ------- -------- ------  
  932. db file parallel write           90,979     0      7,831      86      0.4   30.8  
  933. gcs log flush sync            4,756,076     6      4,714       1     19.3   18.5  
  934. enq: CF - contention              2,123    40      4,038    1902      0.0   15.9  
  935. control file sequential re       90,227     0      2,380      26      0.4    9.4  
  936. log file parallel write         108,383     0      1,723      16      0.4    6.8  
  937. control file parallel writ        4,812     0        988     205      0.0    3.9  
  938. Disk file operations I/O         26,216     0        731      28      0.1    2.9  
  939. flashback log file write          9,870     0        720      73      0.0    2.8  
  940. LNS wait on SENDREQ             202,747     0        600       3      0.8    2.4  
  941. ASM file metadata operatio       15,801     0        344      22      0.1    1.4  
  942. cell single block physical       39,283     0        341       9      0.2    1.3  
  943. LGWR-LNS wait on channel        183,443    18        203       1      0.7     .8  
  944. gc current block busy               122     0        132    1082      0.0     .5  
  945. gc buffer busy release               60    12        127    2113      0.0     .5  
  946. Parameter File I/O                  592     0        116     195      0.0     .5  
  947. log file sequential read          1,804     0        104      58      0.0     .4  
  948.   
  949.    
  950.   
  951.    
  952.   
  953. Background Wait Events 后台等待事件, 数据主要来源于DBA_HIST_BG_EVENT_SUMMARY  
  954.   
  955.    
  956.   
  957. Event 等待事件名字  
  958.   
  959. Waits  该等待事件在快照时间内等待的次数  
  960.   
  961. %Timeouts :  每一个等待事件有其超时的设置,例如buffer busy waits 一般为3秒, Write Complete Waits的 timeout为1秒,如果等待事件 单次等待达到timeout的时间,则会进入下一次该等待事件  
  962.   
  963. Total Wait Time  该等待事件 总的消耗的时间 ,单位为秒  
  964.   
  965. Avg wait(ms): 该等待事件的单次平均等待时间,单位为毫秒  
  966.   
  967. Waits/Txn: 该等待事件的等待次数和事务比  
  968.   
  969.    
  970.   
  971.    
  972.   
  973.  2-5           Operating System Statistics  
  974.   
  975.    
  976.   
  977.    
  978. Operating System Statistics         Snaps: 70719-70723  
  979. TIME statistic values are diffed.  
  980.    All others display actual values.  End Value is displayed if different  
  981. -> ordered by statistic type (CPU Use, Virtual Memory, Hardware Config), Name  
  982.   
  983. Statistic                                  Value        End Value  
  984. ------------------------- ---------------------- ----------------  
  985. BUSY_TIME                              2,894,855  
  986. IDLE_TIME                              5,568,240  
  987. IOWAIT_TIME                               18,973  
  988. SYS_TIME                                 602,532  
  989. USER_TIME                              2,090,082  
  990. LOAD                                           8               13  
  991. VM_IN_BYTES                                    0  
  992. VM_OUT_BYTES                                   0  
  993. PHYSICAL_MEMORY_BYTES            101,221,343,232  
  994. NUM_CPUS                                      24  
  995. NUM_CPU_CORES                                 12  
  996. NUM_CPU_SOCKETS                                2  
  997. GLOBAL_RECEIVE_SIZE_MAX                4,194,304  
  998. GLOBAL_SEND_SIZE_MAX                   2,097,152  
  999. TCP_RECEIVE_SIZE_DEFAULT                  87,380  
  1000. TCP_RECEIVE_SIZE_MAX                   4,194,304  
  1001. TCP_RECEIVE_SIZE_MIN                       4,096  
  1002. TCP_SEND_SIZE_DEFAULT                     16,384  
  1003. TCP_SEND_SIZE_MAX                      4,194,304  
  1004. TCP_SEND_SIZE_MIN                          4,096  
  1005.           -------------------------------------------------------------  
  1006.   
  1007.    
  1008.   
  1009. Operating System Statistics   操作系统统计信息  
  1010.   
  1011.    
  1012.   
  1013. 数据来源于V$OSSTAT  / DBA_HIST_OSSTAT,,  TIME相关的指标单位均为百分之一秒  
  1014.   
  1015.    
  1016.   
  1017.   
  1018.   
  1019.   
  1020. 统计项 描述   
  1021. NUM_CPU_SOCKETS 物理CPU的数目   
  1022. NUM_CPU_CORES CPU的核数   
  1023. NUM_CPUS 逻辑CPU的数目   
  1024. SYS_TIME 在内核态被消耗掉的CPU时间片,单位为百分之一秒   
  1025. USER_TIME 在用户态被消耗掉的CPU时间片,单位为百分之一秒   
  1026. BUSY_TIME Busy_Time=SYS_TIME+USER_TIME 消耗的CPU时间片,单位为百分之一秒   
  1027. AVG_BUSY_TIME AVG_BUSY_TIME= BUSY_TIME/NUM_CPUS   
  1028. IDLE_TIME 空闲的CPU时间片,单位为百分之一秒   
  1029. 所有CPU所能提供总的时间片 BUSY_TIME + IDLE_TIME = ELAPSED_TIME * CPU_COUNT   
  1030. OS_CPU_WAIT_TIME 进程等OS调度的时间,cpu queuing   
  1031. VM_IN_BYTES 换入页的字节数   
  1032. VM_OUT_BYTES 换出页的字节数,部分版本下并不准确,例如Bug 11712010 Abstract: VIRTUAL MEMORY PAGING ON 11.2.0.2 DATABASES,仅供参考   
  1033. IOWAIT_TIME 所有CPU花费在等待I/O完成上的时间  单位为百分之一秒   
  1034. RSRC_MGR_CPU_WAIT_TIME 是指当resource manager控制CPU调度时,需要控制对应进程暂时不使用CPU而进程到内部运行队列中,以保证该进程对应的consumer group(消费组)没有消耗比指定resource manager指令更多的CPU。RSRC_MGR_CPU_WAIT_TIME指等在内部运行队列上的时间,在等待时不消耗CPU   
  1035.   
  1036.    
  1037.   
  1038.    
  1039.   
  1040. 2-6 Service Statistcs  
  1041.   
  1042.    
  1043.   
  1044.    
  1045. Service Statistics                 Snaps: 70719-70723  
  1046. -> ordered by DB Time  
  1047.   
  1048.                                                            Physical      Logical  
  1049. Service Name                  DB Time (s)   DB CPU (s)    Reads (K)    Reads (K)  
  1050. ---------------------------- ------------ ------------ ------------ ------------  
  1051. itms-contentmasterdb-prod         897,099       20,618       35,668    1,958,580  
  1052. SYS$USERS                           4,312          189        5,957       13,333  
  1053. itmscmp                             1,941          121       14,949       18,187  
  1054. itscmp                                331           20          114          218  
  1055. itscmp_dgmgrl                         121            1            0            0  
  1056. SYS$BACKGROUND                          0            0          142       30,022  
  1057. ITSCMP1_PR                              0            0            0            0  
  1058. its-reference-prod                      0            0            0            0  
  1059. itscmpXDB                               0            0            0            0  
  1060.   
  1061.    
  1062.   
  1063.    
  1064.   
  1065. 按照Service Name来分组时间模型和 物理、逻辑读取, 部分数据来源于 WRH$_SERVICE_NAME;  
  1066.   
  1067. Service Name  对应的服务名  (v$services), SYS$BACKGROUND代表后台进程, SYS$USERS一般是系统用户登录  
  1068.   
  1069. DB TIME (s):  本服务名所消耗的DB TIME时间,单位为秒  
  1070.   
  1071. DB CPU(s):  本服务名所消耗的DB CPU 时间,单位为秒  
  1072.   
  1073. Physical Reads : 本服务名所消耗的物理读  
  1074.   
  1075. Logical Reads : 本服务所消耗的逻辑读  
  1076.   
  1077.    
  1078.   
  1079.    
  1080.   
  1081.    
  1082.   
  1083. 2-7  Service Wait Class Stats   
  1084.   
  1085.    
  1086.   
  1087.    
  1088. Service Wait Class Stats            Snaps: 70719-70723  
  1089. -> Wait Class info for services in the Service Statistics section.  
  1090. -> Total Waits and Time Waited displayed for the following wait  
  1091.    classes:  User I/O, Concurrency, Administrative, Network  
  1092. -> Time Waited (Wt Timein seconds  
  1093.   
  1094. Service Name  
  1095. ----------------------------------------------------------------  
  1096.  User I/O  User I/O  Concurcy  Concurcy     Admin     Admin   Network   Network  
  1097. Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time Total Wts   Wt Time  
  1098. --------- --------- --------- --------- --------- --------- --------- ---------  
  1099. itms-contentmasterdb-prod  
  1100.  33321670     71443    678373    113759         0         0 1.718E+08       127  
  1101. SYS$USERS  
  1102.    173233      3656      6738        30         2         0     72674         3  
  1103. itmscmp  
  1104.    676773      1319      1831         0         0         0      2216         0  
  1105. itscmp  
  1106.    219577       236      1093         0         0         0     18112         0  
  1107. itscmp_dgmgrl  
  1108.        34         0         8         0         0         0         9         0  
  1109. SYS$BACKGROUND  
  1110.     71940      1300    320677        56         0         0    442252       872  
  1111.           -------------------------------------------------------------  
  1112.   
  1113.    
  1114.   
  1115.    
  1116. User I/O Total Wts : 对应该服务名下 用户I/O类等待的总的次数  
  1117. User I/O Wt Time : 对应该服务名下 用户I/O累等待的总时间,单位为 1/100秒  
  1118. ◾Concurcy Total Wts: 对应该服务名下 Concurrency 类型等待的总次数  
  1119. ◾Concurcy Wt Time :对应该服务名下 Concurrency 类型等待的总时间, 单位为 1/100秒  
  1120. ◾Admin Total Wts: 对应该服务名下Admin 类等待的总次数  
  1121. ◾Admin Wt Time: 对应该服务名下Admin类等待的总时间,单位为 1/100秒  
  1122. ◾Network Total Wts : 对应服务名下Network类等待的总次数  
  1123. ◾Network Wt Time: 对应服务名下Network类等待的总事件, 单位为 1/100秒  
  1124.   
  1125.    
  1126.   
  1127. 2-8 Host CPU   
  1128.   
  1129.    
  1130. Host CPU (CPUs:   24 Cores:   12 Sockets:    2)  
  1131. ~~~~~~~~         Load Average  
  1132.                Begin       End     %User   %System      %WIO     %Idle  
  1133.            --------- --------- --------- --------- --------- ---------  
  1134.                 8.41     12.84      24.7       7.1       0.2      65.8  
  1135.   
  1136.    
  1137.   
  1138. Load Average”  begin/end值代表每个CPU的大致运行队列大小。上例中快照开始到结束,平均 CPU负载增加了;与《2-5 Operating System Statistics》中的LOAD相呼应。  
  1139.   
  1140.    
  1141.   
  1142. %User+%System=> 总的CPU使用率,在这里是31.8%  
  1143.   
  1144.    
  1145.   
  1146. Elapsed Time * NUM_CPUS * CPU utilization= 60.23 (mins)  * 24 * 31.8% = 459.67536 mins=Busy Time  
  1147.   
  1148.    
  1149.   
  1150.    
  1151.   
  1152. 2-8 Instance CPU   
  1153.   
  1154.    
  1155. Instance CPU  
  1156. ~~~~~~~~~~~~  
  1157.               % of total CPU for Instance:      26.7  
  1158.               % of busy  CPU for Instance:      78.2  
  1159.   %DB time waiting for CPU - Resource Mgr:       0.0  
  1160.   
  1161. %Total CPU,该实例所使用的CPU占总CPU的比例  % of total CPU for Instance  
  1162.   
  1163. %Busy CPU,该实例所使用的Cpu占总的被使用CPU的比例  % of busy CPU for Instance  
  1164.   
  1165. 例如共4个逻辑CPU,其中3个被完全使用,3个中的1个完全被该实例使用,则%Total CPU= ¼ =25%,而%Busy CPU= 1/3= 33%  
  1166.   
  1167. 当CPU高时一般看%Busy CPU可以确定CPU到底是否是本实例消耗的,还是主机上其他程序  
  1168.   
  1169. of busy CPU for Instance= (DB CPU+ background cpu time) / (BUSY_TIME /100)= (20,649.1  + 1,980.9)/ (2,894,855 /100)= 78.17%  
  1170.   
  1171. of Total CPU for Instance = ( DB CPU+ background cpu time)/( BUSY_TIME+IDLE_TIME/100) = (20,649.1  + 1,980.9)/ ((2,894,855+5,568,240) /100) = 26.73%  
  1172.   
  1173. %DB time waiting for CPU (Resource Manager)= (RSRC_MGR_CPU_WAIT_TIME/100)/DB TIME  
  1174.   
  1175.    
  1176.   
  1177.    
  1178.   
  1179. TOP SQL  
  1180.   
  1181.    
  1182.   
  1183. TOP SQL 的数据部分来源于 dba_hist_sqlstat  
  1184.   
  1185.    
  1186.   
  1187. 3-1 SQL ordered by Elapsed Time ,按照SQL消耗的时间来排列TOP SQL  
  1188.   
  1189.    
  1190.   
  1191.    
  1192. SQL ordered by Elapsed Time        Snaps: 70719-70723  
  1193. -> Resources reported for PL/SQL code includes the resources used by all SQL  
  1194.    statements called by the code.  
  1195. -> % Total DB Time is the Elapsed Time of the SQL statement divided  
  1196.    into the Total Database Time multiplied by 100  
  1197. -> %Total - Elapsed Time  as a percentage of Total DB time  
  1198. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1199. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1200. -> Captured SQL account for   53.9% of Total DB Time (s):         883,542  
  1201. -> Captured PL/SQL account for    0.5% of Total DB Time (s):         883,542  
  1202.   
  1203.         Elapsed                  Elapsed Time  
  1204.         Time (s)    Executions  per Exec (s)  %Total   %CPU    %IO    SQL Id  
  1205. ---------------- -------------- ------------- ------ ------ ------ -------------  
  1206.        181,411.3         38,848          4.67   20.5     .0     .1 g0yc9szpuu068  
  1207.   
  1208.    
  1209.   
  1210.    
  1211.   
  1212.    
  1213.   
  1214. 注意对于PL/SQL,SQL Statistics不仅会体现该PL/SQL的执行情况,还会包括该PL/SQL包含的SQL语句的情况。如上例一个TOP PL/SQL执行了448s,而这448s中绝大多数是这个PL/SQL下的一个SQL执行500次耗费的。  
  1215.   
  1216. 则该TOP PL/SQL和TOP SQL都上榜,一个执行一次耗时448s,一个执行500次耗时448s。 如此情况则Elapsed Time加起来可能超过100%的Elapsed Time,这是正常的。  
  1217.   
  1218. 对于鹤立鸡群的SQL很有必要一探究竟,跑个@?/rdbms/admin/awrsqrpt看看吧!  
  1219.   
  1220.    
  1221.   
  1222. Elapsed Time (s): 该SQL累计运行所消耗的时间,  
  1223.   
  1224. Executions :  该SQL在快照时间内 总计运行的次数    ;  注意, 对于在快照时间内还没有执行完的SQL 不计为1一次,所以如果看到executions=0而 又是TOP SQL,则很有可能是因为该SQL 运行较旧还没执行完,需要特别关注一下。  
  1225.   
  1226.    
  1227.   
  1228.    
  1229.   
  1230. Elapsed Time per Exec (s):平均每次执行该SQL耗费的时间 , 对于OLTP类型的SELECT/INSERT/UPDATE/DELETE而言平均单次执行时间应当非常短,如0.1秒 或者更短才能满足其业务需求,如果这类轻微的OLTP操作单次也要几秒钟的话,是无法满足对外业务的需求的; 例如你在ATM上提款,并不仅仅是对你的账务库的简单UPDATE,而需要在类似风险控制的前置系统中记录你本次的流水操作记录,实际取一次钱可能要有几十乃至上百个OLTP类型的语句被执行,但它们应当都是十分快速的操作; 如果这些操作也变得很慢,则会出现大量事务阻塞,系统负载升高,DB TIME急剧上升的现象。  对于OLTP数据库而言 如果执行计划稳定,那么这些OLTP操作的性能应当是铁板钉钉的,但是一旦某个因素 发生变化,例如存储的明显变慢、内存换页的大量出现时 则上述的这些transaction操作很可能成数倍到几十倍的变慢,这将让此事务系统短期内不可用。  
  1231.   
  1232. 对于维护操作,例如加载或清除数据,大的跑批次、报表而言 Elapsed Time per Exec (s)高一些是正常的。  
  1233.   
  1234. %Total  该SQL所消耗的时间占总的DB Time的百分比, 即 (SQL Elapsed Time / Total DB TIME)  
  1235.   
  1236. % CPU   该SQL 所消耗的CPU 时间 占 该SQL消耗的时间里的比例, 即 (SQL CPU Time / SQL Elapsed Time) ,该指标说明了该语句是否是CPU敏感的  
  1237.   
  1238. %IO 该SQL 所消耗的I/O 时间 占 该SQL消耗的时间里的比例, 即(SQL I/O Time/SQL Elapsed Time) ,该指标说明了该语句是否是I/O敏感的  
  1239.   
  1240. SQL Id : 通过计算SQL 文本获得的SQL_ID ,不同的SQL文本必然有不同的SQL_ID, 对于10g~11g而言 只要SQL文本不变那么在数据库之间 该SQL 对应的SQL_ID应当不不变的, 12c中修改了SQL_ID的计算方法  
  1241.   
  1242.    
  1243.   
  1244. Captured SQL account for   53.9% of Total DB Time (s) 对于不绑定变量的应用来说Top SQL有可能失准,所以要参考本项  
  1245.   
  1246.    
  1247.   
  1248. 3-2  SQL ordered by CPU Time  
  1249.   
  1250.   
  1251.    
  1252.   
  1253.    
  1254.   
  1255.    
  1256. SQL ordered by CPU Time             Snaps: 70719-70723  
  1257. -> Resources reported for PL/SQL code includes the resources used by all SQL  
  1258.    statements called by the code.  
  1259. -> %Total - CPU Time      as a percentage of Total DB CPU  
  1260. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1261. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1262. -> Captured SQL account for   34.9% of Total CPU Time (s):          20,649  
  1263. -> Captured PL/SQL account for    0.5% of Total CPU Time (s):          20,649  
  1264.   
  1265.     CPU                   CPU per           Elapsed  
  1266.   Time (s)  Executions    Exec (s) %Total   Time (s)   %CPU    %IO    SQL Id  
  1267. ---------- ------------ ---------- ------ ---------- ------ ------ -------------  
  1268.    1,545.0    1,864,424       0.00    7.5    4,687.8   33.0   65.7 8g6a701j83c8q  
  1269. Module: MZIndexer  
  1270. SELECT t0.BOOLEAN_VALUE, t0.CLASS_CODE, t0.CREATED, t0.END_DATE, t0.PRODUCT_ATTR  
  1271. IBUTE_ID, t0.LAST_MODIFIED, t0.OVERRIDE_FLAG, t0.PRICE, t0.PRODUCT_ATTRIBUTE_TYP  
  1272. E_ID, t0.PRODUCT_ID, t0.PRODUCT_PUB_RELEASE_TYPE_ID, t0.PRODUCT_VOD_TYPE_ID, t0.  
  1273. SAP_PRODUCT_ID, t0.START_DATE, t0.STRING_VALUE FROM mz_product_attribute t0 WHER  
  1274.   
  1275.    
  1276.   
  1277.    
  1278.   
  1279. CPU TIME :   该SQL 在快照时间内累计执行所消耗的CPU 时间片,单位为s  
  1280.   
  1281. Executions :  该SQL在快照时间内累计执行的次数  
  1282.   
  1283. CPU per Exec (s) :该SQL 平均单次执行所消耗的CPU时间 ,  即  ( SQL CPU TIME / SQL Executions )  
  1284.   
  1285. %Total : 该SQL 累计消耗的CPU时间 占  该时段总的 DB CPU的比例,  即 ( SQL CPU TIME /  Total DB CPU)  
  1286.   
  1287. % CPU   该SQL 所消耗的CPU 时间 占 该SQL消耗的时间里的比例, 即 (SQL CPU Time / SQL Elapsed Time) ,该指标说明了该语句是否是CPU敏感的  
  1288.   
  1289. %IO 该SQL 所消耗的I/O 时间 占 该SQL消耗的时间里的比例, 即(SQL I/O Time/SQL Elapsed Time) ,该指标说明了该语句是否是I/O敏感的  
  1290.   
  1291.    
  1292.   
  1293.    
  1294.   
  1295.    
  1296.   
  1297. 3-3 Buffer Gets SQL ordered by Gets  
  1298.   
  1299.    
  1300.   
  1301.    
  1302. SQL ordered by Gets               DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  1303. -> Resources reported for PL/SQL code includes the resources used by all SQL  
  1304.    statements called by the code.  
  1305. -> %Total - Buffer Gets   as a percentage of Total Buffer Gets  
  1306. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1307. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1308. -> Total Buffer Gets:   2,021,476,421  
  1309. -> Captured SQL account for   68.2% of Total  
  1310.   
  1311.      Buffer                 Gets              Elapsed  
  1312.       Gets   Executions   per Exec   %Total   Time (s)   %CPU    %IO    SQL Id  
  1313. ----------- ----------- ------------ ------ ---------- ------ ------ -----------  
  1314. 4.61155E+08   1,864,424        247.3   22.8    4,687.8   33.0   65.7 8g6a701j83c  
  1315.   
  1316.    
  1317.   
  1318. 注意 buffer gets 逻辑读是消耗CPU TIME的重要源泉, 但并不是说消耗CPU TIME的只有buffer gets。 大多数情况下 SQL order by CPU TIME 和 SQL order by buffers gets 2个部分的TOP SQL 及其排列顺序都是一样的,此种情况说明消耗最多buffer gets的 就是消耗最多CPU 的SQL ,如果我们希望降低系统的CPU使用率,那么只需要调优SQL 降低buffer gets 即可。  
  1319.   
  1320. 但也并不是100%的情况都是如此, CPU TIME的消耗者 还包括 函数运算、PL/SQL 控制、Latch /Mutex 的Spin等等, 所以SQL order by CPU TIME 和 SQL order by buffers gets 2个部分的TOP SQL 完全不一样也是有可能的, 需要因地制宜来探究到底是什么问题导致的High CPU,进而裁度解决之道。  
  1321.   
  1322.    
  1323.   
  1324. Buffer Gets : 该SQL在快照时间内累计运行所消耗的buffer gets,包括了consistent read 和 current read  
  1325.   
  1326. Executions :  该SQL在快照时间内累计执行的次数  
  1327.   
  1328. Gets  per Exec : 该SQL平均单次的buffer gets , 对于事务型transaction操作而言 一般该单次buffer gets小于2000  
  1329.   
  1330. % Total  该SQL 累计运行所消耗的buffer gets占 总的db buffer gets的比率, (SQL buffer gets / DB total buffer gets)  
  1331.   
  1332.    
  1333.   
  1334.    
  1335.   
  1336.    
  1337.   
  1338. 3-4  Physical Reads  SQL ordered by Reads  
  1339.   
  1340.    
  1341.   
  1342.    
  1343. SQL ordered by Reads              DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  1344. -> %Total - Physical Reads as a percentage of Total Disk Reads  
  1345. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1346. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1347. -> Total Disk Reads:      56,839,035  
  1348. -> Captured SQL account for   34.0% of Total  
  1349.   
  1350.    Physical              Reads              Elapsed  
  1351.       Reads  Executions per Exec   %Total   Time (s)   %CPU    %IO    SQL Id  
  1352. ----------- ----------- ---------- ------ ---------- ------ ------ -------------  
  1353.   9,006,163           1 9.0062E+06   15.8      720.9    5.9   80.9 4g36tmp70h185  
  1354.   
  1355. Physical reads : 该SQL累计运行所消耗的物理读  
  1356.   
  1357. Executions :  该SQL在快照时间内累计执行的次数  
  1358.   
  1359. Reads per Exec : 该SQL 单次运行所消耗的物理读,  (SQL Physical reads/Executions) , 对于OLTP transaction 类型的操作而言单次一般不超过100  
  1360.   
  1361. %Total : 该SQL 累计消耗的物理读 占  该时段总的 物理读的比例,  即 ( SQL physical read  /  Total DB physical read )  
  1362.   
  1363.    
  1364.   
  1365.    
  1366.   
  1367. 3-5 Executions  SQL ordered by Executions  
  1368.   
  1369.    
  1370.   
  1371.    
  1372. SQL ordered by Executions         Snaps: 70719-70723  
  1373. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1374. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1375. -> Total Executions:      48,078,147  
  1376. -> Captured SQL account for   50.4% of Total  
  1377.   
  1378.                                               Elapsed  
  1379.  Executions   Rows Processed  Rows per Exec   Time (s)   %CPU    %IO    SQL Id  
  1380. ------------ --------------- -------------- ---------- ------ ------ -----------  
  1381.    6,327,963      11,249,645            1.8      590.5   47.8   52.7 1avv7759j8r  
  1382.   
  1383.    
  1384.   
  1385. 按照 执行次数来排序的话,也是性能报告对比时一个重要的参考因素,因为如果TOP SQL的执行次数有明显的增长,那么 性能问题的出现也是意料之中的事情了。 当然执行次数最多的,未必便是对性能影响最大的TOP SQL  
  1386.   
  1387.    
  1388.   
  1389. Executions :  该SQL在快照时间内累计执行的次数  
  1390.   
  1391. Rows Processed: 该SQL在快照时间内累计执行所处理的总行数  
  1392.   
  1393. Rows per Exec: SQL平均单次执行所处理的行数,  这个指标在诊断一些 数据问题造成的SQL性能问题时很有用  
  1394.   
  1395.    
  1396.   
  1397.    
  1398.   
  1399. 3-6 Parse Calls     SQL ordered by Parse Calls  
  1400.   
  1401.    
  1402.   
  1403.    
  1404. SQL ordered by Parse Calls          Snaps: 70719-70723  
  1405. -> Total Parse Calls:       2,160,124  
  1406. -> Captured SQL account for   58.3% of Total  
  1407.   
  1408.                             % Total  
  1409.  Parse Calls  Executions     Parses    SQL Id  
  1410. ------------ ------------ --------- -------------  
  1411.      496,475      577,357     22.98 d07gaa3wntdff  
  1412.   
  1413.    
  1414.   
  1415.    
  1416.   
  1417.    
  1418.   
  1419. Parse Calls : 解析调用次数, 与上文的 Load Profile中的Parse 数一样 包括 软解析soft parse和硬解析hard parse  
  1420.   
  1421. Executions :  该SQL在快照时间内累计执行的次数  
  1422.   
  1423. %Total Parses : 本SQL 解析调用次数 占 该时段数据库总解析次数的比率, 为 (SQL Parse Calls / Total DB Parse Calls)  
  1424.   
  1425.    
  1426.   
  1427.    
  1428.   
  1429. 3-7  SQL ordered by Sharable Memory  
  1430.   
  1431.    
  1432.   
  1433.    
  1434. SQL ordered by Sharable Memory     Snaps: 70719-70723  
  1435. -> Only Statements with Sharable Memory greater than 1048576 are displayed  
  1436.   
  1437. Sharable Mem (b)  Executions   % Total    SQL Id  
  1438. ---------------- ------------ -------- -------------  
  1439.        8,468,359           39     0.08 au89sasqfb2yn  
  1440. Module: MZContentBridge  
  1441. SELECT t0.ASPECT_RATIO, t0.CREATED, t0.FILE_EXTENSION, t0.HEIGHT, t0.VIDEO_FILE_  
  1442. DIMENSIONS_ID, t0.LAST_MODIFIED, t0.NAME, t0.WIDTH FROM MZ_VIDEO_FILE_DIMENSIONS  
  1443.  t0 WHERE (t0.HEIGHT = :1 AND t0.WIDTH = :2 )  
  1444.   
  1445.    
  1446.   
  1447.    
  1448.   
  1449. SQL ordered by Sharable Memory ,    一般该部分仅列出Sharable Mem (b)为1 MB以上的SQL 对象 (Only Statements with Sharable Memory greater than 1048576 are displayed)   数据来源是 DBA_HIST_SQLSTAT.SHARABLE_MEM  
  1450.   
  1451. Shareable Mem(b):  SQL 对象所占用的共享内存使用量  
  1452.   
  1453. Executions :  该SQL在快照时间内累计执行的次数  
  1454.   
  1455. %Total :  该SQL 对象锁占共享内存 占总的共享内存的比率  
  1456.   
  1457.    
  1458.   
  1459.    
  1460.   
  1461. 3-8   SQL ordered by Version Count  
  1462.   
  1463.   
  1464.    
  1465.   
  1466. Version Count  Oracle中的执行计划可以是多版本的,即对于同一个SQL语句有多个不同版本的执行计划,这些执行计划又称作子游标, 而一个SQL语句的文本可以称作一个父游标。 一个父游标对应多个子游标,产生不同子游标的原因是 SQL在被执行时无法共享之前已经生成的子游标, 原因是多种多样的,例如 在本session中做了一个优化器参数的修改 例如optimizer_index_cost_adj 从100 修改到99,则本session的优化环境optimizer env将不同于之前的子游标生成环境,这样就需要生成一个新的子游标,例如:  
  1467.   
  1468.    
  1469.   
  1470.    
  1471. SQL> create table emp as select * from scott.emp;  
  1472.   
  1473. Table created.  
  1474.   
  1475. SQL> select * from emp where empno=1;  
  1476.   
  1477. no rows selected  
  1478.   
  1479. SQL> select /*+ MACLEAN */ * from emp where empno=1;  
  1480.   
  1481. no rows selected  
  1482.   
  1483. SQL> select SQL_ID,version_count from V$SQLAREA WHERE SQL_TEXT like '%MACLEAN%' and SQL_TEXT not like '%like%';  
  1484.   
  1485. SQL_ID        VERSION_COUNT  
  1486. ------------- -------------  
  1487. bxnnm7z1qmg26             1  
  1488.   
  1489. SQL> select count(*) from v$SQL where SQL_ID='bxnnm7z1qmg26';  
  1490.   
  1491.   COUNT(*)  
  1492. ----------  
  1493.          1  
  1494.   
  1495. SQL> alter session set optimizer_index_cost_adj=99;  
  1496.   
  1497. Session altered.  
  1498.   
  1499. SQL> select /*+ MACLEAN */ * from emp where empno=1;  
  1500.   
  1501. no rows selected  
  1502.   
  1503. SQL> select SQL_ID,version_count from V$SQLAREA WHERE SQL_TEXT like '%MACLEAN%' and SQL_TEXT not like '%like%';  
  1504.   
  1505. SQL_ID        VERSION_COUNT  
  1506. ------------- -------------  
  1507. bxnnm7z1qmg26             2  
  1508.   
  1509. SQL> select count(*) from v$SQL where SQL_ID='bxnnm7z1qmg26';  
  1510.   
  1511.   COUNT(*)  
  1512. ----------  
  1513.          2  
  1514.   
  1515. SQL> select child_number ,OPTIMIZER_ENV_HASH_VALUE,PLAN_HASH_VALUE from v$SQL where SQL_ID='bxnnm7z1qmg26';  
  1516.   
  1517. CHILD_NUMBER OPTIMIZER_ENV_HASH_VALUE PLAN_HASH_VALUE  
  1518. ------------ ------------------------ ---------------  
  1519.            0               3704128740      3956160932  
  1520.            1               3636478958      3956160932  
  1521.   
  1522.    
  1523.   
  1524.    
  1525.   
  1526. 可以看到上述 演示中修改optimizer_index_cost_adj=99 导致CBO 优化器的优化环境发生变化, 表现为不同的OPTIMIZER_ENV_HASH_VALUE,之后生成了2个子游标,但是这2个子游标的PLAN_HASH_VALUE同为3956160932,则说明了虽然是不同的子游标但实际子游标里包含了的执行计划是一样的;  所以请注意 任何一个优化环境的变化 (V$SQL_SHARED_CURSOR)以及相关衍生的BUG 都可能导致子游标无法共享,虽然子游标无法共享但这些子游标扔可能包含完全一样的执行计划,这往往是一种浪费。  
  1527.   
  1528. 注意V$SQLAREA.VERSION_COUNT 未必等于select count(*) FROM V$SQL WHERE SQL_ID=”  ,即 V$SQLAREA.VERSION_COUNT 显示的子游标数目 未必等于当前实例中还存有的子游标数目, 由于shared pool aged out算法和其他一些可能导致游标失效的原因存在,所以子游标被清理掉是很常见的事情。 V$SQLAREA.VERSION_COUNT只是一个计数器,它告诉我们曾经生成了多少个child cursor,但不保证这些child 都还在shared pool里面。  
  1529.   
  1530. 此外可以通过v$SQL的child_number字段来分析该问题,如果child_number存在跳号则也说明了部分child被清理了。  
  1531.   
  1532.    
  1533.   
  1534.    
  1535.   
  1536. 子游标过多的影响, 当子游标过多(例如超过3000个时),进程需要去扫描长长的子游标列表child cursor list以找到一个合适的子游标child cursor,进而导致cursor sharing 性能问题 现大量的Cursor: Mutex S 和 library cache lock等待事件。  
  1537.   
  1538. 关于子游标的数量控制,可以参考《11gR2游标共享新特性带来的一些问题以及_cursor_features_enabled、_cursor_obsolete_threshold和106001 event》。  
  1539.   
  1540.    
  1541.   
  1542. Executions :  该SQL在快照时间内累计执行的次数  
  1543.   
  1544.    
  1545.   
  1546. Hash Value :  共享SQL 的哈希值  
  1547.   
  1548.    
  1549.   
  1550. Only Statements with Version Count greater than 20 are displayed    注意该环节仅列出version count > 20的语句  
  1551.   
  1552.    
  1553.   
  1554.    
  1555.   
  1556.  3-9   Cluster Wait Time SQL ordered by Cluster Wait Time   
  1557.   
  1558.    
  1559.   
  1560.    
  1561. SQL ordered by Cluster Wait Time  DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  1562. -> %Total - Cluster Time  as a percentage of Total Cluster Wait Time  
  1563. -> %Clu   - Cluster Time  as a percentage of Elapsed Time  
  1564. -> %CPU   - CPU Time      as a percentage of Elapsed Time  
  1565. -> %IO    - User I/O Time as a percentage of Elapsed Time  
  1566. -> Only SQL with Cluster Wait Time > .005 seconds is reported  
  1567. -> Total Cluster Wait Time (s):         525,480  
  1568. -> Captured SQL account for   57.2% of Total  
  1569.   
  1570.        Cluster                        Elapsed  
  1571.  Wait Time (s)   Executions %Total    Time(s)   %Clu   %CPU    %IO    SQL Id  
  1572. -------------- ------------ ------ ---------- ------ ------ ------ -------------  
  1573.      132,639.3       38,848   25.2  181,411.3   73.1     .0     .1 g0yc9szpuu068  
  1574.   
  1575.    
  1576.   
  1577.    
  1578.   
  1579.    
  1580.   
  1581. Only SQL with Cluster Wait Time > .005 seconds is reported  这个环节仅仅列出Cluster Wait Time > 0.005 s的SQL  
  1582.   
  1583. 该环节的数据主要来源 于 DBA_HIST_SQLSTAT.CLWAIT_DELTA Delta value of cluster wait time  
  1584.   
  1585. Cluster Wait Time :   该SQL语句累计执行过程中等待在集群等待上的时间,单位为秒, 你可以理解为 当一个SQL 执行过程中遇到了gc buffer busy、gc cr multi block request 之类的Cluster等待,则这些等待消耗的时间全部算在 Cluster Wait Time里。  
  1586.   
  1587. Executions :  该SQL在快照时间内累计执行的次数  
  1588.   
  1589. %Total:  该SQL所消耗的Cluster Wait time 占 总的Cluster Wait time的比率, 为(SQL cluster wait time / DB total cluster Wait Time)  
  1590.   
  1591. %Clu: 该SQL所消耗的Cluster Wait time 占该SQL 总的耗时的比率,为(SQL cluster wait time / SQL elapsed Time),该指标说明了该语句是否是集群等待敏感的  
  1592.   
  1593. % CPU   该SQL 所消耗的CPU 时间 占 该SQL消耗的时间里的比例, 即 (SQL CPU Time / SQL Elapsed Time) ,该指标说明了该语句是否是CPU敏感的  
  1594.   
  1595. %IO 该SQL 所消耗的I/O 时间 占 该SQL消耗的时间里的比例, 即(SQL I/O Time/SQL Elapsed Time) ,该指标说明了该语句是否是I/O敏感的  
  1596.   
  1597.    
  1598.   
  1599.    
  1600.   
  1601. 4 Instance Activity Stats    
  1602.   
  1603.    
  1604.   
  1605.    
  1606. Instance Activity Stats           DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  1607. -> Ordered by statistic name  
  1608.   
  1609. Statistic                                     Total     per Second     per Trans  
  1610. -------------------------------- ------------------ -------------- -------------  
  1611. Batched IO (bound) vector count             450,449          124.6           1.8  
  1612. Batched IO (full) vector count                5,485            1.5           0.0  
  1613. Batched IO (space) vector count               1,467            0.4           0.0  
  1614. Batched IO block miss count               4,119,070        1,139.7          16.7  
  1615. Batched IO buffer defrag count               39,710           11.0           0.2  
  1616. Batched IO double miss count                297,357           82.3           1.2  
  1617. Batched IO same unit count                1,710,492          473.3           7.0  
  1618. Batched IO single block count               329,521           91.2           1.3  
  1619. Batched IO slow jump count                   47,104           13.0           0.2  
  1620. Batched IO vector block count             2,069,852          572.7           8.4  
  1621. Batched IO vector read count                262,161           72.5           1.1  
  1622. Block Cleanout Optim referenced              37,574           10.4           0.2  
  1623. CCursor + sql area evicted                    1,457            0.4           0.0  
  1624. ...............  
  1625.   
  1626.    
  1627.   
  1628. Instance Activity Stats  的数据来自于 DBA_HIST_SYSSTAT,DBA_HIST_SYSSTAT来自于V$SYSSTAT。  
  1629.   
  1630. 这里每一个指标都代表一种数据库行为的活跃度,例如redo size 是指生成redo的量,sorts (disk) 是指磁盘排序的次数,table scans (direct read)  是指直接路径扫描表的次数。  
  1631.   
  1632. 虽然这些指标均只有Total、per Second每秒、 per Trans每事务 三个维度,但对诊断问题十分有用。  
  1633.   
  1634. 我们来举几个例子:  
  1635.   
  1636. 1、 例如当 Top Event 中存在direct path readTop 等待事件, 则需要分清楚是对普通堆表的direct read还是由于大量LOB读造成的direct path read, 这个问题可以借助 table scans (direct read)、table scans (long tables)、physical reads direct   、physical reads direct (lob) 、physical reads direct temporary几个指标来分析, 假设 physical reads direct   >> 远大于 physical reads direct (lob)+physical reads direct temporary , 且有较大的table scans (direct read)、table scans (long tables)  (注意这2个指标代表的是 扫描表的次数 不同于上面的phsical reads 的单位为 块数*次数), 则说明了是 大表扫描引起的direct path read。  
  1637.   
  1638.    
  1639.   
  1640.    
  1641.   
  1642.    
  1643.   
  1644. 2、 例如当 Top Event中存在enq Tx:index contention等待事件, 则需要分析root node splits   、branch node splits   、leaf node 90-10 splits   、leaf node splits 、failed probes on index block rec 几个指标,具体可以见文档《Oracle索引块分裂split信息汇总》  
  1645.   
  1646.    
  1647.   
  1648.    
  1649.   
  1650. 3、系统出现IO类型的等待事件为TOp Five 例如 db file sequential/scattered read ,我们需要通过AWR来获得系统IO吞吐量和IOPS:  
  1651.   
  1652. physical read bytes 主要是应用造成的物理读取(Total size in bytes of all disk reads by application activity (and not other instance activity) only.) 而physical read total bytes则包括了 rman备份恢复 和后台维护任务所涉及的物理读字节数,所以我们在研究IO负载时一般参考 physical read total bytes;以下4对指标均存在上述的关系  
  1653.   
  1654.    
  1655.   
  1656.    
  1657.   
  1658.   
  1659.   
  1660.   
  1661.   
  1662. physical read bytes physical read total bytes 物理读的吞吐量/秒   
  1663. physical read IO requests physical read total IO requests 物理读的IOPS   
  1664. physical write bytes physical write total bytes 物理写的吞吐量/秒   
  1665. physical write IO requests physical write total IO requests 物理写的IOPS   
  1666.   
  1667.    
  1668.   
  1669. 总的物理吞吐量/秒=physical read total bytes+physical write total bytes  
  1670.   
  1671. 总的物理IOPS= physical read total IO requests+ physical write total IO requests  
  1672.   
  1673.    
  1674.   
  1675. IO的主要指标 吞吐量、IOPS和延迟 均可以从AWR中获得了, IO延迟的信息可以从 User I/O的Wait Class Avg Wait time获得,也可以参考11g出现的IOStat by Function summary  
  1676.   
  1677.    
  1678.   
  1679.    
  1680.   
  1681. Instance Activity Stats有大量的指标,但是对于这些指标的介绍 没有那一份文档有完整详尽的描述,即便在Oracle原厂内部要没有(或者是Maclean没找到),实际是开发人员要引入某一个Activity Stats是比较容易的,并不像申请引入一个新后台进程那样麻烦,Oracle对于新版本中新后台进程的引入有严格的要求,但Activity Stats却很容易,往往一个one-off patch中就可以引入了,实际上Activity Stats在源代码层仅仅是一些计数器。’  
  1682.   
  1683. 较为基础的statistics,大家可以参考官方文档的Statistics Descriptions描述,地址在这里。  
  1684.   
  1685.    
  1686.   
  1687. 对于深入的指标 例如  “Batched IO (space) vector count”这种由于某些新特性被引入的,一般没有很详细的材料,需要到源代码中去阅读相关模块才能总结其用途,对于这个工作一般原厂是很延迟去完成的,所以没有一个完整的列表。 如果大家有对此的疑问,请去t.askmaclean.com 发一个帖子提问。  
  1688.   
  1689.    
  1690.   
  1691.    
  1692. Instance Activity Stats - Absolute Values  Snaps: 7071  
  1693. -> Statistics with absolute values (should not be diffed)  
  1694.   
  1695. Statistic                            Begin Value       End Value  
  1696. -------------------------------- --------------- ---------------  
  1697. session pga memory max           1.157882826E+12 1.154290304E+12  
  1698. session cursor cache count           157,042,373     157,083,136  
  1699. session uga memory               5.496429019E+14 5.496775467E+14  
  1700. opened cursors current                   268,916         265,694  
  1701. workarea memory allocated                827,704         837,487  
  1702. logons current                             2,609           2,613  
  1703. session uga memory max           1.749481584E+13 1.749737418E+13  
  1704. session pga memory               4.150306913E+11 4.150008177E+11  
  1705.   
  1706.    
  1707.   
  1708.    
  1709.   
  1710.    
  1711.   
  1712.    
  1713.   
  1714. Instance Activity Stats – Absolute Values是显示快照 起点 和终点的一些指标的绝对值  
  1715. ◾logon current 当前时间点的登录数  
  1716. ◾opened cursors current 当前打开的游标数  
  1717. ◾session cursor cache count 当前存在的session缓存游标数  
  1718.   
  1719.    
  1720.   
  1721.    
  1722.   
  1723.    
  1724.   
  1725.    
  1726. Instance Activity Stats - Thread ActivityDB/Inst: G10R25/G10R25  Snaps: 3663-3  
  1727. -> Statistics identified by '(derived)' come from sources other than SYSSTAT   
  1728.   
  1729. Statistic                                     Total  per Hour    
  1730. -------------------------------- ------------------ ---------    
  1731. log switches (derived)                           17  2,326.47  
  1732.   
  1733.    
  1734.   
  1735.    
  1736.   
  1737. log switches (derived) 日志切换次数 , 见 《理想的在线重做日志切换时间是多长?》  
  1738.   
  1739.    
  1740.   
  1741.    
  1742.   
  1743. 5 IO 统计  
  1744.   
  1745.    
  1746.   
  1747. 5-1 Tablespace IO Stats  基于表空间分组的IO信息  
  1748.   
  1749.    
  1750.   
  1751.    
  1752.   
  1753.    
  1754. Tablespace IO Stats               DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  1755. -> ordered by IOs (Reads + Writes) desc  
  1756.   
  1757. Tablespace  
  1758. ------------------------------  
  1759.                  Av       Av     Av                       Av     Buffer  Av Buf  
  1760.          Reads Reads/s  Rd(ms) Blks/Rd       Writes Writes/s      Waits  Wt(ms)  
  1761. -------------- ------- ------- ------- ------------ -------- ---------- -------  
  1762. DATA_TS  
  1763.     17,349,398   4,801     2.3     1.5      141,077       39  4,083,704     5.8  
  1764. INDEX_TS  
  1765.      9,193,122   2,544     2.0     1.0      238,563       66  3,158,187    46.1  
  1766. UNDOTBS1  
  1767.      1,582,659     438     0.7     1.0            2        0     12,431    69.0  
  1768.   
  1769.    
  1770.   
  1771. reads : 指 该表空间上发生的物理读的次数(单位不是块,而是次数)  
  1772.   
  1773. Av Reads/s : 指该表空间上平均每秒的物理读次数 (单位不是块,而是次数)  
  1774.   
  1775. Av Rd(ms): 指该表空间上每次读的平均读取延迟  
  1776.   
  1777.    
  1778.   
  1779. Av Blks/Rd: 指该表空间上平均每次读取的块数目,因为一次物理读可以读多个数据块;如果Av Blks/Rd>>1 则可能系统有较多db file scattered read 可能是诊断FULL TABLE SCAN或FAST FULL INDEX SCAN,需要关注table scans (long tables) 和index fast full scans (full)   2个指标  
  1780.   
  1781.    
  1782.   
  1783. Writes : 该表空间上发生的物理写的次数 ;  对于那些Writes总是等于0的表空间 不妨了解下是否数据为只读,如果是可以通过read only tablespace来解决 RAC中的一些性能问题。  
  1784.   
  1785. Av Writes/s  : 指该表空间上平均每秒的物理写次数  
  1786.   
  1787. buffer Waits:  该表空间上发生buffer busy waits和read by other session的次数( 9i中buffer busy waits包含了read by other session)。  
  1788.   
  1789. Av Buf Wt(ms):  该表空间上发生buffer Waits的平均等待时间,单位为ms  
  1790.   
  1791.    
  1792.   
  1793.    
  1794.   
  1795.    
  1796.   
  1797.  5-2 File I/O  
  1798.   
  1799.    
  1800.   
  1801.    
  1802. File IO Stats                    Snaps: 70719-70723  
  1803. -> ordered by Tablespace, File  
  1804.   
  1805. Tablespace               Filename  
  1806. ------------------------ ----------------------------------------------------  
  1807.                  Av       Av     Av                       Av     Buffer  Av Buf  
  1808.          Reads Reads/s  Rd(ms) Blks/Rd       Writes Writes/s      Waits  Wt(ms)  
  1809. -------------- ------- ------- ------- ------------ -------- ---------- -------  
  1810. AMG_ALBUM_IDX_TS         +DATA/itscmp/plugged/data2/amg_album_idx_ts01.dbf  
  1811.         23,298       6     0.6     1.0            2        0          0     0.0  
  1812. AMG_ALBUM_IDX_TS         +DATA/itscmp/plugged/data3/amg_album_idx_ts02.dbf  
  1813.          3,003       1     0.6     1.0            2        0          0     0.0  
  1814.   
  1815.    
  1816.   
  1817. Tablespace 表空间名  
  1818.   
  1819. FileName  数据文件的路径  
  1820.   
  1821. Reads: 该数据文件上累计发生过的物理读次数,不是块数  
  1822.   
  1823. Av Reads/s: 该数据文件上平均每秒发生过的物理读次数,不是块数  
  1824.   
  1825. Av Rd(ms): 该数据文件上平均每次物理读取的延迟,单位为ms  
  1826.   
  1827. Av Blks/Rd:  该数据文件上平均每次读取涉及到的块数,OLTP环境该值接近 1  
  1828.   
  1829. Writes : 该数据文件上累计发生过的物理写次数,不是块数  
  1830.   
  1831. Av Writes/s: 该数据文件上平均每秒发生过的物理写次数,不是块数  
  1832.   
  1833. buffer Waits:  该数据文件上发生buffer busy waits和read by other session的次数( 9i中buffer busy waits包含了read by other session)。  
  1834.   
  1835. Av Buf Wt(ms):  该数据文件上发生buffer Waits的平均等待时间,单位为ms  
  1836.   
  1837.    
  1838.   
  1839. 若某个表空间上有较高的IO负载,则有必要分析一下 是否其所属的数据文件上的IO 较为均匀 还是存在倾斜, 是否需要结合存储特征来 将数据均衡分布到不同磁盘上的数据文件上,以优化 I/O  
  1840.   
  1841.    
  1842.   
  1843.    
  1844.   
  1845.    
  1846.   
  1847. 6 缓冲池统计 Buffer Pool Statistics  
  1848.   
  1849.    
  1850.   
  1851.    
  1852.   
  1853.    
  1854. Buffer Pool Statistics              Snaps: 70719-70723  
  1855. -> Standard block size Pools  D: default,  K: keep,  R: recycle  
  1856. -> Default Pools for other block sizes: 2k, 4k, 8k, 16k, 32k  
  1857.   
  1858.                                                             Free   Writ   Buffer  
  1859.      Number of Pool       Buffer     Physical    Physical   Buff   Comp     Busy  
  1860. P      Buffers Hit%         Gets        Reads      Writes   Wait   Wait    Waits  
  1861. --- ---------- ---- ------------ ------------ ----------- ------ ------ --------  
  1862. 16k     15,720  N/A            0            0           0      0      0        0  
  1863. D    2,259,159   98 2.005084E+09   42,753,650     560,460      0      1 8.51E+06  
  1864.   
  1865.    
  1866.   
  1867. 该环节的数据主要来源于WRH$_BUFFER_POOL_STATISTICS, 而WRH$_BUFFER_POOL_STATISTICS是定期汇总v$SYSSTAT中的数据  
  1868.   
  1869.    
  1870.   
  1871. P   pool池的名字   D: 默认的缓冲池 default buffer pool  , K : Keep Pool , R: Recycle Pool ;  2k 4k 8k  16k 32k: 代表各种非标准块大小的缓冲池  
  1872.   
  1873. Number of buffers:  实际的 缓冲块数目,   约等于  池的大小 / 池的块大小  
  1874.   
  1875. Pool Hit % :  该缓冲池的命中率  
  1876.   
  1877. Buffer Gets: 对该缓冲池的中块的访问次数 包括  consistent gets 和 db block gets  
  1878.   
  1879. Physical Reads: 该缓冲池Buffer Cache引起了多少物理读, 其实是physical reads cache ,单位为 块数*次数  
  1880.   
  1881. Physical Writes :该缓冲池中Buffer cache被写的物理写, 其实是physical writes from cache, 单位为 块数*次数  
  1882.   
  1883. Free Buffer Waits:  等待空闲缓冲的次数, 可以看做该buffer pool 发生free buffer waits 等待的次数  
  1884.   
  1885. Write Comp Wait:   等待DBWR写入脏buffer到磁盘的次数, 可以看做该buffer pool发生write complete waits等待的次数  
  1886.   
  1887. Buffer Busy Waits:  该缓冲池发生buffer busy wait 等待的次数  
  1888.   
  1889.    
  1890.   
  1891.    
  1892.   
  1893. 7-1 Checkpoint Activity  检查点与 Instance Recovery Stats    实例恢复  
  1894.   
  1895.    
  1896.   
  1897.    
  1898. Checkpoint Activity         Snaps: 70719-70723  
  1899. -> Total Physical Writes:                      590,563  
  1900.   
  1901.                                           Other    Autotune      Thread  
  1902.        MTTR    Log Size    Log Ckpt    Settings        Ckpt        Ckpt  
  1903.      Writes      Writes      Writes      Writes      Writes      Writes  
  1904. ----------- ----------- ----------- ----------- ----------- -----------  
  1905.           0           0           0           0      12,899           0  
  1906.           -------------------------------------------------------------  
  1907.   
  1908. Instance Recovery Stats     Snaps: 70719-70723  
  1909. -> B: Begin Snapshot,  E: End Snapshot  
  1910.   
  1911.                                                                             Estd  
  1912.   Targt  Estd                                     Log Ckpt Log Ckpt    Opt   RAC  
  1913.   MTTR   MTTR Recovery  Actual   Target   Log Sz   Timeout Interval    Log Avail  
  1914.    (s)    (s) Estd IOs RedoBlks RedoBlks RedoBlks RedoBlks RedoBlks  Sz(M)  Time  
  1915. ----- ----- -------- -------- -------- -------- -------- -------- ------ -----  
  1916. B     0     6    12828   477505  1786971  5096034  1786971      N/A    N/A     3  
  1917. E     0     7    16990   586071  2314207  5096034  2314207      N/A    N/A     3  
  1918.           -------------------------------------------------------------  
  1919.   
  1920. 该环节的数据来源于WRH$_INSTANCE_RECOVERY  
  1921.   
  1922. MTTR  Writes  :   为了满足FAST_START_MTTR_TARGET 指定的MTTR值 而做出的物理写  WRITES_MTTR  
  1923.   
  1924. Log Size Writes :由于最小的redo log file而做出的物理写 WRITES_LOGFILE_SIZE  
  1925.   
  1926. Log Ckpt writes: 由于 LOG_CHECKPOINT_INTERVAL 和 LOG_CHECKPOINT_TIMEOUT 驱动的增量检查点而做出的物理写 WRITES_LOG_CHECKPOINT_SETTINGS  
  1927.   
  1928. Other Settings Writes :由于其他设置(例如FAST_START_IO_TARGET)而引起的物理写,  WRITES_OTHER_SETTINGS  
  1929.   
  1930. Autotune Ckpt Writes : 由于自动调优检查点而引起的物理写, WRITES_AUTOTUNE  
  1931.   
  1932. Thread Ckpt Writes :由于thread checkpoint而引起的物理写,WRITES_FULL_THREAD_CKPT  
  1933.  B 代表 开始点, E 代表结尾  
  1934.   
  1935. Targt MTTR (s) : 目标MTTR (mean time to recover)意为有效恢复时间,单位为秒。 TARGET_MTTR 的计算基于 给定的参数FAST_START_MTTR_TARGET,而TARGET_MTTR作为内部使用。 实际在使用中 Target MTTR未必能和FAST_START_MTTR_TARGET一样。 如果FAST_START_MTTR_TARGET过小,那么TARGET_MTTR 将是系统条件所允许的最小估算值;  如果FAST_START_MTTR_TARGET过大,则TARGET_MTTR以保守算法计算以获得完成恢复的最长估算时间。  
  1936.   
  1937.    
  1938.   
  1939. estimated_mttr (s):   当前基于 脏buffer和重做日志块的数量,而评估出的有效恢复时间 。 它的估算告诉用户 以当下系统的负载若发生实例crash,则需要多久时间来做crash recovery的前滚操作,之后才能打开数据库。  
  1940.   
  1941. Recovery Estd IOs :实际是当前buffer cache中的脏块数量,一旦实例崩溃 这些脏块要被前滚  
  1942.   
  1943. Actual RedoBlks :  当前实际需要恢复的redo重做块数量  
  1944.   
  1945. Target RedoBlks :是 Log Sz RedoBlks 、Log Ckpt  Timeout  RedoBlks、 Log Ckpt Interval  RedoBlks 三者的最小值  
  1946.   
  1947. Log Sz RedoBlks :   代表 必须在log file switch日志切换之前完成的 checkpoint 中涉及到的redo block,也叫max log lag; 数据来源select LOGFILESZ   from X$targetrba;  select LOG_FILE_SIZE_REDO_BLKS from v$instance_recovery;  
  1948.   
  1949. Log Ckpt Timeout RedoBlks : 为了满足LOG_CHECKPOINT_TIMEOUT  所需要处理的redo block数,lag for checkpoint timeout ; 数据来源select CT_LAG from x$targetrba;  
  1950.   
  1951. Log Ckpt Interval RedoBlks :为了满足LOG_CHECKPOINT_INTERVAL 所需要处理的redo block数, lag for checkpoint interval; 数据来源select CI_LAG from x$targetrba;  
  1952.   
  1953. Opt Log Sz(M) :  基于FAST_START_MTTR_TARGET 而估算出来的redo logfile 的大小,单位为MB 。 Oracle官方推荐创建的重做日志大小至少大于这个估算值  
  1954.   
  1955.    
  1956.   
  1957. Estd RAC Avail Time  :指评估的 RAC中节点失败后 集群从冻结到部分可用的时间, 这个指标仅在RAC中可用,单位为秒。 ESTD_CLUSTER_AVAILABLE_TIME  
  1958.   
  1959.    
  1960.   
  1961.    
  1962.   
  1963.    
  1964.   
  1965.  7-2 Buffer Pool Advisory 缓冲池建议  
  1966.   
  1967.    
  1968.   
  1969.    
  1970. Buffer Pool Advisory                      DB/Inst: ITSCMP/itscmp2  Snap: 70723  
  1971. -> Only rows with estimated physical reads >0 are displayed  
  1972. -> ordered by Block Size, Buffers For Estimate  
  1973.   
  1974.                                     Est  
  1975.                                    Phys      Estimated                  Est  
  1976.     Size for   Size      Buffers   Read     Phys Reads     Est Phys %DBtime  
  1977. P    Est (M) Factor  (thousands) Factor    (thousands)    Read Time for Rds  
  1978. --- -------- ------ ------------ ------ -------------- ------------ -------  
  1979. D      1,920     .1          227    4.9  1,110,565,597            1 1.0E+09  
  1980. D      3,840     .2          454    3.6    832,483,886            1 7.4E+08  
  1981. D      5,760     .3          680    2.8    634,092,578            1 5.6E+08  
  1982. D      7,680     .4          907    2.2    500,313,589            1 4.3E+08  
  1983. D      9,600     .5        1,134    1.8    410,179,557            1 3.5E+08  
  1984. D     11,520     .6        1,361    1.5    348,214,283            1 2.9E+08  
  1985. D     13,440     .7        1,588    1.3    304,658,441            1 2.5E+08  
  1986. D     15,360     .8        1,814    1.2    273,119,808            1 2.2E+08  
  1987. D     17,280     .9        2,041    1.1    249,352,943            1 2.0E+08  
  1988. D     19,200    1.0        2,268    1.0    230,687,206            1 1.8E+08  
  1989. D     19,456    1.0        2,298    1.0    228,664,269            1 1.8E+08  
  1990. D     21,120    1.1        2,495    0.9    215,507,858            1 1.7E+08  
  1991. D     23,040    1.2        2,722    0.9    202,816,787            1 1.6E+08  
  1992. D     24,960    1.3        2,948    0.8    191,974,196            1 1.5E+08  
  1993. D     26,880    1.4        3,175    0.8    182,542,765            1 1.4E+08  
  1994. D     28,800    1.5        3,402    0.8    174,209,199            1 1.3E+08  
  1995. D     30,720    1.6        3,629    0.7    166,751,631            1 1.2E+08  
  1996. D     32,640    1.7        3,856    0.7    160,002,420            1 1.2E+08  
  1997. D     34,560    1.8        4,082    0.7    153,827,351            1 1.1E+08  
  1998. D     36,480    1.9        4,309    0.6    148,103,338            1 1.1E+08  
  1999. D     38,400    2.0        4,536    0.6    142,699,866            1 1.0E+08  
  2000.   
  2001.    
  2002.   
  2003. 缓冲池的颗粒大小 可以参考 SELECT * FROM V$SGAINFO where name like(‘Granule%’);  
  2004. P 指 缓冲池的名字  可能包括 有 D default buffer pool , K  Keep Pool , R recycle Pool  
  2005.   
  2006. Size For Est(M):  指以该尺寸的buffer pool作为评估的对象,一般是 目前current size的 10% ~ 200%,以便了解 buffer pool 增大 ~减小 对物理读的影响  
  2007.   
  2008. Size Factor :  尺寸因子, 只 对应buffer pool 大小  对 当前设置的比例因子, 例如current_size是 100M , 则如果评估值是110M 那么 size Factor 就是 1.1  
  2009.   
  2010. Buffers (thousands) :指这个buffer pool 尺寸下的buffer 数量, 要乘以1000才是实际值  
  2011.   
  2012. Est  Phys Read Factor :评估的物理读因子, 例如当前尺寸的buffer pool 会引起100个物理读, 则别的尺寸的buffer pool如果引起 120个物理读, 那么 对应尺寸的Est  Phys Read Factor就是1.2  
  2013.   
  2014. Estimated Phys Reads (thousands):评估的物理读数目, 要乘以 1000才是实际值, 显然不同尺寸的buffer pool对应不同的评估的物理读数目  
  2015.   
  2016. Est Phys Read Time : 评估的物理读时间  
  2017.   
  2018. Est %DBtime for Rds:评估的物理读占DB TIME的比率  
  2019.   
  2020.    
  2021.   
  2022.    
  2023.   
  2024. 我们 看buffer pool advisory 一般有2个目的:  
  2025.   
  2026.    
  2027. 1.在物理读较多的情况下,希望通过增加buffer pool 大小来缓解物理读等待,这是我们关注Size Factor > 1的buffer pool尺寸是否能共有效减少Est Phys Read  Factor, 如果Est Phys Read  Factor随着Size Factor 增大 而显著减少,那么说明增大buffer cache 是可以有效减少物理读的。  
  2028. 2. 在内存紧张的情况下 ,希望从buffer pool中匀出部分内存来移作他用, 但是又不希望 buffer cache变小导致 物理读增多 性能下降, 则此时 观察Est Phys Read  Factor 是否随着Size Factor 减小而 显著增大, 如果不是 则说明减少部分buffer cache 不会导致 物理读大幅增加,也就可以安心 减少 buffer cache  
  2029.   
  2030.    
  2031.   
  2032. 注意 Size Factor 和 Est Phys Read  Factor之间不是简单的 线性关系,所以需要人为介入评估得失  
  2033.   
  2034.    
  2035.   
  2036.    
  2037.   
  2038.    
  2039.   
  2040.  7-3 PGA Aggr Summary  
  2041.   
  2042.    
  2043.   
  2044.    
  2045. PGA Aggr Summary                 Snaps: 70719-70723  
  2046. -> PGA cache hit % - percentage of W/A (WorkArea) data processed only in-memory  
  2047.   
  2048. PGA Cache Hit %   W/A MB Processed  Extra W/A MB Read/Written  
  2049. --------------- ------------------ --------------------------  
  2050.            99.9            412,527                        375  
  2051.   
  2052.    
  2053.   
  2054. PGA Cache Hit % : 指 W/A WorkArea工作区的数据仅在内存中处理的比率, PGA缓存命中率  
  2055.   
  2056. workarea是PGA中负责处理 排序、哈希连接和位图合并操作的区域; workarea 也叫做 SQL 作业区域  
  2057.   
  2058. W/A  MB processes:   指 在Workarea中处理过的数据的量,单位为MB  
  2059.   
  2060. Extra W/A MB Read/Written :  指额外从磁盘上 读写的 工作区数据, 单位为 MB  
  2061.   
  2062.    
  2063.   
  2064.    
  2065.   
  2066. 7-4 PGA Aggr Target Stats   
  2067.   
  2068.    
  2069.   
  2070.    
  2071. Warning:  pga_aggregate_target was set too low for current workload, as this  
  2072.           value was exceeded during this interval.  Use the PGA Advisory view  
  2073.           to help identify a different value for pga_aggregate_target.  
  2074. PGA Aggr Target Stats       Snaps: 70719-70723  
  2075. -> B: Begin Snap   E: End Snap (rows dentified with B or E contain data  
  2076.    which is absolute i.e. not diffed over the interval)  
  2077. -> Auto PGA Target - actual workarea memory target  
  2078. -> W/A PGA Used    - amount of memory used for all Workareas (manual + auto)  
  2079. -> %PGA W/A Mem    - percentage of PGA memory allocated to workareas  
  2080. -> %Auto W/A Mem   - percentage of workarea memory controlled by Auto Mem Mgmt  
  2081. -> %Man W/A Mem    - percentage of workarea memory under manual control  
  2082.   
  2083.                                                 %PGA  %Auto   %Man  
  2084.     PGA Aggr   Auto PGA   PGA Mem    W/A PGA     W/A    W/A    W/A Global Mem  
  2085.    Target(M)  Target(M)  Alloc(M)    Used(M)     Mem    Mem    Mem   Bound(K)  
  2086. ---------- ---------- ---------- ---------- ------ ------ ------ ----------  
  2087. B      8,192        512   23,690.5      150.1     .6  100.0     .0    838,860  
  2088. E      8,192        512   23,623.6      156.9     .7  100.0     .0    838,860  
  2089.           -------------------------------------------------------------  
  2090.   
  2091.    
  2092.   
  2093. 此环节的数据来源主要是 WRH$_PGASTAT  
  2094.   
  2095. PGA Aggr  Target(M) :本质上就是pga_aggregate_target , 当然在AMM(memory_target)环境下 这个值可能会自动变化  
  2096.   
  2097. Auto PGA Target(M)  : 在自动PGA 管理模式下 实际可用的工作区内存  “aggregate PGA auto target “, 因为PGA还有其他用途 ,不能全部作为workarea memory  
  2098.   
  2099. PGA Mem Alloc(M) :目前已分配的PGA内存,  alloc  不等于 inuse 即分配的内存不等于在使用的内存,理论上PGA会将确实不使用的内存返回给OS(PGA memory freed back to OS) ,但是存在PGA占用大量内存而不释放的场景  
  2100.   
  2101. 在上例中 pga_aggregate_target 仅为8192M ,而实际processes 在 2,615~ 8000之间,如果一个进程耗费5MB的PGA 也需要 10000M的PGA ,而实际这里 PGA Mem Alloc(M)是23,690 M ,这说明 存在PGA 的过载, 需要调整pga_aggregate_target  
  2102.   
  2103.    
  2104.   
  2105. W/A PGA Used(M) :所有的工作区workarea(包括manual和 auto)使用的内存总和量, 单位为MB  
  2106.   
  2107. %PGA W/A Mem:  分配给workarea的内存量占总的PGA的比例,  (W/A PGA Used)/PGA Mem Alloc  
  2108.   
  2109. %Auto W/A Mem : AUTO 自动工作区管理所控制的内存(workarea_size_policy=AUTO) 占总的workarea内存的比例  
  2110.   
  2111. %Man W/A Mem : MANUAL 手动工作区管理所控制的内存(workarea_size_policy=MANUAL)占总的workarea内存的比例  
  2112.   
  2113. Global Mem Bound(K) : 指 在自动PGA管理模式下一个工作区所能分配的最大内存(注意 一个SQL执行过程中可能有多个工作区workarea)。 Global Mem Bound(K)这个指标在实例运行过程中将被持续性的修正,以反应数据库当时工作区的负载情况。显然在有众多活跃工作区的系统负载下相应地Global Mem Bound将会下降。 但应当保持global bound值不要小于1 MB , 否则建议 调高pga_aggregate_target  
  2114.   
  2115.    
  2116.   
  2117.    
  2118.   
  2119.  7-5 PGA Aggr Target Histogram   
  2120.   
  2121.    
  2122.   
  2123.    
  2124. PGA Aggr Target Histogram           Snaps: 70719-70723  
  2125. -> Optimal Executions are purely in-memory operations  
  2126.   
  2127.   Low     High  
  2128. Optimal Optimal    Total Execs  Optimal Execs 1-Pass Execs M-Pass Execs  
  2129. ------- ------- -------------- -------------- ------------ ------------  
  2130.      2K      4K        262,086        262,086            0            0  
  2131.     64K    128K            497            497            0            0  
  2132.    128K    256K            862            862            0            0  
  2133.    256K    512K            368            368            0            0  
  2134.    512K   1024K        440,585        440,585            0            0  
  2135.      1M      2M         68,313         68,313            0            0  
  2136.      2M      4M            169            161            8            0  
  2137.      4M      8M             50             42            8            0  
  2138.      8M     16M             82             82            0            0  
  2139.     16M     32M              1              1            0            0  
  2140.     32M     64M             12             12            0            0  
  2141.    128M    256M              2              0            2            0  
  2142.           -------------------------------------------------------------  
  2143.   
  2144.    
  2145.   
  2146.    
  2147.   
  2148. 数据来源:WRH$_SQL_WORKAREA_HISTOGRAM  
  2149.   
  2150. Low Optimal: 此行所包含工作区workarea最适合内存要求的下限  
  2151.   
  2152. High Optimal: 此行所包含工作区workarea最适合内存要求的上限  
  2153.   
  2154. Total Execs: 在 Low Optimal~High Optimal 范围工作区内完成的总执行数  
  2155.   
  2156.    
  2157.   
  2158. Optimal execs: optimal 执行是指完全在PGA内存中完成的执行次数  
  2159.   
  2160. 1-pass Execs :  指操作过程中仅发生1次磁盘读取的执行次数  
  2161.   
  2162. M-pass Execs:  指操作过程中发生了1次以上的磁盘读取, 频发磁盘读取的执行次数  
  2163.   
  2164.    
  2165.   
  2166.    
  2167.   
  2168.    
  2169.   
  2170.    
  2171.   
  2172.  7-6 PGA Memory Advisory   
  2173.   
  2174.    
  2175. PGA Memory Advisory                  Snap: 70723  
  2176. -> When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value  
  2177.    where Estd PGA Overalloc Count is 0  
  2178.   
  2179.                                        Estd Extra    Estd P Estd PGA  
  2180. PGA Target    Size           W/A MB   W/A MB Read/    Cache Overallo    Estd  
  2181.   Est (MB)   Factr        Processed Written to Disk   Hit %    Count    Time  
  2182. ---------- ------- ---------------- ---------------- ------ -------- -------  
  2183.      1,024     0.1  2,671,356,938.7    387,531,258.9   87.0 1.07E+07 7.9E+11  
  2184.      2,048     0.3  2,671,356,938.7    387,529,979.1   87.0 1.07E+07 7.9E+11  
  2185.      4,096     0.5  2,671,356,938.7    387,518,881.8   87.0 1.07E+07 7.9E+11  
  2186.      6,144     0.8  2,671,356,938.7    387,420,749.5   87.0 1.07E+07 7.9E+11  
  2187.      8,192     1.0  2,671,356,938.7     23,056,196.5   99.0 1.07E+07 6.9E+11  
  2188.      9,830     1.2  2,671,356,938.7     22,755,192.6   99.0 6.81E+06 6.9E+11  
  2189.     11,469     1.4  2,671,356,938.7     20,609,438.5   99.0 4.15E+06 6.9E+11  
  2190.     13,107     1.6  2,671,356,938.7     19,021,139.1   99.0  581,362 6.9E+11  
  2191.     14,746     1.8  2,671,356,938.7     18,601,191.0   99.0  543,531 6.9E+11  
  2192.     16,384     2.0  2,671,356,938.7     18,561,361.1   99.0  509,687 6.9E+11  
  2193.     24,576     3.0  2,671,356,938.7     18,527,422.3   99.0  232,817 6.9E+11  
  2194.     32,768     4.0  2,671,356,938.7     18,511,872.6   99.0  120,180 6.9E+11  
  2195.     49,152     6.0  2,671,356,938.7     18,500,815.3   99.0    8,021 6.9E+11  
  2196.     65,536     8.0  2,671,356,938.7     18,498,733.0   99.0        0 6.9E+11  
  2197.   
  2198.    
  2199.   
  2200.    
  2201.   
  2202.    
  2203.   
  2204. PGA Target   Est (MB)  用以评估的 PGA_AGGREGATE _TARGET值  
  2205.   
  2206. Size Factr   , 当前用以评估的PGA_AGGREGATE _TARGET 和 当前实际设置的PGA_AGGREGATE _TARGET 之间的 比例因子  PGA Target Est / PGA_AGGREGATE_TARGE  
  2207.   
  2208. W/A MB Processed :workarea中要处理的数据量, 单位为MB  
  2209.   
  2210. Estd Extra  W/A MB Read/ Written to Disk :   以 one-pass 、M-Pass方式处理的数据量预估值, 单位为MB  
  2211.   
  2212. Estd P Cache Hit % :  预估的PGA缓存命中率  
  2213.   
  2214. Estd PGA Overalloc Count: 预估的PGA过载量, 如上文所述PGA_AGGREGATE _TARGET仅是一个目标值,无法真正限制PGA内存的使用,当出现 PGA内存硬性需求时会产生PGA overallocate 过载(When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value where Estd PGA Overalloc Count is 0)  
  2215.   
  2216.    
  2217.   
  2218.    
  2219.   
  2220.    
  2221.   
  2222. 7-7  Shared Pool Advisory  
  2223.   
  2224.    
  2225. Shared Pool Advisory                Snap: 70723  
  2226. -> SP: Shared Pool     Est LC: Estimated Library Cache   Factr: Factor  
  2227. -> Note there is often a 1:Many correlation between a single logical object  
  2228.    in the Library Cache, and the physical number of memory objects associated  
  2229.    with it.  Therefore comparing the number of Lib Cache objects (e.g. in  
  2230.    v$librarycache), with the number of Lib Cache Memory Objects is invalid.  
  2231.   
  2232.                                        Est LC Est LC  Est LC Est LC     
  2233.   Shared    SP   Est LC                  Time   Time    Load   Load       Est LC  
  2234.     Pool  Size     Size       Est LC    Saved  Saved    Time   Time      Mem Obj  
  2235.  Size(M) Factr      (M)      Mem Obj      (s)  Factr     (s)  Factr     Hits (K)  
  2236. -------- ----- -------- ------------ -------- ------ ------- ------ ------------  
  2237.      304    .8       56        3,987    7,728    1.0      61    1.4          332  
  2238.      352    .9      101        6,243    7,745    1.0      44    1.0          334  
  2239.      400   1.0      114        7,777    7,745    1.0      44    1.0          334  
  2240.      448   1.1      114        7,777    7,745    1.0      44    1.0          334  
  2241.      496   1.2      114        7,777    7,745    1.0      44    1.0          334  
  2242.      544   1.4      114        7,777    7,745    1.0      44    1.0          334  
  2243.      592   1.5      114        7,777    7,745    1.0      44    1.0          334  
  2244.      640   1.6      114        7,777    7,745    1.0      44    1.0          334  
  2245.      688   1.7      114        7,777    7,745    1.0      44    1.0          334  
  2246.      736   1.8      114        7,777    7,745    1.0      44    1.0          334  
  2247.      784   2.0      114        7,777    7,745    1.0      44    1.0          334  
  2248.      832   2.1      114        7,777    7,745    1.0      44    1.0          334  
  2249.           -------------------------------------------------------------  
  2250.   
  2251.    
  2252.   
  2253. Shared  Pool  Size(M) :  用以评估的shared pool共享池大小,在AMM /ASMM环境下 shared_pool 大小都可能浮动  
  2254.   
  2255. SP Size Factr :共享池大小的比例因子, (Shared Pool Size for Estim / SHARED_POOL_SIZE)  
  2256.   
  2257. Estd LC Size(M) : 评估的 library cache 大小 ,单位为MB , 因为是shared pool中包含 library cache 当然还有其他例如row cache  
  2258.   
  2259. Est LC Mem Obj   指评估的指定大小的共享池内的library cache memory object的数量  ESTD_LC_MEMORY_OBJECTS  
  2260.   
  2261. Est LC Time Saved(s):   指在 指定的共享池大小情况下可找到需要的library cache memory objects,从而节约的解析时间 。  这些节约的解析时间也是 花费在共享池内重复加载需要的对象(reload),这些对象可能因为共享池没有足够的free memory而被aged out.  ESTD_LC_TIME_SAVED  
  2262.   
  2263. Est LC Time Saved Factr : Est LC Time Saved(s)的比例因子,(  Est LC Time Saved(s)/ Current LC Time Saved(s) )   ESTD_LC_TIME_SAVED_FACTOR  
  2264.   
  2265. Est LC Load Time (s):  在指定的共享池大小情况下解析的耗时  
  2266.   
  2267. Est LC Load Time Factr:Est LC Load Time (s)的比例因子, (Est LC Load Time (s)/ Current LC Load Time (s))         ESTD_LC_LOAD_TIME_FACTOR  
  2268.   
  2269. Est LC  Mem Obj Hits (K) :  在指定的共享池大小情况下需要的library cache memory object正好在共享池中被找到的次数  ESTD_LC_MEMORY_OBJECT_HITS;  
  2270.   
  2271.    
  2272.   
  2273. 对于想缩小 shared_pool_size 共享池大小的需求,可以关注Est LC  Mem Obj Hits (K) ,如上例中共享池为352M时Est LC  Mem Obj Hits (K) 就为334且之后不动,则可以考虑缩小shared_pool_size到该值,但要注意每个版本/平台上对共享池的最低需求,包括RAC中gcs resource 、gcs shadow等资源均驻留在shared pool中,增大db_cache_size时要对应关注。  
  2274.   
  2275.    
  2276.   
  2277.    
  2278.   
  2279.    
  2280.   
  2281.  7-8 SGA Target Advisory   
  2282.   
  2283.    
  2284. SGA Target Advisory    Snap: 70723  
  2285.   
  2286. SGA Target   SGA Size       Est DB     Est Physical  
  2287.   Size (M)     Factor     Time (s)            Reads  
  2288. ---------- ---------- ------------ ----------------  
  2289.      3,752        0.1 1.697191E+09 1.4577142918E+12  
  2290.      7,504        0.3 1.222939E+09  832,293,601,354  
  2291.     11,256        0.4 1.000162E+09  538,390,923,784  
  2292.     15,008        0.5  895,087,191  399,888,743,900  
  2293.     18,760        0.6  840,062,594  327,287,716,803  
  2294.     22,512        0.8  806,389,685  282,881,041,331  
  2295.     26,264        0.9  782,971,706  251,988,446,808  
  2296.     30,016        1.0  765,293,424  228,664,652,276  
  2297.     33,768        1.1  751,135,535  210,005,616,650  
  2298.     37,520        1.3  739,350,016  194,387,820,900  
  2299.     41,272        1.4  733,533,785  187,299,216,679  
  2300.     45,024        1.5  732,921,550  187,299,216,679  
  2301.     48,776        1.6  732,691,962  187,299,216,679  
  2302.     52,528        1.8  732,538,908  187,299,216,679  
  2303.     56,280        1.9  732,538,917  187,299,216,679  
  2304.     60,032        2.0  732,462,391  187,299,458,716  
  2305.           -------------------------------------------------------------  
  2306.   
  2307.    
  2308.   
  2309. 该环节数据来源于WRH$_SGA_TARGET_ADVICE  
  2310.   
  2311. SGA target Size   : 用以评估的sga target大小 (sga_target)  
  2312.   
  2313. SGA Size Factor:  SGA Size的比例因子,  (est SGA target Size / Current SGA target Size )  
  2314.   
  2315. Est DB Time (s): 评估对应于该指定sga target size会产生多少量的DB TIME,单位为秒  
  2316.   
  2317. Est Physical Reads:评估对应该指定的sga target size 会产生多少的物理读  
  2318.   
  2319.    
  2320.   
  2321.    
  2322.   
  2323. 7-9 Streams Pool Advisory     
  2324.   
  2325.    
  2326. Streams Pool Advisory                     DB/Inst: ITSCMP/itscmp2  Snap: 70723  
  2327.   
  2328.   Size for      Size   Est Spill   Est Spill Est Unspill Est Unspill  
  2329.   Est (MB)    Factor       Count    Time (s)       Count    Time (s)  
  2330. ---------- --------- ----------- ----------- ----------- -----------  
  2331.         64       0.5           0           0           0           0  
  2332.        128       1.0           0           0           0           0  
  2333.        192       1.5           0           0           0           0  
  2334.        256       2.0           0           0           0           0  
  2335.        320       2.5           0           0           0           0  
  2336.        384       3.0           0           0           0           0  
  2337.        448       3.5           0           0           0           0  
  2338.        512       4.0           0           0           0           0  
  2339.        576       4.5           0           0           0           0  
  2340.        640       5.0           0           0           0           0  
  2341.        704       5.5           0           0           0           0  
  2342.        768       6.0           0           0           0           0  
  2343.        832       6.5           0           0           0           0  
  2344.        896       7.0           0           0           0           0  
  2345.        960       7.5           0           0           0           0  
  2346.      1,024       8.0           0           0           0           0  
  2347.      1,088       8.5           0           0           0           0  
  2348.      1,152       9.0           0           0           0           0  
  2349.      1,216       9.5           0           0           0           0  
  2350.      1,280      10.0           0           0           0           0  
  2351.   
  2352.    
  2353.   
  2354. 该环节只有当使用了Streams  流复制时才会有必要数据, 数据来源 WRH$_STREAMS_POOL_ADVICE  
  2355.   
  2356.    
  2357.   
  2358. Size for Est (MB) : 用以评估的 streams pool大小  
  2359.   
  2360. Size Factor :streams pool大小的比例因子  
  2361.   
  2362. Est Spill Count  :评估出的 当使用该大小的流池时 message溢出到磁盘的数量 ESTD_SPILL_COUNT  
  2363.   
  2364. Est Spill Time (s): 评估出的 当使用该大小的流池时 message溢出到磁盘的耗时,单位为秒 ESTD_SPILL_TIME  
  2365.   
  2366. Est Unspill Count:评估的 当使用该大小的流池时 message unspill 即从磁盘上读取的数量 ESTD_UNSPILL_COUNT  
  2367.   
  2368. Est Unspill Time (s) : 评估的 当使用该大小的流池时 message unspill 即从磁盘上读取的耗时,单位为秒 ESTD_UNSPILL_TIME  
  2369.   
  2370.    
  2371.   
  2372. 7-10 Java Pool Advisory   
  2373.   
  2374.    
  2375.   
  2376. java pool的相关指标与shared pool相似,不再鏖述  
  2377.   
  2378.    
  2379.   
  2380.    
  2381.   
  2382. 8 Wait Statistics  
  2383.   
  2384.    
  2385.   
  2386. 8-1 Buffer Wait Statistics    
  2387.   
  2388.    
  2389. Buffer Wait Statistics          Snaps: 70719-70723  
  2390. -> ordered by wait time desc, waits desc  
  2391.   
  2392. Class                    Waits Total Wait Time (s)  Avg Time (ms)  
  2393. ------------------ ----------- ------------------- --------------  
  2394. data block           8,442,041             407,259             48  
  2395. undo header             16,212               1,711            106  
  2396. undo block              21,023                 557             26  
  2397. 1st level bmb            1,038                 266            256  
  2398. 2nd level bmb              540                 185            342  
  2399. bitmap block                90                  25            276  
  2400. segment header             197                  13             66  
  2401. file header block          132                   6             43  
  2402. bitmap index block          18                   0              1  
  2403. extent map                   2                   0              0  
  2404.   
  2405. 数据来源 : WRH$_WAITSTAT  
  2406.   
  2407. 该环节是对 缓冲池中各类型(class) 块 等待的汇总信息, wait的原因一般是 buffer busy waits 和 read by other session  
  2408.   
  2409. class 数据块的class,  一个oracle数据块即有class 属性 还有type 属性,数据块中记录type属性(KCBH), 而在buffer header里存有class属性(X$BH.class)  
  2410.   
  2411. Waits: 该类型数据块的等待次数  
  2412.   
  2413. Total Wait Time  (s) : 该类型数据块的合计等待时间 单位为秒  
  2414.   
  2415. Avg Time (ms) : 该类型数据块 平均每次等待的耗时, 单位 ms  
  2416.   
  2417.    
  2418.   
  2419. 如果用户正使用 undo_management=AUTO 的SMU 则一般不会因为rollback segment过少而引起undo header block类块的等待  
  2420.   
  2421. 对于INSERT 而引起的 buffer争用等待:  
  2422.   
  2423. 1、 对于手动segment 管理MSSM 考虑增加Freelists、Freelist Groups  
  2424.   
  2425. 2、 使用ASSM ,当然ASSM本身没什么参数可调  
  2426.   
  2427.    
  2428.   
  2429.    
  2430.   
  2431.    
  2432.   
  2433. 对于INSERT ON INDEX 引起的争用:  
  2434.   
  2435.    
  2436. ◾使用反向索引key  
  2437. ◾使用HASH分区和本地索引  
  2438. ◾可能的情况下 减少index的density  
  2439.   
  2440.    
  2441.   
  2442.    
  2443.   
  2444. 8-2 Enqueue Activity    
  2445.   
  2446. enqueue 队列锁等待  
  2447.   
  2448.    
  2449. Enqueue Activity  Snaps: 70719-70723  
  2450. -> only enqueues with waits are shown  
  2451. -> Enqueue stats gathered prior to 10g should not be compared with 10g data  
  2452. -> ordered by Wait Time desc, Waits desc  
  2453.   
  2454. Enqueue Type (Request Reason)  
  2455. ------------------------------------------------------------------------------  
  2456.     Requests    Succ Gets Failed Gets       Waits  Wt Time (s) Av Wt Time(ms)  
  2457. ------------ ------------ ----------- ----------- ------------ --------------  
  2458. TX-Transaction (index contention)  
  2459.      201,270      201,326           0     193,948       97,517         502.80  
  2460. TM-DML  
  2461.      702,731      702,681           4       1,081       46,671      43,174.08  
  2462. SQ-Sequence Cache  
  2463.       28,643       28,632           0      17,418       35,606       2,044.19  
  2464. HW-Segment High Water Mark  
  2465.        9,210        8,845         376       1,216       12,505      10,283.85  
  2466. TX-Transaction (row lock contention)  
  2467.        9,288        9,280           0       9,232       10,486       1,135.80  
  2468. CF-Controlfile Transaction  
  2469.       15,851       14,094       1,756       2,798        4,565       1,631.64  
  2470. TX-Transaction (allocate ITL entry)  
  2471.          471          369         102         360          169         469.28  
  2472.   
  2473.    
  2474.   
  2475. Enqueue Type (Request Reason) enqueue 队列的类型,大家在研究 enqueue 问题前 至少搞清楚enqueue type 和enqueue mode , enqueue type是队列锁所要保护的资源 如 TM 表锁  CF 控制文件锁, enqueue mode 是持有队列锁的模式 (SS、SX 、S、SSX、X)  
  2476.   
  2477.    
  2478.   
  2479. Requests : 申请对应的enqueue type资源或者队列转换(enqueue conversion   例如 S 转 SSX ) 的次数  
  2480.   
  2481. Succ Gets :对应的enqueue被成功 申请或转换的次数  
  2482.   
  2483. Failed Gets :对应的enqueue的申请 或者转换失败的次数  
  2484.   
  2485. Waits :由对应的enqueue的申请或者转换而造成等待的次数  
  2486.   
  2487. Wt Time (s) : 由对应的enqueue的申请或者转换而造成等待的等待时间  
  2488.   
  2489. Av Wt Time(ms) :由对应的enqueue的申请或者转换而造成等待的平均等待时间  , Wt Time (s) / Waits ,单位为ms  
  2490.   
  2491.    
  2492.   
  2493. 主要的enqueue 等待事件:  
  2494.   
  2495. enq: TX – row lock/index contention、allocate ITL等待事件  
  2496.   
  2497. enq: TM – contention等待事件  
  2498.   
  2499. Oracle队列锁enq:TS,Temporary Segment (also TableSpace)  
  2500.   
  2501.    
  2502.   
  2503.    
  2504.   
  2505.    
  2506.   
  2507. 9-1 Undo Segment Summary     
  2508.   
  2509.    
  2510.   
  2511.    
  2512. Undo Segment Summary            Snaps: 70719-70723  
  2513. -> Min/Max TR (mins) - Min and Max Tuned Retention (minutes)  
  2514. -> STO - Snapshot Too Old count,  OOS - Out of Space count  
  2515. -> Undo segment block stats:  
  2516. -> uS - unexpired Stolen,   uR - unexpired Released,   uU - unexpired reUsed  
  2517. -> eS - expired   Stolen,   eR - expired   Released,   eU - expired   reUsed  
  2518.   
  2519. Undo   Num Undo       Number of  Max Qry   Max Tx Min/Max   STO/     uS/uR/uU/  
  2520.  TS# Blocks (K)    Transactions  Len (s) Concurcy TR (mins) OOS      eS/eR/eU  
  2521. ---- ---------- --------------- -------- -------- --------- ----- --------------  
  2522.    4       85.0         200,127   55,448      317 1040.2/10 0/0   0/0/0/0/0/0  
  2523.           -------------------------------------------------------------  
  2524.   
  2525. Undo Segment Stats                 Snaps: 70719-70723  
  2526. -> Most recent 35 Undostat rows, ordered by Time desc  
  2527.   
  2528.                 Num Undo    Number of Max Qry  Max Tx Tun Ret STO/    uS/uR/uU/  
  2529. End Time          Blocks Transactions Len (s)   Concy  (mins) OOS     eS/eR/eU  
  2530. ------------ ----------- ------------ ------- ------- ------- ----- ------------  
  2531. 29-Aug 05:52      11,700       35,098  55,448     234   1,070 0/0   0/0/0/0/0/0  
  2532. 29-Aug 05:42      12,203       24,677  54,844     284   1,065 0/0   0/0/0/0/0/0  
  2533. 29-Aug 05:32      14,132       37,826  54,241     237   1,060 0/0   0/0/0/0/0/0  
  2534. 29-Aug 05:22      14,379       32,315  53,637     317   1,050 0/0   0/0/0/0/0/0  
  2535. 29-Aug 05:12      15,693       34,157  53,033     299   1,045 0/0   0/0/0/0/0/0  
  2536. 29-Aug 05:02      16,878       36,054  52,428     250   1,040 0/0   0/0/0/0/0/0  
  2537.   
  2538.    
  2539.   
  2540.    
  2541.   
  2542.    
  2543.   
  2544. 数据来源:  WRH$_UNDOSTAT   , undo相关的使用信息每10分钟刷新到v$undostat中  
  2545.   
  2546.    
  2547.   
  2548. Undo Extent有三种状态  active 、unexpired 、expired  
  2549.   
  2550. active => extent中 包括了活动的事务 ,active的undo extent 一般不允许被其他事务重用覆盖  
  2551.   
  2552. unexpired =&gt; extent中没有活动的事务,但相关undo 记录从inactive到目前还未经过undo retention(注意 auto undo retention的问题 因为这个特性 可能在观察dba_undo_extents时看到大部分block都是unexpired,这是正常的)  指定的时间,所以为unexpired。 对于没有guarantee retention的undo tablespace而言,unexpired extent可能被 steal 为其他事物重用  
  2553.   
  2554. expired => extent中没有活动事务,且超过了undo retention的时间  
  2555.   
  2556.    
  2557.   
  2558. Undo TS# 在使用的这个undo 表空间的表空间号, 一个实例 同一时间只能用1个undo tablespace , RAC不同节点可以用不同的undo tablespace  
  2559.   
  2560. Num Undo Blocks (K)  指被消费的 undo 数据块的数量, (K)代表要乘以1000才是实际值;  可以用该指标来评估系统对undo block的消费量, 以便基于实际负载情况来评估UNDO表空间的大小  
  2561.   
  2562. Number of Transactions  指该段时间内该undo表空间上执行过的事务transaction总量  
  2563.   
  2564. Max Qry Len (s)  该时段内  持续最久的查询 时间, 单位为秒  
  2565.   
  2566. Max Tx Concy  该时段内 最大的事务并发量  
  2567.   
  2568. Min/Max TR (mins)   最小和最大的tuned  undo retention ,单位为分钟; tuned undo retention 是自动undo调优特性,见undo自动调优介绍。  
  2569.   
  2570. STO/ OOS     STO 指 ORA-01555 Snapshot Too Old错误出现的次数;   OOS – 指Out of Space count 错误出现的次数  
  2571.   
  2572. uS – unexpired Stolen  尝试从未过期的undo extent中偷取undo space的次数  
  2573.   
  2574. uR – unexpired Released  从未过期的undo extent中释放的块数目  
  2575.   
  2576. uU – unexpired reUsed   未过期的undo extent中的block被其他事务重用的 块数目  
  2577.   
  2578. eS – expired   Stolen    尝试从过期的undo extent中偷取undo space的次数  
  2579.   
  2580. eR – expired   Released   从过期的undo extent中释放的块数目  
  2581.   
  2582. eU – expired   reUsed   过期的undo extent中的block被其他事务重用的 块数目  
  2583.   
  2584.    
  2585.   
  2586.    
  2587.   
  2588. UNXPSTEALCNT NUMBER Number of attempts to obtain undo space by stealing unexpired extents from other transactions   
  2589. UNXPBLKRELCNT NUMBER Number of unexpired blocks removed from certain undo segments so they can be used by other transactions   
  2590. UNXPBLKREUCNT NUMBER Number of unexpired undo blocks reused by transactions   
  2591. EXPSTEALCNT NUMBER Number of attempts to steal expired undo blocks from other undo segments   
  2592. EXPBLKRELCNT NUMBER Number of expired undo blocks stolen from other undo segments   
  2593. EXPBLKREUCNT NUMBER Number of expired undo blocks reused within the same undo segments   
  2594. SSOLDERRCNT NUMBER Identifies the number of times the error ORA-01555 occurred. You can use this statistic to decide whether or not the UNDO_RETENTION initialization parameter is set properly given the size of the undo tablespace. Increasing the value of UNDO_RETENTION can reduce the occurrence of this error.   
  2595.   
  2596.    
  2597.   
  2598.    
  2599.   
  2600.  10-1 Latch Activity  
  2601.   
  2602.    
  2603.   
  2604.    
  2605. Latch Activity        Snaps: 70719-70723  
  2606. -> "Get Requests""Pct Get Miss" and "Avg Slps/Miss" are statistics for  
  2607.    willing-to-wait latch get requests  
  2608. -> "NoWait Requests""Pct NoWait Miss" are for no-wait latch get requests  
  2609. -> "Pct Misses" for both should be very close to 0.0  
  2610.   
  2611.                                            Pct    Avg   Wait                 Pct  
  2612.                                     Get    Get   Slps   Time       NoWait NoWait  
  2613. Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss  
  2614. ------------------------ -------------- ------ ------ ------ ------------ ------  
  2615. AQ deq hash table latch               4    0.0             0            0    N/A  
  2616. ASM Keyed state latch             9,048    0.1    0.2      0            0    N/A  
  2617. ASM allocation                   15,017    0.2    0.8      1            0    N/A  
  2618. ASM db client latch              72,745    0.0             0            0    N/A  
  2619. ASM map headers                   5,860    0.6    0.6      1            0    N/A  
  2620. ASM map load waiting lis          1,462    0.0             0            0    N/A  
  2621. ASM map operation freeli         63,539    0.1    0.4      1            0    N/A  
  2622. ASM map operation hash t     76,484,447    0.1    1.0     66            0    N/A  
  2623.   
  2624.    
  2625.   
  2626. latch name Latch闩的名字  
  2627.   
  2628. Get Requests      latch被以willing-to-wait模式申请并获得的次数  
  2629.   
  2630. Pct Get Miss   miss是指latch被以willing-to-wait 模式申请但是申请者必须等待的次数,  Pct Get Miss = Miss/Get Requests  ; miss可以从后面的Latch Sleep Breakdown 获得  
  2631.   
  2632. Avg Slps /Miss    Sleep 是指latch被以willing-to-wait模式申请最终导致session需要sleep以等待该latch的次数  ;   Avg Slps /Miss = Sleeps/ Misses ; Sleeps可以从后面的Latch Sleep Breakdown 获得  
  2633.   
  2634. Wait Time (s)  指花费在等待latch上的时间,单位为秒  
  2635.   
  2636.    
  2637.   
  2638. NoWait Requests  指latch被以no-wait模式来申请的次数  
  2639.   
  2640. Pct NoWait Miss   以no-wait模式来申请latch但直接失败的次数  
  2641.   
  2642. 对于高并发的latch例如cache buffers chains,其Pct Misses应当十分接近于0  
  2643.   
  2644. 一般的调优原则:  
  2645.   
  2646. 如果latch : cache buffers chains是 Top 5 事件,则需要考虑优化SQL减少 全表扫描 并减少Top buffer gets SQL语句的逻辑读  
  2647.   
  2648. 如果latch : redo copy 、redo allocation 等待较多,则可以考虑增大LOG_BUFFER  
  2649.   
  2650. 如果latch:library cache 发生较多,则考虑增大shared_pool_size  
  2651.   
  2652.    
  2653.   
  2654.    
  2655.   
  2656. 10-2 Latch Sleep Breakdown   
  2657.   
  2658.    
  2659.   
  2660.    
  2661. Latch Sleep Breakdown             DB/Inst: ITSCMP/itscmp2  Snaps: 70719-70723  
  2662. -> ordered by misses desc  
  2663.   
  2664.                                        Get                                 Spin  
  2665. Latch Name                        Requests       Misses      Sleeps        Gets  
  2666. -------------------------- --------------- ------------ ----------- -----------  
  2667. cache buffers chains         3,365,097,866   12,831,875     130,058  12,683,450  
  2668. row cache objects               69,050,058      349,839       1,320     348,649  
  2669. session idle bit               389,437,460      268,285       2,768     265,752  
  2670. enqueue hash chains              8,698,453      239,880      22,476     219,950  
  2671. ges resource hash list           8,388,730      158,894      70,728      91,104  
  2672. gc element                     100,383,385      135,759       6,285     129,742  
  2673. gcs remastering latch           12,213,169       72,373           1      72,371  
  2674. enqueues                         4,662,545       46,374         259      46,155  
  2675. ASM map operation hash tab      76,484,447       46,231      45,210       1,952  
  2676. Lsod array latch                    72,598       24,224      24,577       1,519  
  2677.   
  2678.    
  2679.   
  2680.    
  2681.   
  2682.    
  2683.   
  2684. latch name Latch闩的名字  
  2685.   
  2686. Get Requests      latch被以willing-to-wait模式申请并获得的次数  
  2687.   
  2688. misses 是指latch被以willing-to-wait 模式申请但是申请者必须等待的次数  
  2689.   
  2690. 9i以后miss之后一般有2种情况 spin gets了 或者sleep一睡不醒直到 被post,具体见全面解析9i以后Oracle Latch闩锁原理;  
  2691.   
  2692. 8i以前的latch算法可以参考:Oracle Latch:一段描绘Latch运作的伪代码  
  2693.   
  2694. 所以一般来说9i以后的 misses= Sleeps+ Spin Gets ,虽然不是绝对如此  
  2695.   
  2696. Sleeps 是指latch被以willing-to-wait模式申请最终导致session需要sleep以等待该latch的次数  
  2697.   
  2698. Spin Gets  以willing-to-wait模式去申请latch,在miss之后以spin方式获得了latch的次数  
  2699.   
  2700.    
  2701.   
  2702.    
  2703.   
  2704.    
  2705.   
  2706. 10-3 Latch Miss Sources  
  2707.   
  2708.    
  2709.   
  2710.    
  2711. Latch Miss Sources           Snaps: 70719-70723  
  2712. -> only latches with sleeps are shown  
  2713. -> ordered by name, sleeps desc  
  2714.   
  2715.                                                      NoWait              Waiter  
  2716. Latch Name               Where                       Misses     Sleeps   Sleeps  
  2717. ------------------------ -------------------------- ------- ---------- --------  
  2718. ASM Keyed state latch    kfksolGet                        0          1        1  
  2719. ASM allocation           kfgpnSetDisks2                   0         17        0  
  2720. ASM allocation           kfgpnClearDisks                  0          5        0  
  2721. ASM allocation           kfgscCreate                      0          4        0  
  2722. ASM allocation           kfgrpGetByName                   0          1       26  
  2723. ASM map headers          kffmUnidentify_3                 0          7        8  
  2724. ASM map headers          kffmAllocate                     0          6        0  
  2725. ASM map headers          kffmIdentify                     0          6       11  
  2726. ASM map headers          kffmFree                         0          1        0  
  2727. ASM map operation freeli kffmTranslate2                   0         15        8  
  2728. ASM map operation hash t kffmUnidentify                   0     44,677   36,784  
  2729. ASM map operation hash t kffmTranslate                    0        220    3,517  
  2730.   
  2731.    
  2732.   
  2733. 数据来源为DBA_HIST_LATCH_MISSES_SUMMARY  
  2734.   
  2735.    
  2736.   
  2737. latch name Latch闩的名字  
  2738. where  : 指哪些代码路径内核函数持有过这些该latch ,而不是哪些代码路径要申请这些latch;  例如kcbgtcr函数的作用是Get a block for Consistent read,其持有latch :cache buffers chain是很正常的事情  
  2739.   
  2740. NoWait Misses: 以no-wait模式来申请latch但直接失败的次数  
  2741.   
  2742. Sleeps:  指latch被以willing-to-wait模式申请最终导致session需要sleep以等待该latch的次数  time of sleeps resulted in making the latch request  
  2743.   
  2744. Waiter Sleeps:等待者休眠的次数  times of sleeps that waiters did for each where;   Sleep 是阻塞者等待的次数 , Waiter Sleeps是被阻塞者等待的次数  
  2745.   
  2746.    
  2747.   
  2748.    
  2749.   
  2750. 10-4 Mutex Sleep Summary   
  2751.   
  2752.    
  2753. Mutex Sleep Summary       Snaps: 70719-70723  
  2754. -> ordered by number of sleeps desc  
  2755.   
  2756.                                                                          Wait  
  2757. Mutex Type            Location                               Sleeps    Time (ms)  
  2758. --------------------- -------------------------------- ------------ ------------  
  2759. Cursor Pin            kksfbc [KKSCHLFSP2]                     4,364       14,520  
  2760. Cursor Pin            kkslce [KKSCHLPIN2]                     2,396        2,498  
  2761. Library Cache         kglpndl1  95                              903          475  
  2762. Library Cache         kglpin1   4                               800          458  
  2763. Library Cache         kglpnal2  91                              799          259  
  2764. Library Cache         kglget1   1                               553        1,697  
  2765. Library Cache         kglpnal1  90                              489           88  
  2766. Library Cache         kgllkdl1  85                              481        1,528  
  2767. Cursor Pin            kksLockDelete [KKSCHLPIN6]                410          666  
  2768. Cursor Stat           kkocsStoreBindAwareStats [KKSSTA          346          497  
  2769. Library Cache         kglhdgn2 106                              167          348  
  2770. Library Cache         kglhdgh1  64                               26           84  
  2771. Library Cache         kgldtin1  42                               19           55  
  2772. Cursor Pin            kksfbc [KKSCHLPIN1]                        13           34  
  2773. Library Cache         kglhdgn1  62                               11           13  
  2774. Library Cache         kgllkal1  80                                9           12  
  2775. Library Cache         kgllkc1   57                                6            0  
  2776. Cursor Pin            kksSetBindType [KKSCHLPIN3]                 5            5  
  2777. Library Cache         kglGetHandleReference 124                   4           20  
  2778. Library Cache         kglUpgradeLock 119                          4            0  
  2779. Library Cache         kglget2   2                                 3            0  
  2780. Library Cache         kglati1   45                                1            0  
  2781. Library Cache         kglini1   32                                1            0  
  2782. Library Cache         kglobld1  75                                1            0  
  2783. Library Cache         kglobpn1  71                                1            0  
  2784.   
  2785.    
  2786.   
  2787.    
  2788.   
  2789. Mutex是10.2.0.2以后引入的新的内存锁机制,具体对Mutex的描述见 《深入理解Oracle中的Mutex》:http://www.askmaclean.com/archives/understanding-oracle-mutex.html  
  2790.   
  2791. Mutex Type  
  2792.   
  2793. Mutex的类型其实就是 mutex对应的客户的名字,  在版本10.2中基本只有KKS使用Mutex,所以仅有3种:  
  2794. Cursor Stat (kgx_kks1)  
  2795. Cursor Parent (kgx_kks2)  
  2796. Cursor Pin (kgx_kks3)  
  2797.   
  2798. 11g中增加了Library Cache  
  2799.   
  2800.    
  2801.   
  2802. Location  发起对该Mutex申请的代码路径code location,而不是还持有该Mutex的代码路径或曰内核函数  
  2803.   
  2804. 10.2中最常见的下面的几个函数  
  2805.   
  2806. kkspsc0  -负责解析游标 – 检测我们正在解析的游标是否有对象的parent cursor heap 0存在  
  2807.   
  2808. kksfbc           –  负责找到合适的子游标 或者创建一个新的子游标  
  2809.   
  2810. kksFindCursorstat  
  2811.   
  2812.    
  2813.   
  2814. Sleeps:  
  2815.   
  2816. Mutex的Get和Sleep  
  2817.   
  2818. 当一个Mutex被申请时, 一般称为一个get request。 若初始的申请未能得到授权, 则该进程会因为此次申请而进入到255次SPIN中(_mutex_spin_count Mutex spin count),每次SPIN循环迭代过程中该进程都会去看看Mutex被释放了吗。  
  2819.   
  2820. 若该Mutex在SPIN之后仍未被释放,则该进程针对申请的mutex进入对应的mutex wait等待事件中。 实际进程的等待事件和等待方式由mutex的类型锁决定,例如 Cursor pin、Cursor Parent。  举例来说,这种等待可能是阻塞等待,也可以是sleep。  
  2821.   
  2822. 但是请注意在V$MUTEX_SLEEP_*视图上的sleep列意味着等待的次数。相关代码函数在开始进入等待时自加这个sleep字段。  
  2823.   
  2824. 等待计时从进程进入等待前开始计算等待时间, 当一个进程结束其等待,则等待的时间加入都总和total中。  该进程再次尝试申请之前的Mutex,若该Mutex仍不可用,则它再次进入spin/wait的循环。  
  2825.   
  2826.    
  2827.   
  2828. V$MUTEX_SLEEP_HISTORY视图的GETS列仅在成功申请到一个Mutex时才增加。  
  2829.   
  2830.    
  2831.   
  2832. Wait  Time (ms) 类似于latch,spin time 不算做mutex的消耗时间,它只包含等待消耗的时间。  
  2833.   
  2834.    
  2835.   
  2836. =====================================================================  
  2837.  11  segment statistics 段级统计  
  2838.   
  2839.    
  2840.   
  2841. 11-1 Segments by Logical Reads   
  2842.   
  2843.    
  2844.   
  2845.    
  2846. Segments by Logical Reads         DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  2847. -> Total Logical Reads:   2,021,476,421  
  2848. -> Captured Segments account for   83.7% of Total  
  2849.   
  2850.            Tablespace                      Subobject  Obj.       Logical  
  2851. Owner         Name    Object Name            Name     Type         Reads  %Total  
  2852. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  2853. CONTENT_OW INDEX_TS   MZ_PRODUCT_ATTRIBUTE            INDEX  372,849,920   18.44  
  2854. CONTENT_OW INDEX_TS   MZ_PRODUCT__LS_PK               INDEX  329,829,632   16.32  
  2855. CONTENT_OW DATA_TS    MZ_PRODUCT_ATTRIBUTE            TABLE  218,419,008   10.80  
  2856. CONTENT_OW PLAYLIST_A MZ_PLAYLIST_ARTIST              TABLE  182,426,240    9.02  
  2857. CONTENT_OW DATA_TS    MZ_PRODUCT                      TABLE  108,597,376    5.37  
  2858.   
  2859. owner : 数据段的所有者  
  2860.   
  2861. Tablespace Name: 数据段所在表空间名  
  2862.   
  2863. Object Name : 对象名  
  2864.   
  2865. Subobject Name:子对象名,例如一个分区表的某个分区  
  2866.   
  2867. obj Type:  对象类型 一般为TABLE /INDEX  或者分区或子分区  
  2868.   
  2869. Logical Reads :该数据段上发生过的逻辑读 , 单位为 块数*次数  
  2870.   
  2871. %Total : 占总的逻辑读的百分比 ,   (当前对象上发生过的逻辑读/ Total DB 逻辑读)  
  2872.   
  2873.    
  2874.   
  2875.    
  2876.   
  2877. 11-2 Segments by Physical Reads   
  2878.   
  2879.    
  2880.   
  2881.    
  2882. Segments by Physical Reads         DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  2883. -> Total Physical Reads:      56,839,035  
  2884. -> Captured Segments account for   51.9% of Total  
  2885.   
  2886.            Tablespace                      Subobject  Obj.      Physical  
  2887. Owner         Name    Object Name            Name     Type         Reads  %Total  
  2888. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  2889. CONTENT_OW SONG_TS    MZ_SONG                         TABLE    7,311,928   12.86  
  2890. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE    4,896,554    8.61  
  2891. CONTENT_OW DATA_TS    MZ_CONTENT_PROVIDER_            TABLE    3,099,387    5.45  
  2892. CONTENT_OW DATA_TS    MZ_PRODUCT_ATTRIBUTE            TABLE    1,529,971    2.69  
  2893. CONTENT_OW DATA_TS    MZ_PUBLICATION                  TABLE    1,391,735    2.45  
  2894.   
  2895.    
  2896.   
  2897. Physical Reads: 该数据段上发生过的物理读 , 单位为 块数*次数  
  2898.   
  2899. %Total : 占总的物理读的百分比 ,   (当前对象上发生过的逻辑读/ Total DB 逻辑读)  
  2900.   
  2901.    
  2902.   
  2903.    
  2904.   
  2905. 11-3  Segments by Physical Read Requests  
  2906.   
  2907.    
  2908.   
  2909.    
  2910. Segments by Physical Read Requests DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  2911. -> Total Physical Read Requests:      33,936,360  
  2912. -> Captured Segments account for   45.5% of Total  
  2913.   
  2914.            Tablespace                      Subobject  Obj.     Phys Read  
  2915. Owner         Name    Object Name            Name     Type      Requests  %Total  
  2916. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  2917. CONTENT_OW DATA_TS    MZ_CONTENT_PROVIDER_            TABLE    3,099,346    9.13  
  2918. CONTENT_OW DATA_TS    MZ_PRODUCT_ATTRIBUTE            TABLE    1,529,950    4.51  
  2919. CONTENT_OW DATA_TS    MZ_PRODUCT                      TABLE    1,306,756    3.85  
  2920. CONTENT_OW DATA_TS    MZ_AUDIO_FILE                   TABLE      910,537    2.68  
  2921. CONTENT_OW INDEX_TS   MZ_PRODUCT_ATTRIBUTE            INDEX      820,459    2.42  
  2922.   
  2923.    
  2924.   
  2925.    
  2926.   
  2927. Phys Read Requests : 物理读的申请次数  
  2928.   
  2929. %Total  : (该段上发生的物理读的申请次数/ physical read IO requests)  
  2930.   
  2931.    
  2932.   
  2933.    
  2934.   
  2935. 11-4  Segments by UnOptimized Reads  
  2936.   
  2937.    
  2938.   
  2939.    
  2940. Segments by UnOptimized Reads      DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  2941. -> Total UnOptimized Read Requests:         811,466  
  2942. -> Captured Segments account for   58.5% of Total  
  2943.   
  2944.            Tablespace                      Subobject  Obj.   UnOptimized  
  2945. Owner         Name    Object Name            Name     Type         Reads  %Total  
  2946. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  2947. CONTENT_OW DATA_TS    MZ_CONTENT_PROVIDER_            TABLE      103,580   12.76  
  2948. CONTENT_OW SONG_TS    MZ_SONG                         TABLE       56,946    7.02  
  2949. CONTENT_OW DATA_TS    MZ_IMAGE                        TABLE       47,017    5.79  
  2950. CONTENT_OW DATA_TS    MZ_PRODUCT_ATTRIBUTE            TABLE       40,950    5.05  
  2951. CONTENT_OW DATA_TS    MZ_PRODUCT                      TABLE       30,406    3.75  
  2952.   
  2953.    
  2954.   
  2955. UnOptimized Reads UnOptimized Read Reqs = Physical Read Reqts – Optimized Read Reqs  
  2956.   
  2957.    
  2958.   
  2959. Optimized Read Requests是指 哪些满足Exadata Smart Flash Cache ( or the Smart Flash Cache in OracleExadata V2 (Note that despite same name, concept and use of  
  2960. ‘Smart Flash Cache’ in Exadata V2 is different from ‘Smart Flash Cache’ in Database Smart Flash Cache)).的物理读 次数 。  满足从smart flash cache走的读取申请呗认为是optimized ,因为这些读取要比普通从磁盘走快得多。  
  2961.   
  2962. 此外通过smart scan 读取storage index的情况也被认为是’optimized read requests’ ,源于可以避免读取不相关的数据。  
  2963.   
  2964. 当用户不在使用Exadata时,则UnOptimized Read Reqs总是等于 Physical Read Reqts  
  2965.   
  2966. %Total : (该段上发生的物理读的UnOptimized Read Reqs / ( physical read IO requests – physical read requests optimized   ))  
  2967. 11-5 Segments by Optimized Reads   
  2968.   
  2969.    
  2970.   
  2971.    
  2972.   
  2973.    
  2974. Segments by Optimized Reads        DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  2975. -> Total Optimized Read Requests:      33,124,894  
  2976. -> Captured Segments account for   45.2% of Total  
  2977.   
  2978.            Tablespace                      Subobject  Obj.     Optimized  
  2979. Owner         Name    Object Name            Name     Type         Reads  %Total  
  2980. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  2981. CONTENT_OW DATA_TS    MZ_CONTENT_PROVIDER_            TABLE    2,995,766    9.04  
  2982. CONTENT_OW DATA_TS    MZ_PRODUCT_ATTRIBUTE            TABLE    1,489,000    4.50  
  2983. CONTENT_OW DATA_TS    MZ_PRODUCT                      TABLE    1,276,350    3.85  
  2984. CONTENT_OW DATA_TS    MZ_AUDIO_FILE                   TABLE      890,775    2.69  
  2985. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3               INDEX      816,067    2.46  
  2986.   
  2987.    
  2988.   
  2989. 关于optimizerd read 上面已经解释过了,这里的单位是 request 次数  
  2990.   
  2991. %Total :  (该段上发生的物理读的 Optimized Read Reqs/ physical read requests optimized )  
  2992.   
  2993.    
  2994.   
  2995.    
  2996.   
  2997.    
  2998.   
  2999. 11-6 Segments by Direct Physical Reads  
  3000.   
  3001.    
  3002. Segments by Direct Physical Reads  DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3003. -> Total Direct Physical Reads:      14,118,552  
  3004. -> Captured Segments account for   94.2% of Total  
  3005.   
  3006.            Tablespace                      Subobject  Obj.        Direct  
  3007. Owner         Name    Object Name            Name     Type         Reads  %Total  
  3008. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3009. CONTENT_OW SONG_TS    MZ_SONG                         TABLE    7,084,416   50.18  
  3010. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE    4,839,984   34.28  
  3011. CONTENT_OW DATA_TS    MZ_PUBLICATION                  TABLE    1,361,133    9.64  
  3012. CONTENT_OW DATA_TS    SYS_LOB0000203660C00            LOB          5,904     .04  
  3013. CONTENT_OW DATA_TS    SYS_LOB0000203733C00            LOB          1,656     .01  
  3014.   
  3015.    
  3016.   
  3017.    
  3018.   
  3019. Direct reads 直接路径物理读,单位为 块数*次数  
  3020. %Total  (该段上发生的direct path reads /Total  physical reads direct )  
  3021.   
  3022.    
  3023.   
  3024.    
  3025.   
  3026. 11-7  Segments by Physical Writes   
  3027. Segments by Physical Writes        DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3028. -> Total Physical Writes:         590,563  
  3029. -> Captured Segments account for   38.3% of Total  
  3030.   
  3031.            Tablespace                      Subobject  Obj.      Physical  
  3032. Owner         Name    Object Name            Name     Type        Writes  %Total  
  3033. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3034. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE       23,595    4.00  
  3035. CONTENT_OW DATA_TS    MZ_PODCAST                      TABLE       19,834    3.36  
  3036. CONTENT_OW INDEX_TS   MZ_IMAGE_IX2                    INDEX       16,345    2.77  
  3037. SYS        SYSAUX     WRH$_ACTIVE_SESSION_ 1367_70520 TABLE       14,173    2.40  
  3038. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3               INDEX        9,645    1.63  
  3039.   
  3040. Physical Writes ,物理写 单位为 块数*次数  
  3041.   
  3042. Total % (该段上发生的物理写 /Total physical writes )  
  3043.   
  3044.    
  3045.   
  3046.    
  3047.   
  3048.    
  3049.   
  3050. 11-9 Segments by Physical Write Requests  
  3051.   
  3052.    
  3053. Segments by Physical Write Requests   DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3054. -> Total Physical Write Requestss:         436,789  
  3055. -> Captured Segments account for   43.1% of Total  
  3056.   
  3057.            Tablespace                      Subobject  Obj.    Phys Write  
  3058. Owner         Name    Object Name            Name     Type      Requests  %Total  
  3059. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3060. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE       22,581    5.17  
  3061. CONTENT_OW DATA_TS    MZ_PODCAST                      TABLE       19,797    4.53  
  3062. CONTENT_OW INDEX_TS   MZ_IMAGE_IX2                    INDEX       14,529    3.33  
  3063. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3               INDEX        9,434    2.16  
  3064. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE        8,618    1.97  
  3065.   
  3066.    
  3067.   
  3068. Phys Write Requests 物理写的请求次数 ,单位为次数  
  3069.   
  3070. %Total (该段上发生的物理写请求次数 /physical write IO requests )  
  3071.   
  3072.    
  3073.   
  3074.    
  3075.   
  3076. 11-10 Segments by Direct Physical Writes   
  3077.   
  3078.    
  3079.   
  3080.    
  3081. Segments by Direct Physical Writes DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3082. -> Total Direct Physical Writes:          29,660  
  3083. -> Captured Segments account for   18.3% of Total  
  3084.   
  3085.            Tablespace                      Subobject  Obj.        Direct  
  3086. Owner         Name    Object Name            Name     Type        Writes  %Total  
  3087. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3088. SYS        SYSAUX     WRH$_ACTIVE_SESSION_ 1367_70520 TABLE        4,601   15.51  
  3089. CONTENT_OW DATA_TS    SYS_LOB0000203733C00            LOB            620    2.09  
  3090. CONTENT_OW DATA_TS    SYS_LOB0000203660C00            LOB            134     .45  
  3091. CONTENT_OW DATA_TS    SYS_LOB0000203779C00            LOB             46     .16  
  3092. CONTENT_OW DATA_TS    SYS_LOB0000203796C00            LOB             41     .14  
  3093.   
  3094.    
  3095.   
  3096.    
  3097.   
  3098. Direct Writes 直接路径写, 单位额为块数*次数  
  3099. %Total 为(该段上发生的直接路径写 /physical writes direct )  
  3100.   
  3101.    
  3102.   
  3103.    
  3104.   
  3105.    
  3106.   
  3107. 11-11   Segments by Table Scans  
  3108.   
  3109.    
  3110.   
  3111.    
  3112. Segments by Table Scans            DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3113. -> Total Table Scans:          10,713  
  3114. -> Captured Segments account for    1.0% of Total  
  3115.   
  3116.            Tablespace                      Subobject  Obj.         Table  
  3117. Owner         Name    Object Name            Name     Type         Scans  %Total  
  3118. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3119. CONTENT_OW DATA_TS    MZ_PUBLICATION                  TABLE           92     .86  
  3120. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE           14     .13  
  3121. CONTENT_OW SONG_TS    MZ_SONG                         TABLE            3     .03  
  3122. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE            1     .01  
  3123.   
  3124.    
  3125.   
  3126.    
  3127.   
  3128. Table Scans 来源为dba_hist_seg_stat.table_scans_delta 不过这个指标并不十分精确  
  3129.   
  3130.    
  3131.   
  3132. 11-12 Segments by DB Blocks Changes  
  3133.   
  3134.    
  3135.   
  3136.    
  3137.   
  3138.    
  3139. Segments by DB Blocks Changes      DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3140. -> % of Capture shows % of DB Block Changes for each top segment compared  
  3141. -> with total DB Block Changes for all segments captured by the Snapshot  
  3142.   
  3143.            Tablespace                      Subobject  Obj.      DB Block    % of  
  3144. Owner         Name    Object Name            Name     Type       Changes Capture  
  3145. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3146. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX8               INDEX      347,856   10.21  
  3147. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3A              INDEX      269,504    7.91  
  3148. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_PK                INDEX      251,904    7.39  
  3149. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE      201,056    5.90  
  3150. CONTENT_OW INDEX_TS   MZ_PRODUCT_ATTRIBUTE            INDEX      199,888    5.86  
  3151.   
  3152. DB Block Changes ,单位为块数*次数  
  3153.   
  3154. %Total : (该段上发生block changes  /  db block changes )  
  3155.   
  3156.    
  3157.   
  3158.    
  3159.   
  3160.    
  3161.   
  3162. 11-13  Segments by Row Lock Waits   
  3163.   
  3164.    
  3165.   
  3166.    
  3167. Segments by Row Lock Waits        DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3168. -> % of Capture shows % of row lock waits for each top segment compared  
  3169. -> with total row lock waits for all segments captured by the Snapshot  
  3170.   
  3171.                                                                      Row  
  3172.            Tablespace                      Subobject  Obj.          Lock    % of  
  3173. Owner         Name    Object Name            Name     Type         Waits Capture  
  3174. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3175. CONTENT_OW LOB_8K_TS  MZ_ASSET_WORK_EVENT_            INDEX       72,005   43.86  
  3176. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_NOTE_RE_I _2013_1_36 INDEX       13,795    8.40  
  3177. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_INFO_PART _2013_5_35 INDEX       12,383    7.54  
  3178. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3A              INDEX        8,937    5.44  
  3179. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE        8,531    5.20  
  3180.   
  3181.    
  3182.   
  3183.    
  3184.   
  3185. Row  Lock Waits 是指行锁的等待次数   数据来源于 dba_hist_seg_stat.ROW_LOCK_WAITS_DELTA  
  3186.   
  3187.    
  3188.   
  3189.    
  3190.   
  3191. 11-14   Segments by ITL WAITS  
  3192.   
  3193.    
  3194. Segments by ITL Waits              DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3195. -> % of Capture shows % of ITL waits for each top segment compared  
  3196. -> with total ITL waits for all segments captured by the Snapshot  
  3197.   
  3198.            Tablespace                      Subobject  Obj.           ITL    % of  
  3199. Owner         Name    Object Name            Name     Type         Waits Capture  
  3200. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3201. CONTENT_OW LOB_8K_TS  MZ_ASSET_WORK_EVENT_            INDEX           95   30.16  
  3202. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_NOTE_RE_I _2013_1_36 INDEX           48   15.24  
  3203. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_INFO_PART _2013_5_35 INDEX           21    6.67  
  3204. CONTENT_OW INDEX_TS   MZ_SALABLE_FIRST_AVA            INDEX           21    6.67  
  3205. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE           20    6.35  
  3206.   
  3207.    
  3208.   
  3209. 关于 ITL的介绍详见: http://www.askmaclean.com/archives/enqueue-tx-row-lock-index-itl-wait-event.html  
  3210.   
  3211. ITL Waits 等待 ITL 的次数,数据来源为 dba_hist_seg_stat.itl_waits_delta  
  3212.   
  3213.    
  3214.   
  3215.    
  3216.   
  3217. 11-14   Segments by Buffer Busy Waits  
  3218.   
  3219.    
  3220. Segments by Buffer Busy Waits      DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3221. -> % of Capture shows % of Buffer Busy Waits for each top segment compared  
  3222. -> with total Buffer Busy Waits for all segments captured by the Snapshot  
  3223.   
  3224.                                                                   Buffer  
  3225.            Tablespace                      Subobject  Obj.          Busy    % of  
  3226. Owner         Name    Object Name            Name     Type         Waits Capture  
  3227. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3228. CONTENT_OW LOB_8K_TS  MZ_ASSET_WORK_EVENT_            INDEX      251,073   57.07  
  3229. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_NOTE_RE_I _2013_1_36 INDEX       36,186    8.23  
  3230. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_INFO_PART _2013_5_35 INDEX       31,786    7.23  
  3231. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3A              INDEX       15,663    3.56  
  3232. CONTENT_OW INDEX_TS   MZ_CS_WORK_PENDING_R            INDEX       11,087    2.52  
  3233.   
  3234.    
  3235.   
  3236. Buffer Busy Waits  该数据段上发生 buffer busy wait的次数   数据来源 dba_hist_seg_stat.buffer_busy_waits_delta  
  3237.   
  3238.    
  3239.   
  3240.    
  3241.   
  3242.    
  3243.   
  3244. 11-15   Segments by Global Cache Buffer  
  3245.   
  3246.    
  3247.   
  3248.    
  3249. Segments by Global Cache Buffer BusyDB/Inst: MAC/MAC2  Snaps: 70719-7072  
  3250. -> % of Capture shows % of GC Buffer Busy for each top segment compared  
  3251. -> with GC Buffer Busy for all segments captured by the Snapshot  
  3252.   
  3253.                                                                       GC  
  3254.            Tablespace                      Subobject  Obj.        Buffer    % of  
  3255. Owner         Name    Object Name            Name     Type          Busy Capture  
  3256. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3257. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3               INDEX    2,135,528   50.07  
  3258. CONTENT_OW DATA_TS    MZ_CONTENT_PROVIDER_            TABLE      652,900   15.31  
  3259. CONTENT_OW LOB_8K_TS  MZ_ASSET_WORK_EVENT_            INDEX      552,161   12.95  
  3260. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_NOTE_RE_I _2013_1_36 INDEX      113,042    2.65  
  3261. CONTENT_OW LOB_8K_TS  MZ_CS_WORK_INFO_PART _2013_5_35 INDEX       98,134    2.30  
  3262.   
  3263.    
  3264.   
  3265.    
  3266.   
  3267. GC Buffer Busy 数据段上发挥僧gc buffer busy的次数, 数据源 dba_hist_seg_stat.gc_buffer_busy_delta  
  3268.   
  3269.    
  3270.   
  3271.    
  3272.   
  3273. 11-15   Segments by CR Blocks Received  
  3274.   
  3275.   
  3276.    
  3277.   
  3278.    
  3279. Segments by CR Blocks Received    DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3280. -> Total CR Blocks Received:         763,037  
  3281. -> Captured Segments account for   40.9% of Total  
  3282.   
  3283.                                                                    CR  
  3284.            Tablespace                      Subobject  Obj.       Blocks  
  3285. Owner         Name    Object Name            Name     Type      Received  %Total  
  3286. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3287. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE       69,100    9.06  
  3288. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE       44,491    5.83  
  3289. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3A              INDEX       36,830    4.83  
  3290. CONTENT_OW DATA_TS    MZ_PODCAST                      TABLE       36,632    4.80  
  3291. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_PK                INDEX       19,646    2.57  
  3292.   
  3293.    
  3294.   
  3295.    
  3296.   
  3297. CR  Blocks Received :是指RAC中本地节点接收到global cache CR blocks 的数量; 数据来源为  dba_hist_seg_stat.gc_cu_blocks_received_delta  
  3298.   
  3299. %Total :   (该段上在本节点接收的Global CR blocks  / gc cr blocks received )  
  3300.   
  3301.    
  3302.   
  3303.    
  3304.   
  3305.    
  3306.   
  3307.    
  3308.   
  3309. 11-16     Segments by Current Blocks Received  
  3310.   
  3311.    
  3312.   
  3313.    
  3314.   
  3315.    
  3316. Segments by Current Blocks ReceivedDB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3317. -> Total Current Blocks Received:         704,731  
  3318. -> Captured Segments account for   61.8% of Total  
  3319.   
  3320.                                                                  Current  
  3321.            Tablespace                      Subobject  Obj.       Blocks  
  3322. Owner         Name    Object Name            Name     Type      Received  %Total  
  3323. ---------- ---------- -------------------- ---------- ----- ------------ -------  
  3324. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3               INDEX       56,287    7.99  
  3325. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX3A              INDEX       45,139    6.41  
  3326. CONTENT_OW DATA_TS    MZ_AM_REQUEST                   TABLE       40,350    5.73  
  3327. CONTENT_OW DATA_TS    MZ_CS_WORK_PENDING_R            TABLE       22,808    3.24  
  3328. CONTENT_OW INDEX_TS   MZ_AM_REQUEST_IX8               INDEX       13,343    1.89  
  3329.   
  3330.    
  3331.   
  3332.    
  3333.   
  3334. Current  Blocks Received :是指RAC中本地节点接收到global cache Current blocks 的数量 ,数据来源DBA_HIST_SEG_STAT.gc_cu_blocks_received_delta  
  3335.   
  3336. %Total :   (该段上在本节点接收的 global cache current blocks / gc current blocks received)  
  3337.   
  3338.    
  3339.   
  3340.    
  3341.   
  3342.    
  3343.   
  3344. 12 Dictionary Cache Stats    
  3345.   
  3346.    
  3347. Dictionary Cache Stats            DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3348. -> "Pct Misses"  should be very low (< 2% in most cases) -> "Final Usage" is the number of cache entries being used  
  3349.   
  3350.                                    Get    Pct    Scan   Pct      Mod      Final  
  3351. Cache                         Requests   Miss    Reqs  Miss     Reqs      Usage  
  3352. ------------------------- ------------ ------ ------- ----- -------- ----------  
  3353. dc_awr_control                      87    2.3       0   N/A        6          1  
  3354. dc_global_oids                   1,134    7.8       0   N/A        0         13  
  3355. dc_histogram_data            6,119,027    0.9       0   N/A        0     11,784  
  3356. dc_histogram_defs            1,898,714    2.3       0   N/A        0      5,462  
  3357. dc_object_grants                   175   26.9       0   N/A        0          4  
  3358. dc_objects                  10,254,514    0.2       0   N/A        0      3,807  
  3359. dc_profiles                      8,452    0.0       0   N/A        0          2  
  3360. dc_rollback_segments         3,031,044    0.0       0   N/A        0      1,947  
  3361. dc_segments                  1,812,243    1.4       0   N/A       10      3,595  
  3362. dc_sequences                    15,783   69.6       0   N/A   15,782         20  
  3363. dc_table_scns                       70    2.9       0   N/A        0          1  
  3364. dc_tablespaces               1,628,112    0.0       0   N/A        0         37  
  3365. dc_users                     2,037,138    0.0       0   N/A        0         52  
  3366. global database name             7,698    0.0       0   N/A        0          1  
  3367. outstanding_alerts                 264   99.6       0   N/A        8          1  
  3368. sch_lj_oids                         51    7.8       0   N/A        0          1  
  3369.   
  3370.    
  3371.   
  3372.    
  3373.   
  3374. Dictionary Cache 字典缓存也叫row cache  
  3375.   
  3376. 数据来源为dba_hist_rowcache_summary  
  3377.   
  3378.    
  3379.   
  3380. Cache  字典缓存类名kqrstcid <=> kqrsttxt  cid=3(dc_rollback_segments)  
  3381.   
  3382. Get Requests  申请获取该数据字典缓存对象的次数     gets  
  3383.   
  3384. Miss : GETMISSES 申请获取该数据字典缓存对象但 miss的次数  
  3385.   
  3386. Pct Miss   : GETMISSES /Gets , Miss的比例 ,这个pct miss应当非常低 小于2%,否则有出现大量row cache lock的可能  
  3387.   
  3388. Scan Reqs:扫描申请的次数 ,kqrssc 、kqrpScan 、kqrpsiv时发生scan 会导致扫描数增加 kqrstsrq++(scan requests) ,例如migrate tablespace 时调用 kttm2b函数 为了安全删除uet$中的记录会callback kqrpsiv (used extent cache),实际很少见  
  3389.   
  3390.    
  3391.   
  3392. Pct Miss:SCANMISSES/SCANS  
  3393.   
  3394. Mod Reqs:  申请修改字典缓存对象的次数,从上面的数据可以看到dc_sequences的mod reqs很高,这是因为sequence是变化较多的字典对象  
  3395.   
  3396. Final Usage  :包含有有效数据的字典缓存记录的总数   也就是正在被使用的row cache记录 USAGE  Number of cache entries that contain valid data  
  3397.   
  3398.    
  3399.   
  3400.    
  3401. Dictionary Cache Stats (RAC)       DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3402.   
  3403.                                    GES          GES          GES  
  3404. Cache                         Requests    Conflicts     Releases  
  3405. ------------------------- ------------ ------------ ------------  
  3406. dc_awr_control                      14            2            0  
  3407. dc_global_oids                      88            0          102  
  3408. dc_histogram_defs               43,518            0       43,521  
  3409. dc_objects                      21,608           17       21,176  
  3410. dc_profiles                          1            0            1  
  3411. dc_segments                     24,974           14       24,428  
  3412. dc_sequences                    25,178       10,644          347  
  3413. dc_table_scns                        2            0            2  
  3414. dc_tablespaces                     165            0          166  
  3415. dc_users                           119            0          119  
  3416. outstanding_alerts                 478            8          250  
  3417. sch_lj_oids                          4            0            4  
  3418.   
  3419.    
  3420.   
  3421.    
  3422.   
  3423.    
  3424.   
  3425. GES Request kqrstilr  total instance lock requests ,通过全局队列服务GES 来申请instance lock的次数  
  3426.   
  3427. GES request 申请的原因可能是 dump cache object、kqrbfr LCK进程要background free some parent objects释放一些parent objects 等  
  3428.   
  3429.    
  3430.   
  3431. GES Conflicts kqrstifr instance lock forced-releases     , LCK进程以AST方式 释放锁的次数 ,仅出现在kqrbrl中  
  3432.   
  3433. GES Releases  kqrstisr  instance lock self-releases ,LCK进程要background free some parent objects释放一些parent objects 时可能自增  
  3434.   
  3435.    
  3436.   
  3437. 上述数据中可以看到仅有dc_sequences  对应的GES Conflicts较多, 对于sequence  使用ordered和non-cache选项会导致RAC中的一个边际效应,即”row cache lock”等待源于DC_SEQUENCES ROW CACHE。 DC_SEQUENCES 上的GETS request、modifications 、GES requests和GES conflict 与引发生成一个新的 sequence number的特定SQL执行频率相关。  
  3438.   
  3439. 在Oracle 10g中,ORDERED Sequence还可能在高并发下造成大量DFS lock Handle 等待,由于bug 5209859  
  3440.   
  3441.    
  3442.   
  3443.    
  3444.   
  3445.    
  3446.   
  3447. 13   Library Cache Activity   
  3448.   
  3449.    
  3450. Library Cache Activity             DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3451. -> "Pct Misses"  should be very low  
  3452.   
  3453.                          Get    Pct            Pin    Pct             Invali-  
  3454. Namespace           Requests   Miss       Requests   Miss    Reloads  dations  
  3455. --------------- ------------ ------ -------------- ------ ---------- --------  
  3456. ACCOUNT_STATUS         8,436    0.3              0    N/A          0        0  
  3457. BODY                   8,697    0.7         15,537    0.7         49        0  
  3458. CLUSTER                  317    4.7            321    4.7          0        0  
  3459. DBLINK                 9,212    0.1              0    N/A          0        0  
  3460. EDITION                4,431    0.0          8,660    0.0          0        0  
  3461. HINTSET OBJECT         1,027    9.5          1,027   14.4          0        0  
  3462. INDEX                    792   18.2            792   18.2          0        0  
  3463. QUEUE                     10    0.0          1,733    0.0          0        0  
  3464. RULESET                    0    N/A              8   87.5          7        0  
  3465. SCHEMA                 8,169    0.0              0    N/A          0        0  
  3466. SQL AREA             533,409    4.8 -4,246,727,944  101.1     44,864      576  
  3467. SQL AREA BUILD        71,500   65.5              0    N/A          0        0  
  3468. SQL AREA STATS        41,008   90.3         41,008   90.3          1        0  
  3469. TABLE/PROCEDURE      320,310    0.6      1,033,991    3.6     25,378        0  
  3470. TRIGGER                  847    0.0         38,442    0.3        110        0  
  3471.   
  3472.    
  3473.   
  3474. NameSpace   library cache 的命名空间  
  3475.   
  3476. GETS  Requests  该命名空间所包含对象的library cache lock被申请的次数  
  3477.   
  3478. GETHITS  对象的 library cache handle 正好在内存中被找到的次数  
  3479.   
  3480. Pct Misses : ( 1-  ( GETHITS /GETS  Requests)) *100  
  3481.   
  3482. Pin Requests   该命名空间所包含对象上pin被申请的次数  
  3483.   
  3484. PINHITS           要pin的对象的heap metadata正好在shared pool中的次数  
  3485.   
  3486. Pct Miss   ( 1-  ( PINHITS  /Pin Requests)) *100  
  3487.   
  3488. Reloads  指从object handle 被重建开始不是第一次PIN该对象的PIN ,且该次PIN要求对象从磁盘上读取加载的次数 ;Reloads值较高的情况 建议增大shared_pool_size  
  3489.   
  3490. INVALIDATIONS   由于以来对象被修改导致该命名空间所包含对象被标记为无效的次数  
  3491.   
  3492.    
  3493.   
  3494.    
  3495. Library Cache Activity (RAC)       DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3496.   
  3497.                     GES Lock      GES Pin      GES Pin   GES Inval GES Invali-  
  3498. Namespace           Requests     Requests     Releases    Requests     dations  
  3499. --------------- ------------ ------------ ------------ ----------- -----------  
  3500. ACCOUNT_STATUS         8,436            0            0           0           0  
  3501. BODY                       0       15,497       15,497           0           0  
  3502. CLUSTER                  321          321          321           0           0  
  3503. DBLINK                 9,212            0            0           0           0  
  3504. EDITION                4,431        4,431        4,431           0           0  
  3505. HINTSET OBJECT         1,027        1,027        1,027           0           0  
  3506. INDEX                    792          792          792           0           0  
  3507. QUEUE                      8        1,733        1,733           0           0  
  3508. RULESET                    0            8            8           0           0  
  3509. SCHEMA                 4,226            0            0           0           0  
  3510. TABLE/PROCEDURE      373,163      704,816      704,816           0           0  
  3511. TRIGGER                    0       38,430       38,430           0           0  
  3512.   
  3513.    
  3514.   
  3515. GES Lock Request: dlm_lock_requests   Lock instance-lock ReQuests      申请获得lock instance lock的次数  
  3516.   
  3517. GES PIN request : DLM_PIN_REQUESTS Pin instance-lock ReQuests   申请获得pin instance lock的次数  
  3518.   
  3519. GES Pin Releases DLM_PIN_RELEASES release the pin instance lock     释放pin instance lock的次数  
  3520.   
  3521. GES Inval Requests    DLM_INVALIDATION_REQUESTS  get the invalidation instance lock   申请获得invalidation instance lock的次数  
  3522.   
  3523. GES Invali- dations    DLM_INVALIDATIONS    接收到其他节点的invalidation pings次数  
  3524.   
  3525.    
  3526.   
  3527.    
  3528.   
  3529.    
  3530.   
  3531.  14 Process Memory Summary   
  3532.   
  3533.    
  3534.   
  3535.    
  3536. Process Memory Summary            DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3537. -> B: Begin Snap   E: End Snap  
  3538. -> All rows below contain absolute values (i.e. not diffed over the interval)  
  3539. -> Max Alloc is Maximum PGA Allocation size at snapshot time  
  3540. -> Hist Max Alloc is the Historical Max Allocation for still-connected processes  
  3541. -> ordered by Begin/End snapshot, Alloc (MB) desc  
  3542.   
  3543.                                                             Hist  
  3544.                                     Avg  Std Dev     Max     Max  
  3545.                Alloc      Used    Alloc    Alloc   Alloc   Alloc    Num    Num  
  3546.   Category      (MB)      (MB)     (MB)     (MB)    (MB)    (MB)   Proc  Alloc  
  3547. -------- --------- --------- -------- -------- ------- ------- ------ ------  
  3548. B Other     16,062.7       N/A      6.1     66.6   3,370   3,370  2,612  2,612  
  3549.   SQL        5,412.2   4,462.9      2.2     89.5   4,483   4,483  2,508  2,498  
  3550.   Freeable   2,116.4        .0       .9      6.3     298     N/A  2,266  2,266  
  3551.   PL/SQL        94.0      69.8       .0       .0       1       1  2,610  2,609  
  3552. E Other     15,977.3       N/A      6.1     66.9   3,387   3,387  2,616  2,616  
  3553.   SQL        5,447.9   4,519.0      2.2     89.8   4,505   4,505  2,514  2,503  
  3554.   Freeable   2,119.9        .0       .9      6.3     297     N/A  2,273  2,273  
  3555.   PL/SQL        93.2      69.2       .0       .0       1       1  2,614  2,613  
  3556.   
  3557.    
  3558.   
  3559.    
  3560.   
  3561. 数据来源为dba_hist_process_mem_summary, 这里是对PGA 使用的一个小结,帮助我们了解到底谁用掉了PGA  
  3562.   
  3563.    
  3564.   
  3565. B: 开始快照     E:  结束快照  
  3566.   
  3567. 该环节列出 PGA中各分类的使用量  
  3568.   
  3569. Category   分类名,包括”SQL”, “PL/SQL”, “OLAP” 和”JAVA”. 特殊分类是 “Freeable” 和”Other”.    Free memory是指哪些 OS已经分配给进程,但没有分配给任何分类的内存。 “Other”是已经分配给分类的内存,但不是已命名的分类  
  3570.   
  3571. Alloc (MB)  allocated_total  该分类被分配的总内存  
  3572.   
  3573. Used (MB)  used_total  该分类已使用的内存  
  3574.   
  3575. Avg  Alloc (MB) allocated_avg     平均每个进程中该分类分配的内存量  
  3576.   
  3577. Std Dev Alloc (MB) :该分类分配的内存在每个进程之间的标准差  
  3578.   
  3579. Max Alloc (MB) ALLOCATED_MAX :在快照时间内单个进程该分类最大分配过的内存量:Max Alloc is Maximum PGA Allocation size at snapshot time  
  3580.   
  3581. Hist Max Alloc (MB) MAX_ALLOCATED_MAX: 目前仍链接着的进程该分类最大分配过的内存量:Hist Max Alloc is the Historical Max Allocation for still-connected processes  
  3582.   
  3583. Num Proc num_processes   进程数目  
  3584.   
  3585. Num Alloc NON_ZERO_ALLOCS  分配了该类型 内存的进程数目  
  3586.   
  3587.    
  3588.   
  3589.    
  3590.   
  3591.    
  3592.   
  3593.  14 SGA信息  
  3594.   
  3595.    
  3596.   
  3597. 14 -1 SGA Memory Summary    
  3598.   
  3599.    
  3600. SGA Memory Summary                 DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3601.   
  3602.                                                       End Size (Bytes)  
  3603. SGA regions                     Begin Size (Bytes)      (if different)  
  3604. ------------------------------ ------------------- -------------------  
  3605. Database Buffers                    20,669,530,112  
  3606. Fixed Size                               2,241,880  
  3607. Redo Buffers                           125,669,376  
  3608. Variable Size                       10,536,094,376  
  3609.                                -------------------  
  3610. sum                                 31,333,535,744  
  3611.   
  3612.    
  3613.   
  3614.    
  3615.   
  3616. 粗粒度的sga区域内存使用信息, End Size仅在于begin size不同时打印  
  3617.   
  3618.    
  3619.   
  3620.    
  3621.   
  3622.    
  3623.   
  3624. 14-2 SGA breakdown difference  
  3625.   
  3626.    
  3627.   
  3628.    
  3629. SGA breakdown difference           DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3630. -> ordered by Pool, Name  
  3631. -> N/A value for Begin MB or End MB indicates the size of that Pool/Name was  
  3632.    insignificant, or zero in that snapshot  
  3633.   
  3634. Pool   Name                                 Begin MB         End MB  % Diff  
  3635. ------ ------------------------------ -------------- -------------- -------  
  3636. java   free memory                              64.0           64.0    0.00  
  3637. large  PX msg pool                               7.8            7.8    0.00  
  3638. large  free memory                             247.8          247.8    0.00  
  3639. shared Checkpoint queue                        140.6          140.6    0.00  
  3640. shared FileOpenBlock                         2,459.2        2,459.2    0.00  
  3641. shared KGH: NO ACCESS                        1,629.6        1,629.6    0.00  
  3642. shared KGLH0                                   997.7          990.5   -0.71  
  3643. shared KKSSP                                   312.2          308.9   -1.06  
  3644. shared SQLA                                    376.6          370.6   -1.61  
  3645. shared db_block_hash_buckets                   178.0          178.0    0.00  
  3646. shared dbktb: trace buffer                     156.3          156.3    0.00  
  3647. shared event statistics per sess               187.1          187.1    0.00  
  3648. shared free memory                           1,208.9        1,220.6    0.97  
  3649. shared gcs resources                           435.0          435.0    0.00  
  3650. shared gcs shadows                             320.6          320.6    0.00  
  3651. shared ges enqueues                            228.9          228.9    0.00  
  3652. shared ges resource                            118.3          118.3    0.00  
  3653. shared init_heap_kfsg                        1,063.6        1,068.1    0.43  
  3654. shared kglsim object batch                     124.3          124.3    0.00  
  3655. shared ksunfy : SSO free list                  174.7          174.7    0.00  
  3656. stream free memory                             128.0          128.0    0.00  
  3657.        buffer_cache                         19,712.0       19,712.0    0.00  
  3658.        fixed_sga                                 2.1            2.1    0.00  
  3659.        log_buffer                              119.8          119.8    0.00  
  3660.           -------------------------------------------------------------  
  3661.   
  3662.    
  3663.   
  3664. Pool  内存池的名字  
  3665.   
  3666. Name  内存池中细分组件的名字  例如KGLH0 存放KEL Heap 0 、SQLA存放SQL执行计划等  
  3667.   
  3668. Begin MB 快照开始时该组件的内存大小  
  3669.   
  3670. End MB  快照结束时该组件的内存大小  
  3671.   
  3672. % Diff 差异百分比  
  3673.   
  3674. 特别注意 由于AMM /ASMM引起的shared pool收缩 一般在sga breakdown中可以提现 例如SQLA 、KQR等组件大幅缩小 ,可能导致一系列的解析等待 cursor: Pin S on X 、row cache lock等  
  3675.   
  3676. 此处的free memory信息也值得我们关注, 一般推荐shared pool应当有300~400  MB 的free memory为宜  
  3677.   
  3678.    
  3679.   
  3680.    
  3681.   
  3682.    
  3683.   
  3684.  15 Streams统计  
  3685.   
  3686.    
  3687.   
  3688.    
  3689. Streams CPU/IO Usage                      DB/Inst: ORCL/orcl1  Snaps: 556-559  
  3690. -> Streams processes ordered by CPU usage  
  3691. -> CPU and I/O Time in micro seconds  
  3692.   
  3693. Session Type                    CPU Time  User I/O Time   Sys I/O Time  
  3694. ------------------------- -------------- -------------- --------------  
  3695. QMON Coordinator                 101,698              0              0  
  3696. QMON Slaves                       63,856              0              0  
  3697.           -------------------------------------------------------------  
  3698.   
  3699. Streams Capture                           DB/Inst: CATGT/catgt  Snaps: 911-912   
  3700. -> Lag Change should be small or negative (in seconds)  
  3701.   
  3702.                          Captured Enqueued      Pct            Pct        Pct       Pct  
  3703.                          Per        Per         Lag RuleEval  Enqueue     RedoWait  Pause  
  3704. Capture Name   Second    Second     Change      Time           Time       Time      Time   
  3705. ------------ -------- -------- -------- -------- -------- -------- --------   
  3706. CAPTURE_CAT       650          391       93             0          23         0          71     
  3707. -------------------------------------------------------------   
  3708.   
  3709. Streams Apply                             DB/Inst: CATGT/catgt  Snaps: 911-912   
  3710. -> Pct DB is the percentage of all DB transactions that this apply handled   
  3711. -> WDEP is the wait for dependency   
  3712. -> WCMT is the wait for commit   
  3713. -> RBK is rollbacks -> MPS is messages per second   
  3714. -> TPM is time per message in milli-seconds   
  3715. -> Lag Change should be small or negative (in seconds)  
  3716.   
  3717.                     Applied  Pct  Pct   Pct  Pct  Applied  Dequeue     Apply        Lag   
  3718. Apply Name           TPS   DB  WDEP WCMT RBK        MPS      TPM          TPM    Change   
  3719. ------------ -------- ---- ---- ---- --- -------- -------- -------- --------   
  3720. APPLY_CAT           0         0     0     0     0        0            0            0          0  
  3721.            -------------------------------------------------------------  
  3722.   
  3723.    
  3724.   
  3725.    
  3726.   
  3727.    
  3728.   
  3729. Capture Name : Streams捕获进程名  
  3730.   
  3731. Captured Per Second :每秒挖掘出来的message 条数  
  3732.   
  3733. Enqueued Per Second:  每秒入队的message条数  
  3734.   
  3735. lag change:  指日志生成的时间到挖掘到该日志生成 message的时间延迟  
  3736.   
  3737. Pct Enqueue Time: 入队时间的比例  
  3738.   
  3739. Pct redoWait  Time :  等待redo的时间比例  
  3740.   
  3741. Pct Pause Time : Pause 时间的比例  
  3742.   
  3743.    
  3744.   
  3745. Apply Name  Streams 应用Apply进程的名字  
  3746.   
  3747. Applied TPS : 每秒应用的事务数  
  3748.   
  3749. Pct DB:  所有的DB事务中 apply处理的比例  
  3750.   
  3751. Pct WDEP: 由于等待依赖的数据而耗费的时间比例  
  3752.   
  3753. Pct WCMT: 由于等待commit而耗费的时间比例  
  3754.   
  3755. Pct RBK:  事务rollback 回滚的比例  
  3756.   
  3757. Applied MPS: 每秒应用的message 数  
  3758.   
  3759. Dequeue TPM: 每毫秒出队的message数  
  3760.   
  3761. Lag Change:指最新message生成的时间到其被Apply收到的延迟  
  3762.   
  3763.    
  3764.   
  3765.    
  3766.   
  3767. 16 Resource Limit   
  3768.   
  3769.    
  3770. Resource Limit Stats                     DB/Inst: MAC/MAC2  Snap: 70723  
  3771. -> only rows with Current or Maximum Utilization > 80% of Limit are shown  
  3772. -> ordered by resource name  
  3773.   
  3774.                                   Current      Maximum     Initial  
  3775. Resource Name                   Utilization  Utilization Allocation   Limit  
  3776. ------------------------------ ------------ ------------ ---------- ----------  
  3777. ges_procs                             2,612        8,007      10003      10003  
  3778. processes                             2,615        8,011      10000      10000  
  3779.   
  3780.    
  3781.   
  3782.    
  3783.   
  3784. 数据源于dba_hist_resource_limit  
  3785.   
  3786.    
  3787.   
  3788. 注意这里仅列出当前使用或最大使用量>80% *最大限制的资源名,如果没有列在这里则说明 资源使用量安全  
  3789. Current Utilization 当前对该资源(包括Enqueue Resource、Lock和processes)的使用量  
  3790.   
  3791. Maximum Utilization 从最近一次实例启动到现在该资源的最大使用量  
  3792.   
  3793. Initial Allocation  初始分配值,一般等于参数文件中指定的值  
  3794.   
  3795. Limit  实际上限值  
  3796.   
  3797.    
  3798.   
  3799.    
  3800.   
  3801.    
  3802.   
  3803. 17 init.ora Parameters        
  3804.   
  3805.    
  3806. init.ora Parameters               DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3807.   
  3808.                                                                 End value  
  3809. Parameter Name                Begin value                       (if different)  
  3810. ----------------------------- --------------------------------- --------------  
  3811. _compression_compatibility    11.2.0  
  3812. _kghdsidx_count               4  
  3813. _ksmg_granule_size            67108864  
  3814. _shared_pool_reserved_min_all 4100  
  3815. archive_lag_target            900  
  3816. audit_file_dest               /u01/app/oracle/admin/MAC/adum  
  3817. audit_trail                   OS  
  3818. cluster_database              TRUE  
  3819. compatible                    11.2.0.2.0  
  3820. control_files                 +DATA/MAC/control01.ctl, +RECO  
  3821. db_16k_cache_size             268435456  
  3822. db_block_size                 8192  
  3823. db_cache_size                 19327352832  
  3824. db_create_file_dest           +DATA  
  3825.   
  3826.    
  3827.   
  3828. Parameter Name 参数名  
  3829.   
  3830. Begin value 开始快照时的参数值  
  3831.   
  3832. End value 结束快照时的参数值 (仅在发生变化时打印)  
  3833.   
  3834.    
  3835.   
  3836.    
  3837.   
  3838. 18 Global Messaging Statistics  
  3839.   
  3840.    
  3841. Global Messaging Statistics       DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3842.   
  3843. Statistic                                    Total   per Second    per Trans  
  3844. --------------------------------- ---------------- ------------ ------------  
  3845. acks for commit broadcast(actual)           53,705         14.9          0.2  
  3846. acks for commit broadcast(logical          311,182         86.1          1.3  
  3847. broadcast msgs on commit(actual)           317,082         87.7          1.3  
  3848. broadcast msgs on commit(logical)          317,082         87.7          1.3  
  3849. broadcast msgs on commit(wasted)           263,332         72.9          1.1  
  3850. dynamically allocated gcs resourc                0          0.0          0.0  
  3851. dynamically allocated gcs shadows                0          0.0          0.0  
  3852. flow control messages received                 267          0.1          0.0  
  3853. flow control messages sent                     127          0.0          0.0  
  3854. gcs apply delta                                  0          0.0          0.0  
  3855. gcs assume cvt                              55,541         15.4          0.2  
  3856.   
  3857. 全局通信统计信息,数据来源WRH$_DLM_MISC;  
  3858.   
  3859.    
  3860.   
  3861.    
  3862.   
  3863.  20 Global CR Served Stats  
  3864.   
  3865.    
  3866. Global CR Served Stats            DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3867.   
  3868. Statistic                                   Total  
  3869. ------------------------------ ------------------  
  3870. CR Block Requests                         403,703  
  3871. CURRENT Block Requests                    444,896  
  3872. Data Block Requests                       403,705  
  3873. Undo Block Requests                        94,336  
  3874. TX Block Requests                         307,896  
  3875. Current Results                           652,746  
  3876. Private results                            21,057  
  3877. Zero Results                              104,720  
  3878. Disk Read Results                          69,418  
  3879. Fail Results                                  508  
  3880. Fairness Down Converts                    102,844  
  3881. Fairness Clears                            15,207  
  3882. Free GC Elements                                0  
  3883. Flushes                                   105,052  
  3884. Flushes Queued                                  0  
  3885. Flush Queue Full                                0  
  3886. Flush Max Time (us)                             0  
  3887. Light Works                                71,793  
  3888. Errors                                        117  
  3889.   
  3890.    
  3891.   
  3892.    
  3893.   
  3894. LMS传输CR BLOCK的统计信息,数据来源WRH$_CR_BLOCK_SERVER  
  3895.   
  3896.    
  3897.   
  3898.    
  3899.   
  3900.    
  3901.   
  3902. 21 Global CURRENT Served Stats  
  3903.   
  3904.    
  3905.   
  3906.    
  3907. Global CURRENT Served Stats        DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3908. -> Pins    = CURRENT Block Pin Operations  
  3909. -> Flushes = Redo Flush before CURRENT Block Served Operations  
  3910. -> Writes  = CURRENT Block Fusion Write Operations  
  3911.   
  3912. Statistic         Total   % <1ms  % <10ms % <100ms    % <1s   % <10s  
  3913. ---------- ------------ -------- -------- -------- -------- --------  
  3914. Pins             73,018    12.27    75.96     8.49     2.21     1.08  
  3915. Flushes          79,336     5.98    50.17    14.45    19.45     9.95  
  3916. Writes          102,189     3.14    35.23    19.34    33.26     9.03  
  3917.   
  3918.    
  3919.   
  3920. 数据来源dba_hist_current_block_server  
  3921.   
  3922.    
  3923.   
  3924.    
  3925.   
  3926. Time to process current block request = (pin time + flush time + send time)  
  3927.   
  3928. Pins CURRENT Block Pin Operations , PIN的内涵是处理一个BAST  不包含对global current block的flush和实际传输  
  3929.   
  3930. The pin time represents how much time is required to process a BAST. It does not include the flush time and  
  3931.  the send time. The average pin time per block served should be very low because the processing consists  
  3932.  mainly of code path and should never be blocked.  
  3933.   
  3934. Flush 指 脏块被LMS进程传输出去之前,其相关的redo必须由LGWR已经flush 到磁盘上  
  3935.   
  3936.    
  3937.   
  3938. Write 指fusion write number of writes which were mediated; 节点之间写脏块需求相互促成的行为 KJBL.KJBLREQWRITE  gcs write request msgs 、gcs writes refused  
  3939.   
  3940. % <1ms  % <10ms % <100ms    % <1s   % <10s  分别对应为pin、flush、write行为耗时的比例  
  3941.   
  3942. 例如在上例中flush和 write 在1s 到10s之间的有9%,在100ms 和1s之间的有19%和33%,因为flush和write都是IO操作 所以这里可以预见IO存在问题,延迟较高  
  3943.   
  3944.    
  3945.   
  3946.    
  3947.   
  3948. 22 Global Cache Transfer Stats   
  3949.   
  3950.    
  3951. Global Cache Transfer Stats        DB/Inst: MAC/MAC2  Snaps: 70719-70723  
  3952. -> Immediate  (Immed) - Block Transfer NOT impacted by Remote Processing Delays  
  3953. -> Busy        (Busy) - Block Transfer impacted by Remote Contention  
  3954. -> Congested (Congst) - Block Transfer impacted by Remote System Load  
  3955. -> ordered by CR + Current Blocks Received desc  
  3956.   
  3957.                                CR                         Current  
  3958.                  ----------------------------- -----------------------------  
  3959. Inst Block         Blocks      %      %      %   Blocks      %      %      %  
  3960.   No Class       Received  Immed   Busy Congst Received  Immed   Busy Congst  
  3961. ---- ----------- -------- ------ ------ ------ -------- ------ ------ ------  
  3962.    1 data block   133,187   76.3   22.6    1.1  233,138   75.2   23.0    1.7  
  3963.    4 data block   143,165   74.1   24.9    1.0  213,204   76.6   21.8    1.6  
  3964.    3 data block   122,761   75.9   23.0    1.1  220,023   77.7   21.0    1.3  
  3965.    1 undo header  104,219   95.7    3.2    1.1      941   93.4    5.8     .7  
  3966.    4 undo header   95,823   95.2    3.7    1.1      809   93.4    5.3    1.2  
  3967.    3 undo header   95,592   95.6    3.3    1.1      912   94.6    4.5     .9  
  3968.    1 undo block    25,002   95.8    3.4     .9        0    N/A    N/A    N/A  
  3969.    4 undo block    23,303   96.0    3.1     .9        0    N/A    N/A    N/A  
  3970.    3 undo block    21,672   95.4    3.7     .9        0    N/A    N/A    N/A  
  3971.    1 Others         1,909   92.0    6.8    1.2    6,057   89.6    8.9    1.5  
  3972.    4 Others         1,736   92.4    6.1    1.5    5,841   88.8    9.9    1.3  
  3973.    3 Others         1,500   92.4    5.9    1.7    4,405   87.7   10.8    1.6  
  3974.   
  3975. 数据来源DBA_HIST_INST_CACHE_TRANSFER  
  3976.   
  3977.    
  3978.   
  3979.    
  3980.   
  3981. Inst No 节点号  
  3982.   
  3983. Block Class 块的类型  
  3984.   
  3985. CR Blocks Received 该节点上 该类型CR 块的接收数量  
  3986.   
  3987. CR Immed %: CR块请求立即接收到的比例  
  3988.   
  3989. CR Busy%:CR块请求由于远端争用而没有立即接收到的比例  
  3990.   
  3991. CR Congst%: CR块请求由于远端负载高而没有立即接收到的比例  
  3992.   
  3993.    
  3994.   
  3995. Current Blocks Received  该节点上 该类型Current 块的接收数量  
  3996.   
  3997. Current Immed %: Current块请求立即接收到的比例  
  3998.   
  3999. Current Busy%:Current块请求由于远端争用而没有立即接收到的比例  
  4000.   
  4001. Current Congst%: Current块请求由于远端负载高而没有立即接收到的比例  
  4002.   
  4003.    
  4004.   
  4005. Congst%的比例应当非常低 不高于2%, Busy%很大程度受到IO的影响,如果超过10% 一般会有严重的gc buffer busy acquire/release  
  4006.   
  4007. 参考文档  
  4008.   
  4009. Statistics Descriptions  http://docs.oracle.com/cd/B19306_01/server.102/b14237/stats002.htm  
  4010.   
  4011. Memory Configuration and Use  http://docs.oracle.com/cd/B19306_01/server.102/b14211/memory.htm  
  4012.   
  4013. Library Cache Hit (%)   http://docs.oracle.com/cd/B16240_01/doc/doc.102/e16282/oracle_database_help/oracle_database_instance_efficiency_libcache_hit_pct.html  
  4014.   
  4015. Oracle® Database Performance Tuning Guide 12c Release 1 (12.1)  
  4016.   
  4017.   
  4018. How to Interpret the “SQL ordered by Physical Reads (UnOptimized)” Section in AWR Reports (11.2 onwards) [ID 1466035.1]  
  4019.   
  4020.   
  4021. 相关文章 | Related posts:  
  4022. 1.应用长短链接变更对于Oracle数据库性能的影响  
  4023. 2.直接路径读取对于延迟块清除的影响  
  4024. 3.db file parallel read等待事件  
  4025. 4.free buffer waits等待事件  
  4026. 5.db file sequential read等待事件  
  4027. 6.gc buffer busy等待事件  
  4028. 7.buffer busy waits等待事件  
  4029. 8.db file parallel write等待事件  
  4030. 9.cell single block physical read等待事件  
  4031. 10.Exadata测试CELL_FLASH_CACHE KEEP性能 
0 0
原创粉丝点击