Oracle AWR报告指标全解析一

2024-12-30Oracle / RAC / 性能优化

http://www.askmaclean.com/archives/awr-hawk-eyes-training.html

http://www.askmaclean.com/archives/awr-tuning-hawk-eyes.html如果你觉得本AWR解析中的哪些指标仍理解不透彻 或者讲的不清楚的,可以在本页中留言,谢谢大家的支持。

– –

指标 指标含义
redo size 单位 bytes,redo size可以用来估量update/insert/delete的频率,大的redo size往往对lgwr写日志,和arch归档造成I/O压力, Per Transaction可以用来分辨是 大量小事务, 还是少量大事务。如上例每秒redo 约1MB ,每个事务800 字节,符合OLTP特征
Logical Read 单位 次数*块数, 相当于 “人*次”, 如上例 196,888 * db_block_size=1538MB/s , 逻辑读耗CPU,主频和CPU核数都很重要,逻辑读高则DB CPU往往高,也往往可以看到latch: cache buffer chains等待。 大量OLTP系统(例如siebel)可以高达几十乃至上百Gbytes。
Block changes 单位 次数*块数 , 描绘数据变化频率
Physical Read 单位次数*块数, 如上例 5076 * 8k = 39MB/s, 物理读消耗IO读,体现在IOPS和吞吐量等不同纬度上;但减少物理读可能意味着消耗更多CPU。好的存储 每秒物理读能力达到几GB,例如Exadata。 这个physical read包含了physical reads cache和physical reads direct
Physical writes 单位 次数*块数,主要是DBWR写datafile,也有direct path write。 dbwr长期写出慢会导致定期log file switch(checkpoint no complete) 检查点无法完成的前台等待。 这个physical write 包含了physical writes direct +physical writes from cache
User Calls 单位次数,用户调用数,more details from internal
Parses 解析次数,包括软解析+硬解析,软解析优化得不好,则夸张地说几乎等于每秒SQL执行次数。 即执行解析比1:1,而我们希望的是 解析一次 到处运行哦!
Hard Parses 万恶之源. Cursor pin s on X, library cache: mutex X , latch: row cache objects /shared pool……………..。 硬解析最好少于每秒20次
W/A MB processed
Logons 登陆次数, logon storm 登陆风暴,结合AUDIT审计数据一起看。短连接的附带效应是游标缓存无用
Executes 执行次数,反应执行频率
Rollback 回滚次数, 反应回滚频率, 但是这个指标不太精确,参考而已,别太当真
Transactions 每秒事务数,是数据库层的TPS,可以看做压力测试或比对性能时的一个指标,孤立看无意义
% Blocks changed per Read
Recursive Call % 递归调用的比率;Recursive Call % = (recursive calls)/(user calls)
Rollback per transaction % 事务回滚比率。 Rollback per transaction %= (rollback)/(transactions)
Rows per Sort 平均每次排序涉及到的行数 ; Rows per Sort= ( sorts(rows) ) / ( sorts(disk) + sorts(memory))

– – – –

Class Waits Total Wait Time (s) Avg Time (ms)
data block 24,543 2,267 92
undo header 743 2 3
undo block 1,116 0 0
1st level bmb 35 0 0
session logical reads 40,769,800 22,544.84 204.71
Buffer Nowait %: 99.94

注意:但是实际AWR中 似乎还是按照9i中的算法,虽然算法的区别对最后算得的比率影响不大。对于buffer hit % 看它的命中率有多高没有意义,主要是关注 未命中的次数有多少。通过上述公式很容易反推出未命中的物理读的次数。 – –

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.
physical reads cache 8 Total number of data blocks read from disk into the buffer cache. This is a subset of “physical reads” statistic.
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.

– – – 维护这个指标的重点是 保持shared pool共享池有足够的Free Memory,且没有过多的内存碎片,具体可以参考这里。 显然过小的shared pool可用空间会导致library cache object被aged out换出共享池。

GETS NUMBER Number of times a lock was requested for objects of this namespace
GETHITS NUMBER Number of times an object’s handle was found in memory
GETHITRATIO NUMBER Ratio of GETHITS to GETS
PINS NUMBER Number of times a PIN was requested for objects of this namespace
PINHITS NUMBER Number of times all of the metadata pieces of the library object were found in memory
PINHITRATIO NUMBER Ratio of PINHITS to PINS
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
INVALIDATIONS NUMBER Total number of times objects in this namespace were marked invalid because a dependent object was modified

通过设置 session_cached_cursors参数 1. 2. 3. 利用FORCE_MATCHING_SIGNATURE捕获非绑定变量SQL几种常见的等待事件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)集合起来一起看。http://www.askmaclean.com/archives/db-file-sequential-read-wait-event.htmllatch free  其实是未获得latch ,而进入latch sleep,见《全面解析9i以后Oracle Latch闩锁原理》 – – – –

– – – –

– – – –

– – – – – – – – 注意该时间模型中的指标存在包含关系所以Time Model Statistics加起来超过100%再正常不过

– – – – – –

统计项 描述
NUM_CPU_SOCKETS 物理CPU的数目
NUM_CPU_CORES CPU的核数
NUM_CPUS 逻辑CPU的数目
SYS_TIME 在内核态被消耗掉的CPU时间片,单位为百分之一秒
USER_TIME 在用户态被消耗掉的CPU时间片,单位为百分之一秒
BUSY_TIME Busy_Time=SYS_TIME+USER_TIME 消耗的CPU时间片,单位为百分之一秒
AVG_BUSY_TIME AVG_BUSY_TIME= BUSY_TIME/NUM_CPUS
IDLE_TIME 空闲的CPU时间片,单位为百分之一秒
所有CPU所能提供总的时间片 BUSY_TIME + IDLE_TIME = ELAPSED_TIME * CPU_COUNT
OS_CPU_WAIT_TIME 进程等OS调度的时间,cpu queuing
VM_IN_BYTES 换入页的字节数
VM_OUT_BYTES 换出页的字节数,部分版本下并不准确,例如Bug 11712010 Abstract: VIRTUAL MEMORY PAGING ON 11.2.0.2 DATABASES,仅供参考
IOWAIT_TIME 所有CPU花费在等待I/O完成上的时间 单位为百分之一秒
RSRC_MGR_CPU_WAIT_TIME 是指当resource manager控制CPU调度时,需要控制对应进程暂时不使用CPU而进程到内部运行队列中,以保证该进程对应的consumer group(消费组)没有消耗比指定resource manager指令更多的CPU。RSRC_MGR_CPU_WAIT_TIME指等在内部运行队列上的时间,在等待时不消耗CPU

Oracle AWR报告指标全解析(二)