Oracle : Change AWR Retention

Share via:

Check existing retention and current snapshot interval.

set linesize 300
select extract( day from snap_interval) *24*60+extract( hour from snap_interval) *60+extract( minute from snap_interval ) snapshot_interval,
extract( day from retention) *24*60+extract( hour from retention) *60+extract( minute from retention ) retention_interval,
from dba_hist_wr_control;

Below query is similar like above but it gives retention in Days:

set linesize 300
col snap_interval for a30
col retention for a30
col TOPNSQL for a20
select * from dba_hist_wr_control;

Change Retention and snapshot interval :

— Example exec dbms_workload_repository.modify_snapshot_settings(retention=>144000, interval=>10, dbid=>1234567890);
— retention=>144000 –> for 100 days (100*24*60)
— interval -> 10 –> 10 Min

 exec dbms_workload_repository.modify_snapshot_settings(retention=>&Provide_in_min_for_retention, interval=>&interval, dbid=>&dbid); 

Run above queries again to validate.

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 5.00 out of 5)

One thought on “Oracle : Change AWR Retention

Add Comment