-- 找到指定的snap select *
from (select * from dba_hist_snapshot order by snap_id desc) where rownum < 200; -- AWR SELECT * FROM TABLE(dbms_workload_repository.awr_report_html( (select dbid from v$database), 1, 26663, -- begin snap_id 26664 -- end snap_id ));
select * from dba_hist_wr_control;
exec dbms_workload_repository.create_snapshot();
exec dbms_workload_repository.modify_baseline_window_size(8);
exec dbms_workload_repository.modify_snapshot_settings(interval => 30, retention => 16*24*60, topnsql => 50);
exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 6770,high_snap_id => 6774,dbid => 7059638244);
begin
dbms_workload_repository.create_snapshot();
end;
-- ASH SELECT * FROM TABLE(dbms_workload_repository.ash_report_html( (select dbid from v$database), 1, SYSDATE - 30 / (24 * 60), -- begin datetime SYSDATE - 10 / (24 * 60) -- end ));
SELECT * FROM TABLE(dbms_workload_repository.ash_report_html( (select dbid from v$database), 1, to_date('2015-11-15 20:10:00', 'yyyy-mm-dd hh24:mi:ss'), -- begin datetime to_date('2015-11-15 20:30:00', 'yyyy-mm-dd hh24:mi:ss') -- end ));
-- ADDM select * from dba_advisor_tasks s order by s.created desc -- sqlplus设置参数 set long 1000000 pagesize 0 longchunksize 1000 select dbms_advisor.get_task_report('ADDM:2199108538_1_26664') from dual;
select * from v$active_session_history t where ROWNUM < 20;
SELECT *
FROM (
SELECT * FROM v$active_session_history t
WHERE t.sample_time BETWEEN
TO_DATE('2016-05-04 10:10:00', 'yyyy-mm-dd hh24:mi:ss')
AND TO_DATE('2016-05-04 10:20:00', 'yyyy-mm-dd hh24:mi:ss')
ORDER BY t.SAMPLE_TIME
) t
WHERE ROWNUM < 20;
select * from dba_hist_active_sess_history t where rownum < 20;
SELECT *
FROM (
SELECT * FROM dba_hist_active_sess_history t
WHERE t.sample_time BETWEEN TO_DATE('2016-05-04 10:10:00', 'yyyy-mm-dd hh24:mi:ss')
AND TO_DATE('2016-05-04 10:20:00', 'yyyy-mm-dd hh24:mi:ss')
ORDER BY t.SAMPLE_TIME
) t
WHERE ROWNUM < 20;