您好,欢迎访问一九零五行业门户网

oracle系统统计信息

欢迎进入oracle社区论坛,与200万技术人员互动交流 >>进入 系统统计信息主要描述了与系统硬件相关的某些特性,例如cpu和io系统的性能和利用率等。这些信息对于查询优化器来说是非常重要的,在选择执行计划的过程中,oracle优化器会利用系统统计信息来评估执
欢迎进入oracle社区论坛,与200万技术人员互动交流 >>进入
系统统计信息主要描述了与系统硬件相关的某些特性,例如cpu和io系统的性能和利用率等。这些信息对于查询优化器来说是非常重要的,在选择执行计划的过程中,oracle优化器会利用系统统计信息来评估执行计划的成本,因此,准确无误的系统统计信息可以帮助优化器做出正确的选择。
我们可以通过dbms_stats.gather_system_stats过程来收集系统统计信息,收集的方式有两种:负载统计(workload statistics)在具有真实系统负载的数据库系统上,收集某一时间段内的系统信息;非负载统计(noworkload statistics)oracle数据库基于某种方式(如持续读磁盘)模拟系统负载来获取系统统计信息。
通各方资料和oracle官方文档中可以看出,我们最好采用系统负载的方式来收集系统统计信息,收集的时间间隔至少要30分钟,条件允许的情况下,最好多次收集,择优使用。处理使用dbms_stats.gather_system_stats来收集系统统计信息,我们也可以手工设定某些信息选项,这一点在后面会有示例。
oracle的系统统计信息最终是存储在aux_stats$数据基表中的,首先来看一下该表的结构:
sql> desc aux_stats$
名称 是否为空? 类型
----------------------------- -------- --------------------
sname not null varchar2(30)
pname not null varchar2(30)
pval1 number
pval2 varchar2(255)
aux_stats$表中存储的数据量是非常有限的,如
sql> select * from aux_stats$;
sname pname pval1 pval2
-------------------- -------------------- ---------- ------------------------------
sysstats_info status completed
sysstats_info dstart 09-17-2011 10:21
sysstats_info dstop 09-17-2011 10:21
sysstats_info flags 1
sysstats_main cpuspeednw 1751.75879
sysstats_main ioseektim 10
sysstats_main iotfrspeed 4096
sysstats_main sreadtim
sysstats_main mreadtim
sysstats_main cpuspeed
sysstats_main mbrc
sname pname pval1 pval2
-------------------- -------------------- ---------- ------------------------------
sysstats_main maxthr
sysstats_main slavethr
已选择13行。
sname字段的取值有:sysstats_info,sysstats_main,sysstats_temp
sysstats_info:系统统计信息的状态
sysstats_main:系统统计信息的内容
sysstats_temp:在收集系统统计信息期间,用于临时存放中间数据
对于pname字段的含义,oracle官方文档给出了详细的解释:
parameter namedescriptioninitializationoptions for gathering or setting statisticsunit
cpuspeednwrepresents noworkload cpu speed. cpu speed is the average number of cpu cycles in each second. cpu速率at system startupset gathering_mode = noworkload or set statistics manually.millions/sec.
ioseektimi/o seek time equals seek time + latency time + operating system overhead time. 寻道时间at system startup
10 (default)set gathering_mode = noworkload or set statistics manually.ms
iotfrspeedi/o transfer speed is the rate at which an oracle database can read data in the single read request. 数据传输速率at system startup
4096 (default)set gathering_mode = noworkload or set statistics manually.bytes/ms
cpuspeedrepresents workload cpu speed. cpu speed is the average number of cpu cycles in each second. cpu速率noneset gathering_mode = noworkload, interval, orstart|stop, or set statistics manually.millions/sec.
[1] [2]
其它类似信息

推荐信息