PROBLEM:

While modifying the retention period of AWR snapshot, got error ORA-13541

SQL> execute dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 10080);
BEGIN dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 10080); END;

*
ERROR at line 1:
ORA-13541: system moving window baseline size (691200) greater than retention
(604800)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 198
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 246
ORA-06512: at line 1

SOLUTION:

Here we are trying to set retention to 10080 which is equal to 7 days.

Let’s check the Moving window size:

SQL> select BASELINE_TYPE,MOVING_WINDOW_SIZE from dba_hist_baseline;


BASELINE_TYPE MOVING_WINDOW_SIZE
------------- ------------------
MOVING_WINDOW                  8

It is set to 8 days. I.e the moving window size is more than the retention period we are trying to set.

So modify the window size to  7 days.

SQL>   execute dbms_workload_repository.modify_baseline_window_size(window_size=> 7);

PL/SQL procedure successfully completed.


SQL> select BASELINE_TYPE,MOVING_WINDOW_SIZE from dba_hist_baseline;

BASELINE_TYPE MOVING_WINDOW_SIZE
------------- ------------------
MOVING_WINDOW                  7

Now try to modify awr snapshot retention:

SQL> execute dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 10080);

PL/SQL procedure successfully completed.