8i부터 사용하던 Statspack과 10g 이후 사용하게 된 AWR(Automatic Workload repository)도 주기적으로 동적 성능 뷰를 수집하여 표준화된 방식으로 성능관리를 지원하려고 오라클이 제공하는 패키지로서 이들 패키지는 Ratio기반 성능진단과 Wait Event 기반 성능진단 방법론을 둘 다 가지고 있으며 아래 동적 성능 뷰(Dynamic Performance View)를 주기적으로 특정 Repository에 저장하고, 이를 분석해 오라클 데이터베이스 전반의 건강 상태를 체크하고 병목원인과 튜닝 대상을 식별해 내는 데 사용할 수 있음
SQL>@?/rdbms/admin/awrrpt <--- AWR
SQL>@?/rdbms/admin/spreport <--- Statspack
select to_char(min(s.begin_interval_time), 'hh24:mi') begin
,to_char(min(s.end_interval_time),'hh24:mi') end
,sum(b.value-a.value) "execute count"
from dba_hist_sysstat a, dba_hist_sysstat b, dba_hist_snapshot s
where s.instance_number = &instance_number
and s.snap_id between &gegin_snap and &end_snap
and a.stat_name = 'execute count'
and b.stat_id = a.stat_id
and b.snap_id = s.snap_id
and a.snap_id = b.snap_id - 1
and a.instance_number = s.instance_number
group by s.snap_id
order by s.snap_id;
Statspack과 AWR 리포트에 맨 첫 장을 보면 오라클 데이터베이스의 상태를 한눈에 파악해 볼 수 있는 요약보고서가 나오며, 그 한장의 보고서를 정확히 해석할수만 있다면 AWR을 효과적으로 활용할 수 있음
Load Profile
~~~~~~~~~~~~ Per Second Per Transaction
--------------- ---------------
Redo size: 750,167.58 5,155.22
Logical reads: 159,411.54 1,095.49
Block changes: 4,078.04 28.02
Physical reads: 5,464.77 37.55
Physical writes: 259.31 1.78
User calls: 12,031.58 82.68
Parses: 206.10 1.42
Hard parses: 40.98 0.28
Sorts: 156.75 1.08
Logons: 1.16 0.01
Executes: 12,943.28 88.95
Transactions: 145.52
% Blocks changed per Read: 2.56 Recursive Call %: 15.96
Rollback per transaction %: 0.77 Rows per Sort: 230.08
AWR에서 보여지는 항목들을 v$sysstat 뷰를 이용한 SQL
select value rsiz from v$sysstat where name = 'redo size';
select value gets from v$sysstat where name = 'session logical reads';
select value chng from v$sysstat where name = 'db block changes';
select value phyr from v$sysstat where name = 'physical reads';
select value phyw from v$sysstat where name = 'physical writes';
select value ucal from v$sysstat where name = 'user calls';
select value prse from v$sysstat where name = 'parse count (total)';
select value hprse from v$sysstat where name = 'parse count (hard)';
select srtm + srtd from
(select value srtm from v$sysstat where name = 'sorts (memory)' ),
(select value srtd from v$sysstat where name = 'sorts (disk)' );
select value logc from v$sysstat where name = 'logons cumulative';
select value exe from v$sysstat where name = 'execute count';
select ucom + urol from
(select value ucom from v$sysstat where name = 'user calls'),
(select value urol from v$sysstat where name = 'user rollbacks');
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Buffer Nowait %: 99.98 Redo NoWait %: 100.00
Buffer Hit %: 96.58 In-memory Sort %: 100.00
Library Hit %: 102.27 Soft Parse %: 80.12
Execute to Parse %: 98.41 Latch Hit %: 96.77
Parse CPU to Parse Elapsd %: 26.59 % Non-Parse CPU: 98.40
Shared Pool Statistics Begin End
------ ------
Memory Usage %: 94.83 93.37
% SQL with executions>1: 6.04 2.94
% Memory for SQL w/exec>1: 8.40 8.53
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~ % Total
Event Waits Time (s) Ela Time
-------------------------------------------- ------------ ----------- --------
latch free 58,155,054 191,025 48.97
db file sequential read 14,810,436 86,675 22.22
wait list latch free 4,008,189 62,555 16.04
CPU time 36,631 9.39
db file scattered read 2,709,204 3,985 1.02
Response Time = Service Time + Wait Time
= CPU Time + Queue Time