SYSAUX Advise
SYSAUX Advise
SYSAUX Advise
SYSAUX tablespace will grow continuously. This issue is fixed in 12.1 release
Why It grows?
Whenever statistics in the dictionary are modified, old versions of statistics are saved
automatically for future restoring. This history information is stored in SYSAUX tablespace and
tables involved in this are as below:
WRI$_OPTSTAT_OPR
WRI$_OPTSTAT_AUX_HISTORY
WRI$_OPTSTAT_TAB_HISTORY
WRI$_OPTSTAT_IND_HISTORY
WRI$_OPTSTAT_HISTGRM_HISTORY
WRI$_OPTSTAT_HISTHEAD_HISTORY
By default, the MMON performs the automatic purge that removes all stats history older than
the following:
* current time - statistics history retention (by default 31 days)
* time of recent analyze in the system - 1
MMON performs the purge of the optimizer stats history automatically, but it has an internal limit
of 5 minutes to perform this job.MMON will do this activity once in 24 hrs. If the operation takes
more than 5 minutes, then it is aborted and stats not purged. No trace or alert message is
reported. Because of this, as time elapse more data will be accommodated in above tables.
Statistics history retention is configurable using the ALTER_STATS_HISTORY_RETENTION
procedure.
How to Identify
After running $ORACLE_HOME/rdbms/admin/awrinfo.sql (Doc ID 1292724.1), found the
largest consumer to be SM/OPTSTAT and SM/AWR
Note: When collected data for AWR and similar OP_STAT tables reaches an internally defined
threshold volume of data Oracle will automatically create partitions . This AWR, SQLSETs and
similar data is then stored in partitions including WRH/WRI based objects.
COMPONENT
MB SEGMENT_NAME - % SPACE_USED
SEGMENT_TYPE
--------- --------- --------------------------------------------------------------------- --------------ASH
382.0 WRH$_ACTIVE_SESSION_HISTORY.WRH$_ACTIVE_3563904870_4350
- 97% TABLE PARTITION
ASH
38.0
WRH$_ACTIVE_SESSION_HISTORY_PK.WRH$_ACTIVE_3563904870_4350 - 98%
INDEX PARTITION
INDEX
INDEX
INDEX
INDEX
Find out your present retention value using the below statement
select dbms_stats.get_stats_history_retention from dual;
SQL> select dbms_stats.get_stats_history_retention from dual;
GET_STATS_HISTORY_RETENTION
--------------------------31
Find out the oldest statistics history using below statement(Shows available stats that have not
been purged):
select dbms_stats.get_stats_history_availability from dual;
SQL> select dbms_stats.get_stats_history_availability from dual;
GET_STATS_HISTORY_AVAILABILITY
---------------------------------------------------------------------------
Set retention of old stats to less number of days. I set here it to 10 days as below.
exec dbms_stats.alter_stats_history_retention(&days);
SQL> exec dbms_stats.alter_stats_history_retention(10);
PL/SQL procedure successfully completed.
SQL> select dbms_stats.get_stats_history_retention from dual;
GET_STATS_HISTORY_RETENTION
--------------------------10
Purge stats older than 10 days. Best to do this in stages if there is a lot of data (sysdate30,sydate-28 etc)since it consumes more resources. Do this activity during less activities on the
database. This purge will delete data from WRI$ tables.
Below command will purge stats which is older than 28 days.
SQL> exec dbms_stats.purge_stats(sysdate-28);
Once purge is done, reorg these tables to release space to the database. Refer ID 1271178.1
for more details.