Steps to Purge the OPTSTATs:
1) Show the current history level:
select dbms_stats.get_stats_history_availability from dual;
2) Assuming history is 100 days old and you want to purge it until 10 days old:
begin
for i in reverse 10..100
loop
dbms_stats.purge_stats(sysdate-i);
end loop;
end;
/
3) Show the new history level
select dbms_stats.get_stats_history_availability from dual;
4) Output must show that the GET_STATS_HISTORY_AVAILABILITY is equal to sysdate - (n).