13.Oracle之AWR报告
AWR报告是对Oracle的性能分析的常用的手段。。。
0.什么是AWR
Automatic workload repository(awr) is a repository of historical performance data that includes cumulative statistics for the system, sessions, individual SQL statements, segments, and services.
As shown in the following graphic, the database stores recent AWR statistics in the SGA. By default, the MMON process gathers statistics every hour and creates an AWR snapshot. An AWR snapshot is a set of performance statistics captured at a specific time. The database writes snapshots to the SYSAUX tablespace. AWR manages snapshot space, purging older snapshots according to a configurable snapshot retention policy.

这些快照信息都会被存在DBA_HIST_SNAPSHOT表中。
因为awr报告基本上是每小时会产生一次(默认),生成一个快照,如果想要调整这个时间间隔,可以使用如下的存储过程来修改
BEGIN DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention => 43200, interval => 30, topnsql => 100, dbid => 3310949047); END; /
retention :快照的保护期,单位是分钟
interval:生成快照的间隔,单位是分钟
SQL> select snap_interval, retention from DBA_HIST_WR_CONTROL; SNAP_INTERVAL RETENTION --------------------------------------- +00000 01:00:00.0 +00008 00:00:00.0 快照默认保留8天
通过上图就能看到这个策略
2. 创建一个基线
为什么要创建一个基线呢,因为基线是一个Oracle性能指标的一个标准,一般代表着Oracle最好的(最稳定)的一个状态,假如oracle出现了不稳定,我们可以打一个awr报告,然后和该基线(awr)对对比,这样就能判断是某些指标是高了还是正常的。
3. 怎样生成AWR报告

然后按照需求打印那个时间段的,
awr中的各个指标具体见:https://www.modb.pro/doc/28288
浙公网安备 33010602011771号