学无止境
分类: Oracle
2014-04-17 15:07:55
set linesize 200
set term off verify off feedback off pagesize 999
rem set markup html on entmap ON spool on preformat off
set trims on;
COLUMN instname NEW_VALUE _instname NOPRINT
select instance_name instname from v$instance;
COLUMN indextime NEW_VALUE _indextime NOPRINT
select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') indextime from dual;
COLUMN rname NEW_VALUE _rname NOPRINT
select instance_name||'_awr_' rname from v$instance;
set heading on
set markup html on spool on preformat off entmap on -
head "
" -
body "BGCOLOR='#0066CC'" -
table "WIDTH='600px' BORDER='1' id='tab1'"
spool /check/awr/index.html
set markup html on entmap off
prompt Report of &_instname. instance
the lastest report is generated at &_indextime. by liaody
select
snap_id,
'&_rname.'||to_char(end_interval_time,'yyyymmdd_hh24mi')||'.html ' report,
to_char(begin_interval_time,'YYYY-MM-DD HH24:MI') begin_time ,
to_char(end_interval_time,'YYYY-MM-DD HH24:MI') end_time
from
(
select * from dba_hist_snapshot
order by snap_id desc
)
where rownum<=24;
prompt End of Report
prompt
spool off
SET MARKUP HTML OFF
SET TERMOUT ON
prompt
EXIT;