cat awr.sql ######EXEC P_AWR_REPORT('201604251000', '201604251100', 'D_OUTPUT', '', FALSE); FALSE为rac生成awr
EXEC P_AWR_REPORT('201604251000', '201604251100', 'D_OUTPUT', '', FALSE);
CREATE DIRECTORY D_OUTPUT AS '/oracle/products/11.2/db/scripts/mon/log';
CREATE DIRECTORY D_OUTPUT AS '/oracle/db/scripts/mon/log';
############sqlplus下新建DIRECTORY后在sqlplus下执行一下存储过程执行完毕后执行EXEC P_AWR_REPORT('201604251000', '201604251100', 'D_OUTPUT', '', FALSE);测试####################
CREATE OR REPLACE PROCEDURE P_AWR_REPORT (
P_BEGIN IN VARCHAR2,
P_END IN VARCHAR2,
P_DIR IN VARCHAR2,
P_DBNAME IN VARCHAR2 DEFAULT '',
P_PERINTERVAL IN BOOLEAN DEFAULT FALSE) AS
TYPE T_VARCHAR IS TABLE OF VARCHAR2(1500 CHAR) INDEX BY BINARY_INTEGER;
V_REPORT T_VARCHAR;
V_FILE UTL_FILE.FILE_TYPE;
TYPE T_NUM IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
TYPE T_DATE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
V_INSTANCE T_NUM;
V_SNAP_BEG T_NUM;
V_SNAP_END T_NUM;
V_BEGIN_DATE T_DATE;
V_END_DATE T_DATE;
V_BEGIN NUMBER;
V_END NUMBER;
V_DBID NUMBER;
V_DBNAME V$DATABASE.NAME%TYPE;
BEGIN
IF P_DBNAME IS NOT NULL THEN
SELECT DISTINCT DBID, DB_NAME
INTO V_DBID, V_DBNAME
FROM DBA_HIST_DATABASE_INSTANCE
WHERE DB_NAME = P_DBNAME;
ELSE
SELECT DBID, NAME
INTO V_DBID, V_DBNAME
FROM V$DATABASE;
END IF;
SELECT DISTINCT INSTANCE_NUMBER,
FIRST_VALUE(SNAP_ID) OVER(PARTITION BY INSTANCE_NUMBER ORDER BY ABS(CAST (END_INTERVAL_TIME AS DATE) - TO_DATE(P_BEGIN, 'YYYYMMDDHH24MISS'))),
FIRST_VALUE(END_INTERVAL_TIME) OVER(PARTITION BY INSTANCE_NUMBER ORDER BY ABS(CAST (END_INTERVAL_TIME AS DATE) - TO_DATE(P_BEGIN, 'YYYYMMDDHH24MISS')))
BULK COLLECT INTO V_INSTANCE, V_SNAP_BEG, V_BEGIN_DATE
FROM DBA_HIST_SNAPSHOT
WHERE DBID = V_DBID
ORDER BY INSTANCE_NUMBER;
FOR I IN V_INSTANCE.FIRST..V_INSTANCE.LAST LOOP
BEGIN
SELECT DISTINCT FIRST_VALUE(SNAP_ID) OVER(ORDER BY ABS(CAST (END_INTERVAL_TIME AS DATE) - TO_DATE(P_END, 'YYYYMMDDHH24MISS'))),
FIRST_VALUE(END_INTERVAL_TIME) OVER(ORDER BY ABS(CAST (END_INTERVAL_TIME AS DATE) - TO_DATE(P_END, 'YYYYMMDDHH24MISS')))
INTO V_SNAP_END(I), V_END_DATE(I)
FROM DBA_HIST_SNAPSHOT
WHERE SNAP_ID > V_SNAP_BEG(I)
AND DBID = V_DBID
AND INSTANCE_NUMBER = V_INSTANCE(I);
EXCEPTION
WHEN NO_DATA_FOUND THEN
V_INSTANCE.DELETE(I);
END;
END LOOP;
IF V_INSTANCE.COUNT = 1
THEN
V_BEGIN := V_SNAP_BEG(1);
IF P_PERINTERVAL = FALSE
THEN
V_END := V_SNAP_END(1);
ELSE
V_END := V_SNAP_BEG(1) + 1;
SELECT END_INTERVAL_TIME
INTO V_END_DATE(1)
FROM DBA_HIST_SNAPSHOT
WHERE DBID = V_DBID
AND INSTANCE_NUMBER = 1
AND SNAP_ID = V_END;
END IF;
WHILE(V_END <= V_SNAP_END(1)) LOOP
V_FILE := UTL_FILE.FOPEN(
P_DIR,
'awrrpt_' || V_DBNAME || '_' || V_INSTANCE(1) || '_'
|| TO_CHAR(V_BEGIN_DATE(1), 'YYYYMMDDHH24MI') || '_'
|| TO_CHAR(V_END_DATE(1), 'YYYYMMDDHH24MI') || '.html',
'w',
32767);
SELECT OUTPUT
BULK COLLECT INTO V_REPORT
FROM TABLE(
DBMS_WORKLOAD_REPOSITORY.AWR_REPORT_HTML(
V_DBID,
V_INSTANCE(1),
V_BEGIN,
V_END,
0));
FOR I IN 1..V_REPORT.COUNT LOOP
UTL_FILE.PUT_LINE(V_FILE, V_REPORT(I));
END LOOP;
UTL_FILE.FCLOSE(V_FILE);
V_BEGIN := V_BEGIN + 1;
V_END := V_END + 1;
V_BEGIN_DATE(1) := V_END_DATE(1);
SELECT END_INTERVAL_TIME
INTO V_END_DATE(1)
FROM DBA_HIST_SNAPSHOT
WHERE DBID = V_DBID
AND INSTANCE_NUMBER = 1
AND SNAP_ID = V_END;
END LOOP;
ELSE
FOR I IN V_INSTANCE.FIRST..V_INSTANCE.LAST LOOP
V_BEGIN := V_SNAP_BEG(I);
IF P_PERINTERVAL = FALSE
THEN
V_END := V_SNAP_END(I);
ELSE
V_END := V_SNAP_BEG(I) + 1;
SELECT END_INTERVAL_TIME
INTO V_END_DATE(I)
FROM DBA_HIST_SNAPSHOT
WHERE DBID = V_DBID
AND INSTANCE_NUMBER = V_INSTANCE(I)
AND SNAP_ID = V_END;
END IF;
WHILE(V_END <= V_SNAP_END(I)) LOOP
V_FILE := UTL_FILE.FOPEN(
P_DIR,
'awrrpt_' || V_DBNAME || '_' || V_INSTANCE(I) || '_'
|| TO_CHAR(V_BEGIN_DATE(I), 'YYYYMMDDHH24MI') || '_'
|| TO_CHAR(V_END_DATE(I), 'YYYYMMDDHH24MI') || '.html',
'w',
32767);
SELECT OUTPUT
BULK COLLECT INTO V_REPORT
FROM TABLE(
DBMS_WORKLOAD_REPOSITORY.AWR_REPORT_HTML(
V_DBID,
V_INSTANCE(I),
V_BEGIN,
V_END,
0));
FOR I IN 1..V_REPORT.COUNT LOOP
UTL_FILE.PUT_LINE(V_FILE, V_REPORT(I));
END LOOP;
UTL_FILE.FCLOSE(V_FILE);
V_BEGIN := V_BEGIN + 1;
V_END := V_END + 1;
V_BEGIN_DATE(I) := V_END_DATE(I);
SELECT END_INTERVAL_TIME
INTO V_END_DATE(I)
FROM DBA_HIST_SNAPSHOT
WHERE DBID = V_DBID
AND INSTANCE_NUMBER = V_INSTANCE(I)
AND SNAP_ID = V_END;
END LOOP;
END LOOP;
END IF;
END;
/
cat awr.sh#!/usr/bin/ksh
#. ~/.profile #AIX小机使用 linux下注释掉即可
#DATE=`date +'%Y%m%d'`
TZ=BEIST-8
DATE=`TZ=$TZ+12;date +%Y%m%d`
#一下脚本没半个小时生成一次,awr ash addm
sqlplus / as sysdba<<eof
purge dba_recyclebin;
set serveroutput on
set timing on
set time on
begin
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0000', to_char(sysdate-1,'YYYYMMDD')||'0030', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0030', to_char(sysdate-1,'YYYYMMDD')||'0100', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0100', to_char(sysdate-1,'YYYYMMDD')||'0130', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0130', to_char(sysdate-1,'YYYYMMDD')||'0200', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0200', to_char(sysdate-1,'YYYYMMDD')||'0230', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0230', to_char(sysdate-1,'YYYYMMDD')||'0300', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0300', to_char(sysdate-1,'YYYYMMDD')||'0330', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0330', to_char(sysdate-1,'YYYYMMDD')||'0400', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0400', to_char(sysdate-1,'YYYYMMDD')||'0430', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0430', to_char(sysdate-1,'YYYYMMDD')||'0500', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0500', to_char(sysdate-1,'YYYYMMDD')||'0530', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0530', to_char(sysdate-1,'YYYYMMDD')||'0600', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0600', to_char(sysdate-1,'YYYYMMDD')||'0630', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0630', to_char(sysdate-1,'YYYYMMDD')||'0700', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0700', to_char(sysdate-1,'YYYYMMDD')||'0730', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0730', to_char(sysdate-1,'YYYYMMDD')||'0800', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0800', to_char(sysdate-1,'YYYYMMDD')||'0830', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0830', to_char(sysdate-1,'YYYYMMDD')||'0900', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0900', to_char(sysdate-1,'YYYYMMDD')||'0930', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'0930', to_char(sysdate-1,'YYYYMMDD')||'1000', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1000', to_char(sysdate-1,'YYYYMMDD')||'1030', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1030', to_char(sysdate-1,'YYYYMMDD')||'1100', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1100', to_char(sysdate-1,'YYYYMMDD')||'1130', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1130', to_char(sysdate-1,'YYYYMMDD')||'1200', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1200', to_char(sysdate-1,'YYYYMMDD')||'1230', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1230', to_char(sysdate-1,'YYYYMMDD')||'1300', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1300', to_char(sysdate-1,'YYYYMMDD')||'1330', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1330', to_char(sysdate-1,'YYYYMMDD')||'1400', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1400', to_char(sysdate-1,'YYYYMMDD')||'1430', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1430', to_char(sysdate-1,'YYYYMMDD')||'1500', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1500', to_char(sysdate-1,'YYYYMMDD')||'1530', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1530', to_char(sysdate-1,'YYYYMMDD')||'1600', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1600', to_char(sysdate-1,'YYYYMMDD')||'1630', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1630', to_char(sysdate-1,'YYYYMMDD')||'1700', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1700', to_char(sysdate-1,'YYYYMMDD')||'1730', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1730', to_char(sysdate-1,'YYYYMMDD')||'1800', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1800', to_char(sysdate-1,'YYYYMMDD')||'1830', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1830', to_char(sysdate-1,'YYYYMMDD')||'1900', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1900', to_char(sysdate-1,'YYYYMMDD')||'1930', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'1930', to_char(sysdate-1,'YYYYMMDD')||'2000', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2000', to_char(sysdate-1,'YYYYMMDD')||'2030', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2030', to_char(sysdate-1,'YYYYMMDD')||'2100', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2100', to_char(sysdate-1,'YYYYMMDD')||'2130', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2130', to_char(sysdate-1,'YYYYMMDD')||'2200', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2200', to_char(sysdate-1,'YYYYMMDD')||'2230', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2230', to_char(sysdate-1,'YYYYMMDD')||'2300', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2300', to_char(sysdate-1,'YYYYMMDD')||'2330', 'D_OUTPUT', '', false);
p_awr_report(to_char(sysdate-1,'YYYYMMDD')||'2330', to_char(sysdate-1,'YYYYMMDD')||'0000', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0000', to_char(sysdate-1,'YYYYMMDD')||'0030', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0030', to_char(sysdate-1,'YYYYMMDD')||'0100', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0100', to_char(sysdate-1,'YYYYMMDD')||'0130', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0130', to_char(sysdate-1,'YYYYMMDD')||'0200', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0200', to_char(sysdate-1,'YYYYMMDD')||'0230', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0230', to_char(sysdate-1,'YYYYMMDD')||'0300', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0300', to_char(sysdate-1,'YYYYMMDD')||'0330', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0330', to_char(sysdate-1,'YYYYMMDD')||'0400', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0400', to_char(sysdate-1,'YYYYMMDD')||'0430', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0430', to_char(sysdate-1,'YYYYMMDD')||'0500', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0500', to_char(sysdate-1,'YYYYMMDD')||'0530', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0530', to_char(sysdate-1,'YYYYMMDD')||'0600', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0600', to_char(sysdate-1,'YYYYMMDD')||'0630', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0630', to_char(sysdate-1,'YYYYMMDD')||'0700', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0700', to_char(sysdate-1,'YYYYMMDD')||'0730', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0730', to_char(sysdate-1,'YYYYMMDD')||'0800', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0800', to_char(sysdate-1,'YYYYMMDD')||'0830', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0830', to_char(sysdate-1,'YYYYMMDD')||'0900', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0900', to_char(sysdate-1,'YYYYMMDD')||'0930', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'0930', to_char(sysdate-1,'YYYYMMDD')||'1000', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1000', to_char(sysdate-1,'YYYYMMDD')||'1030', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1030', to_char(sysdate-1,'YYYYMMDD')||'1100', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1100', to_char(sysdate-1,'YYYYMMDD')||'1130', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1130', to_char(sysdate-1,'YYYYMMDD')||'1200', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1200', to_char(sysdate-1,'YYYYMMDD')||'1230', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1230', to_char(sysdate-1,'YYYYMMDD')||'1300', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1300', to_char(sysdate-1,'YYYYMMDD')||'1330', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1330', to_char(sysdate-1,'YYYYMMDD')||'1400', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1400', to_char(sysdate-1,'YYYYMMDD')||'1430', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1430', to_char(sysdate-1,'YYYYMMDD')||'1500', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1500', to_char(sysdate-1,'YYYYMMDD')||'1530', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1530', to_char(sysdate-1,'YYYYMMDD')||'1600', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1600', to_char(sysdate-1,'YYYYMMDD')||'1630', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1630', to_char(sysdate-1,'YYYYMMDD')||'1700', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1700', to_char(sysdate-1,'YYYYMMDD')||'1730', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1730', to_char(sysdate-1,'YYYYMMDD')||'1800', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1800', to_char(sysdate-1,'YYYYMMDD')||'1830', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1830', to_char(sysdate-1,'YYYYMMDD')||'1900', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1900', to_char(sysdate-1,'YYYYMMDD')||'1930', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'1930', to_char(sysdate-1,'YYYYMMDD')||'2000', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2000', to_char(sysdate-1,'YYYYMMDD')||'2030', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2030', to_char(sysdate-1,'YYYYMMDD')||'2100', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2100', to_char(sysdate-1,'YYYYMMDD')||'2130', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2130', to_char(sysdate-1,'YYYYMMDD')||'2200', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2200', to_char(sysdate-1,'YYYYMMDD')||'2230', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2230', to_char(sysdate-1,'YYYYMMDD')||'2300', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2300', to_char(sysdate-1,'YYYYMMDD')||'2330', 'D_OUTPUT', '', false);
p_ash_report(to_char(sysdate-1,'YYYYMMDD')||'2330', to_char(sysdate-1,'YYYYMMDD')||'0000', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0000', to_char(sysdate-1,'YYYYMMDD')||'0030', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0030', to_char(sysdate-1,'YYYYMMDD')||'0100', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0100', to_char(sysdate-1,'YYYYMMDD')||'0130', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0130', to_char(sysdate-1,'YYYYMMDD')||'0200', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0200', to_char(sysdate-1,'YYYYMMDD')||'0230', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0230', to_char(sysdate-1,'YYYYMMDD')||'0300', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0300', to_char(sysdate-1,'YYYYMMDD')||'0330', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0330', to_char(sysdate-1,'YYYYMMDD')||'0400', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0400', to_char(sysdate-1,'YYYYMMDD')||'0430', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0430', to_char(sysdate-1,'YYYYMMDD')||'0500', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0500', to_char(sysdate-1,'YYYYMMDD')||'0530', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0530', to_char(sysdate-1,'YYYYMMDD')||'0600', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0600', to_char(sysdate-1,'YYYYMMDD')||'0630', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0630', to_char(sysdate-1,'YYYYMMDD')||'0700', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0700', to_char(sysdate-1,'YYYYMMDD')||'0730', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0730', to_char(sysdate-1,'YYYYMMDD')||'0800', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0800', to_char(sysdate-1,'YYYYMMDD')||'0830', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0830', to_char(sysdate-1,'YYYYMMDD')||'0900', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0900', to_char(sysdate-1,'YYYYMMDD')||'0930', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'0930', to_char(sysdate-1,'YYYYMMDD')||'1000', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1000', to_char(sysdate-1,'YYYYMMDD')||'1030', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1030', to_char(sysdate-1,'YYYYMMDD')||'1100', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1100', to_char(sysdate-1,'YYYYMMDD')||'1130', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1130', to_char(sysdate-1,'YYYYMMDD')||'1200', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1200', to_char(sysdate-1,'YYYYMMDD')||'1230', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1230', to_char(sysdate-1,'YYYYMMDD')||'1300', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1300', to_char(sysdate-1,'YYYYMMDD')||'1330', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1330', to_char(sysdate-1,'YYYYMMDD')||'1400', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1400', to_char(sysdate-1,'YYYYMMDD')||'1430', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1430', to_char(sysdate-1,'YYYYMMDD')||'1500', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1500', to_char(sysdate-1,'YYYYMMDD')||'1530', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1530', to_char(sysdate-1,'YYYYMMDD')||'1600', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1600', to_char(sysdate-1,'YYYYMMDD')||'1630', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1630', to_char(sysdate-1,'YYYYMMDD')||'1700', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1700', to_char(sysdate-1,'YYYYMMDD')||'1730', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1730', to_char(sysdate-1,'YYYYMMDD')||'1800', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1800', to_char(sysdate-1,'YYYYMMDD')||'1830', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1830', to_char(sysdate-1,'YYYYMMDD')||'1900', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1900', to_char(sysdate-1,'YYYYMMDD')||'1930', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'1930', to_char(sysdate-1,'YYYYMMDD')||'2000', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2000', to_char(sysdate-1,'YYYYMMDD')||'2030', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2030', to_char(sysdate-1,'YYYYMMDD')||'2100', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2100', to_char(sysdate-1,'YYYYMMDD')||'2130', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2130', to_char(sysdate-1,'YYYYMMDD')||'2200', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2200', to_char(sysdate-1,'YYYYMMDD')||'2230', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2230', to_char(sysdate-1,'YYYYMMDD')||'2300', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2300', to_char(sysdate-1,'YYYYMMDD')||'2330', 'D_OUTPUT', '', false);
p_addm_report(to_char(sysdate-1,'YYYYMMDD')||'2330', to_char(sysdate-1,'YYYYMMDD')||'0000', 'D_OUTPUT', '', false);
end;
/
exit;
eof
cd $ORACLE_HOME/scripts/mon/log
find . -name "*rpt_ORCLDB_*$DATE*" -print|xargs tar -cvf $ORACLE_HOME/scripts/report/report_ORCLDB_${DATE}.tar
find . -name "*rpt_ORCLDB_*$DATE*" -print|xargs rm -f
gzip -f $ORACLE_HOME/scripts/report/report_ORCLDB_${DATE}.tar
HOST_IP=xxxxx
USRNM="ftp"
PWD="xxxx"
LOCAL_DIR=$ORACLE_HOME/scripts/report
REMOTE_DIR=/sys_xj/ftp
ftp -inv $HOST_IP<<!
user ${USRNM} ${PWD}
bin
prompt
lcd ${LOCAL_DIR}
cd ${REMOTE_DIR}
mput report_ORCLDB_${DATE}.tar.gz
bye
!
exit