ORACLE STATSPACK REPORT输出结果解释

来源:互联网 发布:安卓软件推荐 知乎 编辑:程序博客网 时间:2024/05/16 03:27
最近整理了一下STATSPACK REPORT产生的文档,里面有很多我们在系统调优的时候非常重要的信息,从网上以及书本上罗列了一下,调优的过程其实也是一个不断学习的过程,只有经过反复的分析/尝试才会最终获得满意的结果,知识需要靠每日的积累,不可能一朝一夕就能全部掌握的,良好的学习态度才是根本,切忌浮躁~~
 
1、报表头信息数据库实例相关信息,包括数据库名称、ID、版本号及主机等信息
STATSPACK report for
 
DB Name         DB Id    Instance     Inst     Num Release   Cluster  Host
------------ ----------- ------------ -------- ----------- ------- ------------
COLM          357371480 colm         1      9.2.0.1.0      NO    STEVENHUANG3
 
            Snap Id     Snap Time           Sessions     Curs/Sess Comment
            ------- ------------------ -------- --------- -------------------
Begin Snap:     3    11-10-06 22:27:04      13       4.6
 
 End Snap:      4    11-10-06 22:32:02      13       4.9
 
   Elapsed:                                4.97 (mins)
 
Cache Sizes (end)
~~~~~~~~~~~~~~~~~
               Buffer Cache:        88M       Std Block Size:      8K
            Shared Pool Size:        48M          Log Buffer:      512K
 
2、负载间档该部分提供每秒和每个事物的统计信息,是监控系统吞吐量和负载变化的重要部分
 
Load Profile
~~~~~~~~~~~~                            Per Second       Per Transaction
                                          ---------------       ---------------
                  Redo size:              2,184.89            217,032.00
               Logical reads:                 31.99              3,178.00
              Block changes:                 10.09              1,002.33
              Physical reads:                  0.00                  0.00
             Physical writes:                  0.07                  6.67
                 User calls:                  0.06                  6.00
                    Parses:                  0.80                 79.00
                Hard parses:                  0.02                  1.67
                     Sorts:                  0.42                 42.00
                    Logons:                  0.01                 1.33
                  Executes:                  1.56                154.67
               Transactions:                  0.01
 
 % Blocks changed per Read:   31.54    Recursive Call %:                     98.11
  Rollback per transaction %:    0.00      Rows per Sort:                    73.82
 
说明:
Redo size:每秒产生的日志大小(单位字节),可标志数据变更频率,数据库任务的繁重与否
Logical reads:平决每秒产生的逻辑读,单位是block
block changes:每秒block变化数量,数据库事物带来改变的块数量
Physical reads:平均每秒数据库从磁盘读取的block
Physical writes:平均每秒数据库写磁盘的block
User calls:每秒用户call次数
Parses: 每秒解析次数,近似反应每秒语句的执行次数,软解析每秒超过300次意味着你的"应用程序"效率不高,没有使用soft soft parse,调整session_cursor_cache
Hard parses:每秒产生的硬解析次数,每秒超过100次,就可能说明你绑定使用的不好
Sorts:每秒产生的排序次数
Executes:每秒执行次数
Transactions:每秒产生的事务数,反映数据库任务繁重与否
Recursive Call %: 如果有很多PLSQL,那么他就会比较高
Rollback per transaction %:看回滚率是不是很高,因为回滚很耗资源如果回滚过高,可能说明你的数据库经历太多的无效操作
过多的回滚可能还会带来Undo Block的竞争该参数计算公式如下:
Round(User rollbacks / (user commits + user rollbacks) ,4)* 100%
 
3、实例命中率该部分可以提前找出ORACLE潜在将要发生的性能问题,很重要
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %: 100.00      
Redo NoWait %:   100.00
           Buffer Hit   %:  100.00   
In-memory Sort %:  100.00
            Library Hit   %:   99.15       
Soft Parse %:   97.89
          Execute to Parse %:   48.92         
