oracle rac自动生成awr
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
oracle rac自动生成awr的更多相关文章
- Oracle 每天自动生成AWR报告
经验丰富的老员工希望能够每天为数据库生成1个AWR报告,以便于后期分析数据库的性能变化,手动生成太麻烦,查了一下资料,发现可以自动生成,过程如下. 数据库环境:11gR2 RAC(双节点) AWR报告 ...
- SHELL脚本学习-自动生成AWR报告
自动生成AWR报告,每个小时生成一次. #编辑脚本:vim awr_auto.sh #oracle用户下执行 #!/bin/bash # 每个小时执行一次,自动生成AWR报告 source ~/.ba ...
- 自动生成AWR报告
--自动生成AWR报告 -------------------2013/09/23 脚本代码: #!/bin/bash AWR_FORMAT=html NUM_DAYS=1 MAX_S ...
- oracle中如何生成awr报告
oracle中如何生成awr报告 1.进入数据库 sqlplus / as sysdba 2.查看用户 show parameter db_name 3.开始压测后执行 exec DBMS_WOR ...
- Oracle 函数 “自动生成订单号”
create or replace function get_request_code return varchar2 AS --函数的作用:自动生成订单号 v_mca_no mcode_apply_ ...
- 一个自动生成awr报告的shell脚本
最近在学习shell编程,搞一点点小工具自动完成awr报告的收集工作,方便系统出现问题时问题排查.脚本内容如下,系统收集每天开始时间6点结束时间20点的awr报告并存储在/u01/shell_t/aw ...
- oracle中如何生成awr【性能调优】报告
1.进入数据库 sqlplus / as sysdba 2.查看用户 show parameter db_name 3.开始压测后执行 exec DBMS_WORKLOAD_REPOSITORY.CR ...
- oracle数据库自动生成数据库表结构文档(亲测有效)
import java.awt.Color; import java.io.FileOutputStream; import java.sql.Connection; import java.sql. ...
- 转: Oracle AWR 报告 每天自动生成并发送邮箱
原贴地址:http://www.cnblogs.com/vigarbuaa/archive/2012/09/05/2671794.html Oracle AWR 介绍http://blog.csdn. ...
随机推荐
- Python 基礎 - 文件操作_v2
嗯,那如何要把游標的位置給打印來? #!/usr/bin/env python3 # -*- coding:utf-8 -*- f = open('test', 'r') print(f.tell() ...
- C++模板元编程(C++ template metaprogramming)
实验平台:Win7,VS2013 Community,GCC 4.8.3(在线版) 所谓元编程就是编写直接生成或操纵程序的程序,C++ 模板给 C++ 语言提供了元编程的能力,模板使 C++ 编程变得 ...
- Ubuntu Sublime Text 设置等宽字体
{ "font_face": "DejaVu Sans Mono", "font_size": 10, "word_wrap&qu ...
- JS函数输出圆的半径和面积
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- js跳转传递参数
额,利用j获取了GridView中选中行数据后,通过JavaScript做跳转,传递参数的时候发现,当参数有中文的时候就会乱码, 当然出现这种情况的时候就需要对跳转的url进行编码 var urlX ...
- myeclipse里的调试快捷键
好多时候在调试代码时,有的时候只会用F5,其他的快捷键却一概不知.今天百度查了一下其他快捷键调试的作用,总结如下 F5 (setp into ): 跳入当前执行的方法中 F6 (step over): ...
- 多模块打包后,扫描不到@controller和@service,实现 ADD DIRECTORY ENTRIES
多模块打包后,扫描不到@controller和@service等Bean. 原因:打包时没有生成目录信息 解决办法: 1.在eclipse或者myeclipse 打包时 勾选 ADD DIRECTOR ...
- mysql 联合索引和唯一索引
一般来说.如果有where a=? and b=? and c=? 的语句. 如果表也有DML, 我一般只在a 上建索引. 这也是代价平衡的结果. 一方面 只在a 上建索引那么是 index ran ...
- Monkey工具使用详解
上节中介绍了Monkey工具使用环境的搭建,传送门..本节我将详细介绍Monkey工具的使用. 一.Monkey测试简介 Monkey测试是Android平台自动化的一种手段,通过Monkey程序模拟 ...
- 数位DP之奥义
恩是的没错数位DP的奥义就是一个简练的dfs模板 int dfs(int position, int condition, bool boundary) { ) return (condition ? ...