Document 1055547.1 - SYSAUX Grows Because Optimizer Stats History Is Not Purged

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

5/13/2021 Document 1055547.

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:

Oracle Database Cloud Schema Service - Version N/A and later


Oracle Database Exadata Express Cloud Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

SYMPTOMS

Space consumption continuously increases in the following tables:

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:

current time - statistics history retention

and

time of recent analyze in the system - 1

Default for Statistics History Retention is 31 days

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.

The following bugs are related to sysaux tablespace growing:

Document 10279045.8 Slow Statistics purging (SYSAUX grows)


Document 8553944.8 SYSAUX tablespace grows
Document 14373728.8 Bug 14373728 - Old statistics not purged from SYSAUX tablespace
Document 11869207.8 Improvements to archived statistics purging / SYSAUX tablespace grows

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=171bim39n7_277&id=1055547.1 1/4
5/13/2021 Document 1055547.1

SOLUTION

1. Apply patch for Bug 14373728.

NOTE: This patch supersedes fix for Bug 11869207.

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.

For further information see:

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:

Bug 8553944 SYSAUX tablespace grows


Included in 12.1 and 11.2.0.2
This fix alters the purging to run in chunks rather than trying to do all in one go.
and
Bug 10279045 Slow Statistics purging (SYSAUX grows)
Fixed in 12.1 and 11.2.0.3

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.

DBMS_STATS.PURGE_STATS has one parameter: before_timestamp


All Versions of statistics saved before this timestamp are purged. If NULL, it uses the purging policy used by automatic
purge.

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)

a. Show the current history level:

select dbms_stats.get_stats_history_availability from dual;

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;
/

c. Show the new history level


select dbms_stats.get_stats_history_availability from dual;

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)

Click here to open in main browser window

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=171bim39n7_277&id=1055547.1 3/4

You might also like