Professional Documents
Culture Documents
Document 1055547.1 - SYSAUX Grows Because Optimizer Stats History Is Not Purged
Document 1055547.1 - SYSAUX Grows Because Optimizer Stats History Is Not Purged
Document 1055547.1 - SYSAUX Grows Because Optimizer Stats History Is Not Purged
1
Copyright (c) 2021, Oracle. All rights reserved. Oracle Confidential.
SYSAUX Grows Because Optimizer Stats History is Not Purged (Doc ID 1055547.1)
In this Document
Symptoms
Changes
Cause
Solution
Community Discussions
References
APPLIES TO:
SYMPTOMS
wri$_optstat_tab_history
wri$_optstat_ind_history
wri$_optstat_histhead_history
wri$_optstat_histgrm_history
CHANGES
CAUSE
By default, MMON performs the automatic purge that removes all history older than the older of:
and
MMON performs the purge of the optimizer stats history automatically. However it has an internal limit of 5 minutes to
perform this job. If the operation takes more than 5 minutes, then it is aborted and stats not purged.
No trace or alert message is reported.
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=171bim39n7_277&id=1055547.1 1/4
5/13/2021 Document 1055547.1
SOLUTION
This fix makes deep changes to purge historic (archived) schema statistics. As it makes changes to the data dictionary,
Support needs to be involved in a situation where a patch is requested. The fix is included in 11.2.0.4 and 12.1
When compatibility in 11.2 is above 11 , the patch will be enabled when the patchset is installed. However it is not
enabled when compatibility is less than 11.
Document 1537496.1 - How to Manually Enable the Patch for Bug 14373728 on Oracle 11g Release 11.2.0.4
2. If the previous patch cannot be applied, it is recommended that the following patches are applied:
Check for existing interim patches on top of older patchsets: Patch 10279045
NOTE: The README(s) of some of the interim patches for this fix might be missing the complete post-installation
steps. The post-installation steps are included in: Document 10279045.8 Bug 10279045 - Slow Statistics purging
(SYSAUX grows)
3. If you cannot apply either of the patches or the Optimizer Statisitcs History tables still consume too much space, the
history can be purge manually using DBMS_STATS.PURGE_STATS procedure.
If the amount of data is very large, it is recommended to to do this in small batches in order to prevent running out of
undo space (ORA-1555)
b. Assuming history is 100 days old and you want to purge it until 10 days old:
begin
for i in reverse 10..100
loop
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=171bim39n7_277&id=1055547.1 2/4
5/13/2021 Document 1055547.1
dbms_stats.purge_stats(sysdate-i);
end loop;
end;
/
This should show that the GET_STATS_HISTORY_AVAILABILITY is indeed equal to sysdate - (n).
d. If the patch for bug 10279045 mentioned above has been applied, an option is included to truncate all stats history
tables.
This option is planned to be used as a workaround on urgent cases and under the advise of Support if fix for bug
14373728 cannot be implemented.
This option is communicated through a special timestamp input to dbms_stats.purge_stats procedure:
DBMS_STATS.PURGE_ALL
When before_timestamp is specified as DBMS_STATS.PURGE_ALL, all stats history tables are truncated.
exec DBMS_STATS.PURGE_STATS(DBMS_STATS.PURGE_ALL)
NOTE: Interrupting (e.g., hitting Ctrl-C) purge_stats while it is running with PURGE_ALL option may lead to
inconsistencies. Hence, please avoid interrupting purge_stats manually.
Community Discussions
Still have questions? Use the communities window below to search for similar discussions or start a new discussion on this
subject. (Window is the live community not a screenshot)
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=171bim39n7_277&id=1055547.1 3/4