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;