Latch Hit %: 100.00
Parse CPU to Parse Elapsd %:             %
Non-Parse CPU:   100.00
说明:
Buffer Nowait %:在缓冲区中获取Buffer的未等待比率, Buffer Nowait<99%说明,有可能是有热,(查找x$bh tchv$latch_childrencache buffers chains)
Redo NoWait %:Redo缓冲区获取Buffer的未等待比率
Buffer Hit %:数据块在数据缓冲区中得命中率,通常应在90%以上,否则,需要调整,小于 95%,重要的参数,小于90%可能是要加db_cache_size,但是大量的非选择的索引也会造成该值很高(大量的db file sequential read
In-memory Sort %:在内存中的排序率
Library Hit %:主要代表sql在共享区的命中率,通常在95%以上,否,需要要考虑加
大共享池,绑定变量,修改cursor_sharing等参数。
Soft Parse %:近似看作sql在共享区的命中率,小于<95%,需要考虑到绑定,如果低于80%
那么就可能sql基本没有被重用
Execute to Parse %:sql语句解析后被重复执行的次数,如果过低,可以考虑设置 session_cached_cursors参数,公式为100 * (1 - Parses/Executions) = Execute to Parse所以如果系统Parses > Executions,就可能出现该比小于0的情况,该值<0通常说明shared pool设置或效存在问题造成反复解析,reparse可能较严重,或者可是同snapshot有关如果该值为负值或者极低,通常说明数据库性能存在问题
Latch Hit %: Latch Hit<99%,要确保>99%,否则存在严重的性能问题,比如绑定等会影响该参数
Parse CPU to Parse Elapsd %:解析实际运行事件/(解析实际运行时间+解析中等待资源时间)
越高越好
% Non-Parse CPU:查询实际运行时间/(查询实际运行时间+sql解析时间),太低表示解析消耗时间过多。100*parse time cpu / parse time elapsed= Parse CPU to Parse Elapsd %
 
Shared Pool Statistics          Begin   End
                               ------ ------
       Memory Usage %:     63.65   63.75
 % SQL with executions>1:   63.73   64.12
% Memory for SQL w/exec>1:  59.93   60.33
Shared Pool相关统计数据
Memory Usage %:共享池内存使用率,应该稳定在70%-90%间,太小浪费内存,太大则内存不足。
% SQL with executions>1:执行次数大于1sql比率,若太小可能是没有使用bind variables
% Memory for SQL w/exec>1:也即是memory for sql with execution > 1:执行次数大于1sql消耗内存/所有sql消耗的内存
 
参考信息http://ocp8i.itpub.net/post/89/7646
 
4首要的5个等待事件(Top 5 wait events),是整个报告中最能反映问题的一部分
运行statspack期间必须session上设置TIMED_STATISTICS = TRUE.(推荐)
常见的等待事件以及可能的解决方法
1.     DB File Scattered Read –-通常与全表扫描有关,需要确认是否真的需要全表扫描,能否改用索引或者把把较小的表整个的放入内存缓冲区中,避免反复磁盘读取
2.      DB File Sequential Read –表明有很多索引读,需要你调整代码,特别是表连接部分,适当的调整DB_CACHE_SIZE的值
3.      Free Buffer –没有可用的内存缓冲区而等待,增大DB_CACHE_SIZE,加速检查点和调整代码
4.      Buffer Busy Wait -–段头出现问题,增加freelists或者freelist maxtrans
--数据块问题,分离‘热点’数据,采用反向关键字索引,采用小的数据块,增大initransmaxtrans
--undo header问题,增加回滚段
--undo block问题,增加提交频率,增大回滚段
5.      Latch Free
--library Cache问题,使用绑定变量,调整shared_pool_size
--shared pool问题,使用绑定变量,调整shared_pool_size
--redo Allocation,,最小化redo生成并避免不必要的提交
--redo Copy, 增大_log_simultaneous_copies
--Row Cache Object,增大共享池
--Cache Buffers Chain,_Db_block_Hash_Buckers应被增大或变为质数
--Cache Buffers LRU Chain,设置DB_BLOCK_LRU_LACHES或者使用多个缓冲区池
6.       Enqueue –ST --使用本地表空间或者预先分配大扩展
7.       Enqueue –HW 预先分配扩展与高水位线之上
8.       Enqueue –TX4 增大表或者索引的initransmaxtrans
9.       Enqueue –TM 为外键建立索引,查看应用程序的表锁
10.    Log Buffer Space 增大日志缓冲区,重做日志放在快速磁盘上
11.    Log File Switch    归档设备太慢或者太满,增加或者扩大重做日志
12.    Log File Sync     每次提交更多记录,更快的存放重做日志的磁盘,裸设备
13.    idle event     其他的一些等待事件可以忽略
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~                                                   % Total
Event                                               Waits    Time (s)   Ela Time
-------------------------------------------- ------------ ----------- --------
CPU time                                                            0    52.79
control file parallel write                                  97           0    26.72
control file sequential read                                52           0    11.55
log file parallel write                                     113           0     6.99
log file sync                                              1           0      .96
          -------------------------------------------------------------
 
 
5等待事件(Wait events)的具体数据
Wait Events for DB: COLM Instance: colm Snaps: 3 -4
-> s - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc (idle events last)
 
                                                                 Avg
                                                     Total Wait   wait    Waits
Event                               Waits   Timeouts   Time (s)   (ms)     /txn
---------------------------- ------------ ---------- ---------- ------ --------
control file parallel write              97          0          0      2     32.3
control file sequential read           52          0          0      2     17.3
log file parallel write                113        102          0      0     37.7
log file sync                         1          0          0      7      0.3
db file parallel write                 12          6          0      1      4.0
SQL*Net break/reset to clien          2          0          0      0      0.7
virtual circuit status                 10         10        300 30005      3.3
SQL*Net message from client         4          0        278 69450      1.3
wakeup time manager                9          9        277 30732      3.0
jobq slave wait                      66         63        202   3060     22.0
SQL*Net message to client             4          0          0      0      1.3
          -------------------------------------------------------------
 
Background Wait Events for DB: COLM Instance: colm Snaps: 3 -4
-> ordered by wait time desc, waits desc (idle events last)
 
                                                                 Avg
                                                     Total Wait   wait    Waits
Event                            Waits   Timeouts   Time (s)   (ms)     /txn
---------------------------- ------------ ---------- ---------- ------ --------
control file parallel write            97          0          0      2     32.3
log file parallel write               113        102          0      0     37.7
db file parallel write                12          6          0      1      4.0
rdbms ipc message                560        461      3,036   5422    186.7
smon timer                         1          1        307 ######      0.3
          -------------------------------------------------------------
 
 
6.SQL语句
SQL ordered by Gets for DB: COLM Instance: colm Snaps: 3 -4
-> End Buffer Gets Threshold:   10000
-> Note that resources reported for PL/SQL includes the resources used by
   all SQL statements called within the PL/SQL code. As individual SQL
   statements are also reported, it is possible and valid for the summed
   total % to exceed 100
 
                                                          CPU      Elapsd
 Buffer Gets    Executions Gets per Exec %Total Time (s) Time (s) Hash Value
--------------- ------------ -------------- ------ -------- --------- ----------
    3,753            9          417.0   39.4     0.11      0.20 238087931
select t.schema, t.name, t.flags, q.name from system.aq$_queue_t
ables t, sys.aq$_queue_table_affinities aft,      system.aq$_que
ues q where aft.table_objno = t.objno and aft.owner_instance = :
1 and        q.table_objno = t.objno and q.usage = 0 and       b
itand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft
 
。。。。。。。。。。。。
 
7.实例活动(Instance activity)
Instance Activity Stats for DB: COLM Instance: colm Snaps: 3 -4
 
Statistic                                      Total     per Second    per Trans
--------------------------------- ------------------ -------------- ------------
CPU used by this session                        40            0.1         13.3
CPU used when call started                      40            0.1         13.3
CR blocks created                               28            0.1          9.3
DBWR checkpoint buffers written                  20            0.1          6.7
DBWR transaction table writes                    10            0.0          3.3
DBWR undo block writes                          8            0.0          2.7
SQL*Net roundtrips to/from client                  4            0.0          1.3
active txn count during cleanout                  34            0.1         11.3
background timeouts                           350            1.2        116.7
buffer is not pinned count                      2,775            9.3        925.0
buffer is pinned count                         4,064           13.6      1,354.7
bytes received via SQL*Net from c               883            3.0        294.3
bytes sent via SQL*Net to client                  752            2.5        250.7
calls to get snapshot scn: kcmgss               2,021            6.8        673.7
calls to kcmgas                                 645            2.2        215.0
calls to kcmgcs                                   8            0.0          2.7
change write time                                 6            0.0          2.0
cleanout - number of ktugct calls                   39            0.1         13.0
cleanouts and rollbacks - consist                  18            0.1          6.0
cleanouts only - consistent read                    0            0.0          0.0
cluster key scan block gets                        11            0.0          3.7
cluster key scans                                 4            0.0          1.3
commit cleanout failures: callbac                   0            0.0          0.0
commit cleanouts                                682            2.3        227.3
commit cleanouts successfully com                682            2.3        227.3
commit txn count during cleanout                  14            0.1          4.7
consistent changes                              444            1.5        148.0
consistent gets                                7,145           24.0      2,381.7
consistent gets - examination                    1,271            4.3        423.7
cursor authentications                            23            0.1          7.7
data blocks consistent reads - un                  444            1.5        148.0
db block changes                               3,007           10.1      1,002.3
db block gets                                  2,389            8.0        796.3
deferred (CURRENT) block cleanout              415            1.4        138.3
enqueue conversions                            26            0.1          8.7
enqueue releases                             1,517            5.1        505.7
enqueue requests                             1,524            5.1        508.0
execute count                                 464            1.6        154.7
free buffer requested                            291            1.0         97.0
immediate (CR) block cleanout app                 18            0.1          6.0
immediate (CURRENT) block cleanou              24            0.1          8.0
index fetch by key                               610            2.1        203.3
index scans kdiixs1                            3,670           12.3      1,223.3
leaf node 90-10 splits                             0            0.0          0.0
leaf node splits                                  10            0.0          3.3
logons cumulative                               4            0.0          1.3
messages received                            113            0.4         37.7
messages sent                                113            0.4         37.7
no buffer to keep pinned count                     0            0.0          0.0
no work - consistent read gets                 1,565            5.3        521.7
opened cursors cumulative                      237            0.8         79.0
parse count (hard)                               5            0.0          1.7
parse count (total)                              237            0.8         79.0
parse time cpu                                   0            0.0          0.0
parse time elapsed                               0            0.0          0.0
physical reads                                   0            0.0          0.0
 
Instance Activity Stats for DB: COLM Instance: colm Snaps: 3 -4
 
Statistic                                      Total     per Second    per Trans
--------------------------------- ------------------ -------------- ------------
physical reads direct                              0            0.0          0.0
physical writes                                   20            0.1          6.7
physical writes direct                             0            0.0          0.0
physical writes non checkpoint                     8            0.0          2.7
prefetched blocks                                0            0.0          0.0
process last non-idle time             1,160,577,119    3,894,554.1 ############
recursive calls                                  935            3.1        311.7
recursive cpu usage                               37            0.1         12.3
redo blocks written                            1,355            4.6        451.7
redo entries                                   1,547            5.2        515.7
redo size                                    651,096        2,184.9    217,032.0
redo synch time                                    0            0.0          0.0
redo synch writes                                  1            0.0          0.3
redo wastage                                19,312           64.8      6,437.3
redo write time                                   27            0.1          9.0
redo writer latching time                            0            0.0          0.0
redo writes                                      113            0.4         37.7
rollback changes - undo records a                  0            0.0          0.0
rollbacks only - consistent read                     46            0.2         15.3
rows fetched via callback                         602            2.0        200.7
session connect time                   1,160,577,119    3,894,554.1 ############
session logical reads                          9,534           32.0      3,178.0
session uga memory                         46,048          154.5     15,349.3
session uga memory max                    438,768        1,472.4    146,256.0
shared hash latch upgrades - no w              3,718           12.5      1,239.3
sorts (memory)                                 126            0.4         42.0
sorts (rows)                                   9,301           31.2      3,100.3
switch current to new buffer                     198            0.7         66.0
table fetch by rowid                             868            2.9        289.3
table fetch continued row                          0            0.0          0.0
table scan blocks gotten                       1,404            4.7        468.0
table scan rows gotten                         6,145           20.6      2,048.3
table scans (long tables)                          2            0.0          0.7
table scans (short tables)                       249            0.8         83.0
user calls                                        18            0.1          6.0
user commits                                     3            0.0          1.0
workarea executions - optimal                     89            0.3         29.7
          -------------------------------------------------------------
 
7.表空间IO
Tablespace IO Stats for DB: COLM Instance: colm Snaps: 3 -4
->ordered by IOs (Reads + Writes) desc
 
Tablespace
------------------------------
                 Av      Av     Av                    Av        Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
UNDOTBS1
             0       0    0.0                   18        0          0    0.0
SYSTEM
             0       0    0.0                    2        0          0    0.0
          -------------------------------------------------------------
 
 
8文件I/O(File I/O)
File IO Stats for DB: COLM Instance: colm Snaps: 3 -4
->ordered by Tablespace, File
 
Tablespace               Filename
------------------------ ----------------------------------------------------
                 Av      Av     Av                    Av        Buffer Av Buf
         Reads Reads/s Rd(ms) Blks/Rd       Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
SYSTEM                   C:/ORACLE/ORADATA/COLM/SYSTEM01.DBF
             0      0            2                  0          0
UNDOTBS1                 C:/ORACLE/ORADATA/COLM/UNDOTBS01.DBF
             0       0           18                  0          0
          -------------------------------------------------------------
 
--其余的一些收集信息
9.Buffer Pool Statistics for DB
10.Instance Recovery Stats for DB
11.Buffer Pool Advisory for DB
12.PGA Aggr Target Stats for DB
13.Rollback Segment Stats for DB
14.Rollback Segment Storage for DB
15.Latch Activity for DB --比较重要的信息
16.Dictionary Cache Stats for DB
17.Shared Pool Advisory for DB
Shared Pool Advisory for DB: COLM Instance: colm End Snap: 4
-> 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
 
                                                          Estd
Shared Pool    SP       Estd         Estd     Estd Lib LC Time
   Size for Size Lib Cache    Lib Cache   Cache Time   Saved Estd Lib Cache
 Estim (M) Factr   Size (M)      Mem Obj    Saved (s)   Factr    Mem Obj Hits
----------- ----- ---------- ------------ ------------ ------- ---------------
         24    .5         20        4,917          766     1.0          41,101
         32    .7         20        4,917          766     1.0          41,101
         40    .8         20        4,917          766     1.0          41,101
         48   1.0         20        4,917          766     1.0          41,101
         56   1.2         20        4,917          766     1.0          41,101
         64   1.3         20        4,917          766     1.0          41,101
         72   1.5         20        4,917          766     1.0          41,101
         80   1.7         20        4,917          766     1.0          41,101
         88   1.8         20        4,917          766     1.0          41,101
         96   2.0         20        4,917          766     1.0          41,101
          -------------------------------------------------------------
18.SGA Memory Summary for DB
SGA Memory Summary for DB: COLM Instance: colm Snaps: 3 -4
 
SGA regions                       Size in Bytes
------------------------------ ----------------
Database Buffers                     92,274,688
Fixed Size                              453,352
Redo Buffers                            667,648
Variable Size                       117,440,512
                               ----------------
sum                                 210,836,200
          -------------------------------------------------------------
19.init.ora Parameters for DB
init.ora Parameters for DB: COLM Instance: colm Snaps: 3 -4
 
                                                                  End value
Parameter Name                Begin value                       (if different)
----------------------------- --------------------------------- --------------
aq_tm_processes               1
background_dump_dest          C:/oracle/admin/COLM/bdump
compatible                    9.2.0.0.0
control_files                 C:/oracle/oradata/COLM/CONTROL01.
core_dump_dest                C:/oracle/admin/COLM/cdump
db_block_size                 8192
db_cache_advice               ON
db_cache_size                 83886080
db_domain
db_file_multiblock_read_count 32
db_keep_cache_size            8388608
db_name                       COLM
dispatchers                   (PROTOCOL=TCP) (SERVICE=COLMXDB)
fast_start_mttr_target        0
hash_area_size                1048576
hash_join_enabled             TRUE
instance_name                 COLM
java_pool_size                33554432
job_queue_processes           6
large_pool_size               8388608
open_cursors                  300
pga_aggregate_target          33554432
processes                     150
query_rewrite_enabled         TRUE
remote_login_passwordfile     EXCLUSIVE
sga_max_size                  210836200
shared_pool_size              50331648
sort_area_size                1048576
star_transformation_enabled   TRUE
timed_statistics              TRUE
undo_management               AUTO
undo_retention                10800
undo_tablespace               UNDOTBS1
user_dump_dest                C:/oracle/admin/COLM/udump
          -------------------------------------------------------------


转自:http://blog.csdn.net/huanghui22/article/details/1333851

原创粉丝点击