
If for some reason automatic optimizer statistics collection is disabled, then you can enable it using the ENABLE procedure in the DBMS_AUTO_TASK_ADMIN package: BEGINĬlient_name => 'auto optimizer stats collection', Automatic optimizer statistics collection runs as part of AutoTask and is enabled by default to run in all predefined maintenance windows. By default, one window is scheduled for each day of the week.

The automated maintenance tasks infrastructure (known as AutoTask) schedules tasks to run automatically in Oracle Scheduler windows known as maintenance windows. This section contains the following topics:Įnabling and Disabling Automatic Optimizer Statistics Collectionġ3.2.1 Enabling and Disabling Automatic Optimizer Statistics Collection The main difference is that GATHER_DATABASE_STATS_JOB_PROC prioritizes database objects that require statistics, so that objects that most need updated statistics are processed first, before the maintenance window closes.

This internal procedure operates similarly to the DBMS_STATS.GATHER_DATABASE_STATS procedure using the GATHER AUTO option. It also significantly reduces the risks of generating poor execution plans because of missing or stale statistics.Īutomatic optimizer statistics collection calls the DBMS_STATS.GATHER_DATABASE_STATS_JOB_PROC procedure. If fresh statistics are required for a table, then the database collects them both for the table and associated indexes.Īutomatic collection eliminates many manual tasks associated with managing the optimizer.

In this case, the database automatically collects optimizer statistics for tables with absent or stale statistics. Oracle recommends that you enable automatic optimizer statistics collection. 13.2 Managing Automatic Optimizer Statistics Collection
