7-1 Checkpoint
Activity 检查点与 Instance Recovery
Stats 实例恢复
Checkpoint Activity Snaps: 70719-70723
-> Total Physical Writes: 590,563
Other Autotune Thread
MTTR Log Size Log Ckpt Settings Ckpt Ckpt
Writes Writes Writes Writes Writes Writes
----------- ----------- ----------- ----------- ----------- -----------
0 0 0 0 12,899 0
-------------------------------------------------------------
Instance Recovery Stats Snaps: 70719-70723
-> B: Begin Snapshot, E: End Snapshot
Estd
Targt Estd Log Ckpt Log Ckpt Opt RAC
MTTR MTTR Recovery Actual Target Log Sz Timeout Interval Log Avail
(s) (s) Estd IOs RedoBlks RedoBlks RedoBlks RedoBlks RedoBlks Sz(M) Time
- ----- ----- -------- -------- -------- -------- -------- -------- ------ -----
B 0 6 12828 477505 1786971 5096034 1786971 N/A N/A 3
E 0 7 16990 586071 2314207 5096034 2314207 N/A N/A 3
-------------------------------------------------------------
该环节的数据来源于WRH$_INSTANCE_RECOVERY
MTTR Writes : 为了满足FAST_START_MTTR_TARGET
指定的MTTR值 而做出的物理写 WRITES_MTTR
Log
Size Writes :由于最小的redo log file而做出的物理写 WRITES_LOGFILE_SIZE
Log
Ckpt writes: 由于 LOG_CHECKPOINT_INTERVAL 和
LOG_CHECKPOINT_TIMEOUT 驱动的增量检查点而做出的物理写
WRITES_LOG_CHECKPOINT_SETTINGS
Other
Settings Writes
:由于其他设置(例如FAST_START_IO_TARGET)而引起的物理写, WRITES_OTHER_SETTINGS
Autotune Ckpt Writes : 由于自动调优检查点而引起的物理写, WRITES_AUTOTUNE
Thread
Ckpt Writes :由于thread
checkpoint而引起的物理写,WRITES_FULL_THREAD_CKPT
B 代表 开始点, E 代表结尾
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以保守算法计算以获得完成恢复的最长估算时间。
estimated_mttr (s): 当前基于
脏buffer和重做日志块的数量,而评估出的有效恢复时间 。 它的估算告诉用户
以当下系统的负载若发生实例crash,则需要多久时间来做crash recovery的前滚操作,之后才能打开数据库。
Recovery Estd IOs :实际是当前buffer cache中的脏块数量,一旦实例崩溃 这些脏块要被前滚
Actual
RedoBlks : 当前实际需要恢复的redo重做块数量
Target
RedoBlks :是 Log Sz RedoBlks 、Log Ckpt Timeout
RedoBlks、 Log Ckpt Interval
RedoBlks 三者的最小值
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;
Log
Ckpt Timeout RedoBlks :
为了满足LOG_CHECKPOINT_TIMEOUT 所需要处理的redo block数,lag
for checkpoint timeout ; 数据来源select CT_LAG from x$targetrba;
Log
Ckpt Interval RedoBlks :为了满足LOG_CHECKPOINT_INTERVAL 所需要处理的redo
block数, lag for checkpoint interval; 数据来源select CI_LAG from
x$targetrba;
Opt Log
Sz(M) : 基于FAST_START_MTTR_TARGET 而估算出来的redo
logfile 的大小,单位为MB 。 Oracle官方推荐创建的重做日志大小至少大于这个估算值
Estd
RAC Avail Time :指评估的 RAC中节点失败后 集群从冻结到部分可用的时间,
这个指标仅在RAC中可用,单位为秒。 ESTD_CLUSTER_AVAILABLE_TIME
7-2 Buffer Pool
Advisory 缓冲池建议
Buffer Pool Advisory DB/Inst: ITSCMP/itscmp2 Snap: 70723
-> Only rows with estimated physical reads >0 are displayed
-> ordered by Block Size, Buffers For Estimate
Est
Phys Estimated Est
Size for Size Buffers Read Phys Reads Est Phys �time
P Est (M) Factor (thousands) Factor (thousands) Read Time for Rds
--- -------- ------ ------------ ------ -------------- ------------ -------
D 1,920 .1 227 4.9 1,110,565,597 1 1.0E+09
D 3,840 .2 454 3.6 832,483,886 1 7.4E+08
D 5,760 .3 680 2.8 634,092,578 1 5.6E+08
D 7,680 .4 907 2.2 500,313,589 1 4.3E+08
D 9,600 .5 1,134 1.8 410,179,557 1 3.5E+08
D 11,520 .6 1,361 1.5 348,214,283 1 2.9E+08
D 13,440 .7 1,588 1.3 304,658,441 1 2.5E+08
D 15,360 .8 1,814 1.2 273,119,808 1 2.2E+08
D 17,280 .9 2,041 1.1 249,352,943 1 2.0E+08
D 19,200 1.0 2,268 1.0 230,687,206 1 1.8E+08
D 19,456 1.0 2,298 1.0 228,664,269 1 1.8E+08
D 21,120 1.1 2,495 0.9 215,507,858 1 1.7E+08
D 23,040 1.2 2,722 0.9 202,816,787 1 1.6E+08
D 24,960 1.3 2,948 0.8 191,974,196 1 1.5E+08
D 26,880 1.4 3,175 0.8 182,542,765 1 1.4E+08
D 28,800 1.5 3,402 0.8 174,209,199 1 1.3E+08
D 30,720 1.6 3,629 0.7 166,751,631 1 1.2E+08
D 32,640 1.7 3,856 0.7 160,002,420 1 1.2E+08
D 34,560 1.8 4,082 0.7 153,827,351 1 1.1E+08
D 36,480 1.9 4,309 0.6 148,103,338 1 1.1E+08
D 38,400 2.0 4,536 0.6 142,699,866 1 1.0E+08
缓冲池的颗粒大小 可以参考 SELECT * FROM V$SGAINFO where name
like(‘Granule%’);
P 指 缓冲池的名字 可能包括 有 D default buffer pool ,
K Keep Pool , R recycle Pool
Size
For Est(M): 指以该尺寸的buffer pool作为评估的对象,一般是
目前current size的 10% ~ 200%,以便了解 buffer pool 增大 ~减小 对物理读的影响
Size
Factor : 尺寸因子, 只 对应buffer pool
大小 对 当前设置的比例因子, 例如current_size是 100M ,
则如果评估值是110M 那么 size Factor 就是 1.1
Buffers
(thousands) :指这个buffer pool 尺寸下的buffer 数量, 要乘以1000才是实际值
Est Phys Read Factor :评估的物理读因子, 例如当前尺寸的buffer
pool 会引起100个物理读, 则别的尺寸的buffer pool如果引起 120个物理读, 那么
对应尺寸的Est Phys Read Factor就是1.2
Estimated Phys Reads (thousands):评估的物理读数目, 要乘以 1000才是实际值,
显然不同尺寸的buffer pool对应不同的评估的物理读数目
Est
Phys Read Time : 评估的物理读时间
Est
�time for Rds:评估的物理读占DB TIME的比率
我们
看buffer pool advisory 一般有2个目的:
在物理读较多的情况下,希望通过增加buffer pool 大小来缓解物理读等待,这是我们关注Size Factor >
1的buffer pool尺寸是否能共有效减少Est Phys Read Factor,
如果Est Phys Read Factor随着Size Factor 增大
而显著减少,那么说明增大buffer cache 是可以有效减少物理读的。
在内存紧张的情况下 ,希望从buffer pool中匀出部分内存来移作他用, 但是又不希望
buffer cache变小导致 物理读增多 性能下降, 则此时 观察Est Phys Read
Factor 是否随着Size Factor 减小而 显著增大, 如果不是
则说明减少部分buffer cache 不会导致 物理读大幅增加,也就可以安心 减少 buffer cache
注意 Size
Factor 和 Est Phys Read Factor之间不是简单的
线性关系,所以需要人为介入评估得失
7-3 PGA Aggr
Summary
PGA Aggr Summary Snaps: 70719-70723
-> PGA cache hit % - percentage of W/A (WorkArea) data processed only in-memory
PGA Cache Hit % W/A MB Processed Extra W/A MB Read/Written
--------------- ------------------ --------------------------
99.9 412,527 375
PGA
Cache Hit % : 指 W/A WorkArea工作区的数据仅在内存中处理的比率, PGA缓存命中率
workarea是PGA中负责处理 排序、哈希连接和位图合并操作的区域; workarea 也叫做 SQL 作业区域
W/A MB
processes: 指
在Workarea中处理过的数据的量,单位为MB
Extra
W/A MB Read/Written : 指额外从磁盘上 读写的 工作区数据, 单位为
MB
7-4 PGA Aggr Target
Stats
Warning: pga_aggregate_target was set too low for current workload, as this
value was exceeded during this interval. Use the PGA Advisory view
to help identify a different value for pga_aggregate_target.
PGA Aggr Target Stats Snaps: 70719-70723
-> B: Begin Snap E: End Snap (rows dentified with B or E contain data
which is absolute i.e. not diffed over the interval)
-> Auto PGA Target - actual workarea memory target
-> W/A PGA Used - amount of memory used for all Workareas (manual + auto)
-> %PGA W/A Mem - percentage of PGA memory allocated to workareas
-> %Auto W/A Mem - percentage of workarea memory controlled by Auto Mem Mgmt
-> %Man W/A Mem - percentage of workarea memory under manual control
%PGA %Auto %Man
PGA Aggr Auto PGA PGA Mem W/A PGA W/A W/A W/A Global Mem
Target(M) Target(M) Alloc(M) Used(M) Mem Mem Mem Bound(K)
- ---------- ---------- ---------- ---------- ------ ------ ------ ----------
B 8,192 512 23,690.5 150.1 .6 100.0 .0 838,860
E 8,192 512 23,623.6 156.9 .7 100.0 .0 838,860
-------------------------------------------------------------
此环节的数据来源主要是 WRH$_PGASTAT
PGA
Aggr Target(M) :本质上就是pga_aggregate_target ,
当然在AMM(memory_target)环境下 这个值可能会自动变化
Auto
PGA Target(M) : 在自动PGA 管理模式下
实际可用的工作区内存 “aggregate PGA auto target “,
因为PGA还有其他用途 ,不能全部作为workarea memory
PGA Mem
Alloc(M) :目前已分配的PGA内存, alloc 不等于 inuse
即分配的内存不等于在使用的内存,理论上PGA会将确实不使用的内存返回给OS(PGA memory freed back to OS)
,但是存在PGA占用大量内存而不释放的场景
在上例中
pga_aggregate_target 仅为8192M ,而实际processes 在 2,615~
8000之间,如果一个进程耗费5MB的PGA 也需要 10000M的PGA ,而实际这里 PGA
Mem Alloc(M)是23,690 M ,这说明 存在PGA 的过载, 需要调整pga_aggregate_target
W/A PGA
Used(M) :所有的工作区workarea(包括manual和 auto)使用的内存总和量, 单位为MB
%PGA
W/A Mem: 分配给workarea的内存量占总的PGA的比例, (W/A PGA Used)/PGA Mem
Alloc
%Auto
W/A Mem : AUTO 自动工作区管理所控制的内存(workarea_size_policy=AUTO)
占总的workarea内存的比例
%Man
W/A Mem : MANUAL
手动工作区管理所控制的内存(workarea_size_policy=MANUAL)占总的workarea内存的比例
Global
Mem Bound(K) : 指 在自动PGA管理模式下一个工作区所能分配的最大内存(注意
一个SQL执行过程中可能有多个工作区workarea)。 Global Mem
Bound(K)这个指标在实例运行过程中将被持续性的修正,以反应数据库当时工作区的负载情况。显然在有众多活跃工作区的系统负载下相应地Global
Mem Bound将会下降。 但应当保持global bound值不要小于1 MB , 否则建议
调高pga_aggregate_target
7-5 PGA Aggr
Target Histogram
PGA Aggr Target Histogram Snaps: 70719-70723
-> Optimal Executions are purely in-memory operations
Low High
Optimal Optimal Total Execs Optimal Execs 1-Pass Execs M-Pass Execs
------- ------- -------------- -------------- ------------ ------------
2K 4K 262,086 262,086 0 0
64K 128K 497 497 0 0
128K 256K 862 862 0 0
256K 512K 368 368 0 0
512K 1024K 440,585 440,585 0 0
1M 2M 68,313 68,313 0 0
2M 4M 169 161 8 0
4M 8M 50 42 8 0
8M 16M 82 82 0 0
16M 32M 1 1 0 0
32M 64M 12 12 0 0
128M 256M 2 0 2 0
-------------------------------------------------------------
数据来源:WRH$_SQL_WORKAREA_HISTOGRAM
Low
Optimal: 此行所包含工作区workarea最适合内存要求的下限
High
Optimal: 此行所包含工作区workarea最适合内存要求的上限
Total
Execs: 在 Low Optimal~High Optimal 范围工作区内完成的总执行数
Optimal
execs: optimal 执行是指完全在PGA内存中完成的执行次数
1-pass
Execs : 指操作过程中仅发生1次磁盘读取的执行次数
M-pass
Execs: 指操作过程中发生了1次以上的磁盘读取, 频发磁盘读取的执行次数
7-6 PGA Memory
Advisory
PGA Memory Advisory Snap: 70723
-> When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value
where Estd PGA Overalloc Count is 0
Estd Extra Estd P Estd PGA
PGA Target Size W/A MB W/A MB Read/ Cache Overallo Estd
Est (MB) Factr Processed Written to Disk Hit % Count Time
---------- ------- ---------------- ---------------- ------ -------- -------
1,024 0.1 2,671,356,938.7 387,531,258.9 87.0 1.07E+07 7.9E+11
2,048 0.3 2,671,356,938.7 387,529,979.1 87.0 1.07E+07 7.9E+11
4,096 0.5 2,671,356,938.7 387,518,881.8 87.0 1.07E+07 7.9E+11
6,144 0.8 2,671,356,938.7 387,420,749.5 87.0 1.07E+07 7.9E+11
8,192 1.0 2,671,356,938.7 23,056,196.5 99.0 1.07E+07 6.9E+11
9,830 1.2 2,671,356,938.7 22,755,192.6 99.0 6.81E+06 6.9E+11
11,469 1.4 2,671,356,938.7 20,609,438.5 99.0 4.15E+06 6.9E+11
13,107 1.6 2,671,356,938.7 19,021,139.1 99.0 581,362 6.9E+11
14,746 1.8 2,671,356,938.7 18,601,191.0 99.0 543,531 6.9E+11
16,384 2.0 2,671,356,938.7 18,561,361.1 99.0 509,687 6.9E+11
24,576 3.0 2,671,356,938.7 18,527,422.3 99.0 232,817 6.9E+11
32,768 4.0 2,671,356,938.7 18,511,872.6 99.0 120,180 6.9E+11
49,152 6.0 2,671,356,938.7 18,500,815.3 99.0 8,021 6.9E+11
65,536 8.0 2,671,356,938.7 18,498,733.0 99.0 0 6.9E+11
PGA
Target Est (MB) 用以评估的
PGA_AGGREGATE _TARGET值
Size
Factr , 当前用以评估的PGA_AGGREGATE
_TARGET 和 当前实际设置的PGA_AGGREGATE _TARGET 之间的 比例因子
PGA Target Est / PGA_AGGREGATE_TARGE
W/A MB
Processed :workarea中要处理的数据量, 单位为MB
Estd
Extra W/A MB Read/ Written to Disk :
以 one-pass 、M-Pass方式处理的数据量预估值, 单位为MB
Estd P
Cache Hit % : 预估的PGA缓存命中率
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)
7-7 Shared Pool
Advisory
Shared Pool Advisory Snap: 70723
-> SP: Shared Pool Est LC: Estimated Library Cache Factr: Factor
-> Note there is often a 1:Many correlation between a single logical object
in the Library Cache, and the physical number of memory objects associated
with it. Therefore comparing the number of Lib Cache objects (e.g. in
v$librarycache), with the number of Lib Cache Memory Objects is invalid.
Est LC Est LC Est LC Est LC Shared SP Est LC Time Time Load Load Est LC
Pool Size Size Est LC Saved Saved Time Time Mem Obj
Size(M) Factr (M) Mem Obj (s) Factr (s) Factr Hits (K)
-------- ----- -------- ------------ -------- ------ ------- ------ ------------
304 .8 56 3,987 7,728 1.0 61 1.4 332
352 .9 101 6,243 7,745 1.0 44 1.0 334
400 1.0 114 7,777 7,745 1.0 44