Showing posts with label Statistics. Show all posts
Showing posts with label Statistics. Show all posts

Sep 2, 2017

How to collect statistics in an INTERVAL mode

First Check the old values
SQL> select * from sys.aux_stats$;

Create a new and old Statistics Table
SQL> exec dbms_stats.create_stat_table(ownname=>'SYS',stattab=>'backup_stats');
SQL> exec dbms_stats.create_stat_table(ownname=>'SYS',stattab=>'current_stats');

Save the old Statistics
SQL> exec dbms_stats.export_system_stats(stattab=>'backup_stats');

How to modify Statistics History Retention

Check current retention value

SQL> select dbms_stats.get_stats_history_retention from dual;

GET_STATS_HISTORY_RETENTION
---------------------------
                         31