AWRのload profileをcsv形式で出力するためのスクリプト例です。
get_load_profile.sql
set termout off
set pagesize 0
set linesize 10000
set trimspool on
set heading off
spool load_profile.log
prompt begin_snapid,yyyy,mm,dd,hh,end_snapid,instance_num,name,value
select '"' ||
bsn.SNAP_ID || '","' ||
to_char(bsn.END_INTERVAL_TIME,'yyyy') || '","' ||
to_char(bsn.END_INTERVAL_TIME,'mm') || '","' ||
to_char(bsn.END_INTERVAL_TIME,'dd') || '","' ||
to_char(bsn.END_INTERVAL_TIME,'hh24') || '","' ||
esn.SNAP_ID || '","' ||
bsn.INSTANCE_NUMBER || '","' ||
bsy.STAT_NAME || '","' ||
(esy.VALUE - bsy.VALUE) || '"'
from
DBA_HIST_SNAPSHOT bsn,
DBA_HIST_SNAPSHOT esn,
DBA_HIST_SYSSTAT bsy,
DBA_HIST_SYSSTAT esy
where
bsn.DBID = esn.DBID
and bsn.INSTANCE_NUMBER = esn.INSTANCE_NUMBER
and bsn.END_INTERVAL_TIME = esn.BEGIN_INTERVAL_TIME
and bsn.STARTUP_TIME = esn.STARTUP_TIME
and bsn.DBID = bsy.DBID
and bsn.INSTANCE_NUMBER = bsy.INSTANCE_NUMBER
and bsn.SNAP_ID = bsy.SNAP_ID
and esn.DBID = esy.DBID
and esn.INSTANCE_NUMBER = esy.INSTANCE_NUMBER
and esn.SNAP_ID = esy.SNAP_ID
and bsy.STAT_NAME = esy.STAT_NAME
and bsy.STAT_NAME in ('execute count','parse count (hard)','consistent gets',
'physical reads','redo size')
and bsn.END_INTERVAL_TIME >= to_date('2016/04/05 09:50','yyyy/mm/dd hh24:mi')
and esn.END_INTERVAL_TIME <= to_date('2016/04/08 13:10','yyyy/mm/dd hh24:mi')
order by bsn.SNAP_ID;
spool off
/
出力されたデータをexcelに取り込み、
ピボットグラフを活用することで容易に可視化できます。
グラフ化することで複数期間にわたる傾向分析が容易にできます。
(SQLはDB12.1.0.2にて試行)