ablog

不器用で落着きのない技術者のメモ

AWRレポートを一括出力する

set pages 0
spool awr_tmp.sql
 select 
 'define report_type=html' || chr(10) ||
 'define dbid=2144341034' || chr(10) ||
 'define inst_num=1' || chr(10) ||
 'define num_days=40' || chr(10) ||
 'define begin_snap='  || SNAP_ID      || chr(10) ||
 'define end_snap='    || (SNAP_ID + 1)|| chr(10) ||
 'define report_name=' || SNAP_ID || '_' || (SNAP_ID + 1) || '.html'  ||
 chr(10) ||
 '@?/rdbms/admin/awrrpti.sql' || chr(10)
 from sys.dba_hist_snapshot
 where dbid = 2144341034
 order by snap_id;
spool off
@awr_tmp.sql