Site icon An Oracle Spin by Alex Lima

How to view/change statistics retention and space used to store stats history?

See the oldest statistics history available
SQL> SELECT DBMS_STATS.GET_STATS_HISTORY_AVAILABILITY FROM DUAL;

GET_STATS_HISTORY_AVAILABILITY
—————————————————————————
25-OCT-11 10.00.55.093000000 PM -07:00

See the stats retention
SQL> select dbms_stats.get_stats_history_retention from dual;

GET_STATS_HISTORY_RETENTION
—————————
31

Modify retention
SQL> exec DBMS_STATS.ALTER_STATS_HISTORY_RETENTION(60);

Space currently used to store statistics in SYSAUX in KBytes, so increasing the retention would affect it’s size
SQL> select occupant_desc, space_usage_kbytes from v$sysaux_occupants where OCCUPANT_DESC like '%Statistics%';

OCCUPANT_DESC SPACE_USAGE_KBYTES
—————————————————————- ——————
Server Manageability – Optimizer Statistics History 17920

Exit mobile version