日期:2014-05-16  浏览次数:20749 次

检查REDO日志相关信息并生成HTML文件的脚本

生成HTML格式的文件

内容有:

检查数据库版本、REDO日志组情况,

最近20次日志切换频率检查--日志间的归档时间间隔, 这对查看数据库的IO繁忙时段

统计指定日期当天每小时的归档日志产生量--日期通过手动修改脚本中日期实现

统计最近10天每天的归档日志产生量

脚本如下:

prompt Creating database report.
prompt This script must be run as a user with DBA privileges.
prompt This process can take several minutes to complete.
prompt need Specified date in---------archive log_MB in day
prompt

-- +----------------------------------------+
-- |                           SCRIPT SETTINGS                                  |
-- +----------------------------------------+
set termout       off
set echo          off
set feedback      off
set heading       off
set verify        off
set wrap          on
set trimspool     on
set serveroutput  on
set escape        on
set timing        off
set pagesize 50000
set linesize 175
set long     2000000000
clear buffer computes columns breaks
define fileName=redolog_check
define versionNumber=5.3

COLUMN spool_time NEW_VALUE _spool_time NOPRINT
SELECT TO_CHAR(SYSDATE,'YYYYMMDDhh24miss') spool_time FROM dual;

COLUMN dbname NEW_VALUE _dbname NOPRINT
SELECT name dbname FROM v$database;

set heading on
set markup html on spool on preformat off entmap on -

spool &FileName._&_dbname._&_spool_time..html
set markup html on entmap off

-- +----------------------------------------+
-- |                                 - VERSION -                                |
-- +----------------------------------------+

prompt <a name="version"></a>
prompt <font size="+2" face="Arial,Helvetica,Geneva,sans-serif" color="#336699"><b>Version</b></font><hr align="left" width="460">

CLEAR COLUMNS BREAKS COMPUTES

COLUMN banner   FORMAT a120   HEADING 'Banner'

SELECT * FROM v$version;

prompt <center>[<a class="noLink" href="#top">Top</a>]</center><p>

-- +----------------------------------------+
-- |                          - ONLINE REDO LOGS -                              |
-- +----------------------------------------+

prompt <a name="online_redo_logs"></a>
prompt <font size="+2" face="Arial,Helvetica,Geneva,sans-serif" color="#336699"><b>Online Redo Logs</b></font><