1. 創建臨時表,保存近幾天的數據
create table test.awr_bak as select * from sys.WRH$_ACTIVE_SESSION_HISTORY where SAMPLE_TIME>=sysdate-7;
2. 禁用AWR
exec dbms_workload_repository.modify_snapshot_settings(interval => 0);
3.TRUNCATE TABLE sys.WRH$_ACTIVE_SESSION_HISTORY;
4.TRUNCATE完成後進行insert ,然後 重建索引
5.啓動AWR
exec dbms_workload_repository.modify_snapshot_settings(interval => 60);
6.刪除備份表
drop table test.awr_bak purge;