Solve the problem that the database cannot automatically collect statistics due to Oracle 11g installation.
Recently, it was found that some Oracle 11g databases could not automatically collect statistics. Some View query results are as follows:
SQL> select client_name, status from dba_autotask_client where client_name = 'Auto optimizer stats collect ';
CLIENT_NAME STATUS
------------------------------------------------------------------------
Auto optimizer stats collection ENABLED
SQL>
SQL> select client_name, status from dba_autotask_task;
CLIENT_NAME STATUS
------------------------------------------------------------------------
SQL>
SQL> select window_name, autotask_status from DBA_AUTOTASK_WINDOW_CLIENTS;
WINDOW_NAME AUTOTASK_STATUS
---------------------------------------------
WEDNESDAY_WINDOW DISABLED
FRIDAY_WINDOW DISABLED
SATURDAY_WINDOW DISABLED
THURSDAY_WINDOW DISABLED
TUESDAY_WINDOW DISABLED
SUNDAY_WINDOW DISABLED
MONDAY_WINDOW DISABLED
7 rows selected
All jobs are found to be DISABLED. The test shows that the "Enable Automatic maintenance task" option is the same as the "Enable Automatic maintenance task" option during database installation (selected by default). This option may be deselected during DBA installation, for example:
Because "Enable Automatic maintenance task" is not checked, the data installation will execute the following command, causing the job to disable:
Execute DBMS_AUTO_TASK_ADMIN.disable ();
In the future, if the database needs to start the automatic maintenance task, you only need to execute the following command:
SQL> execute DBMS_AUTO_TASK_ADMIN.enable ();
PL/SQL procedure successfully completed
SQL> select window_name, autotask_status from DBA_AUTOTASK_WINDOW_CLIENTS;
WINDOW_NAME AUTOTASK_STATUS
---------------------------------------------
WEDNESDAY_WINDOW ENABLED
FRIDAY_WINDOW ENABLED
SATURDAY_WINDOW ENABLED
THURSDAY_WINDOW ENABLED
TUESDAY_WINDOW ENABLED
SUNDAY_WINDOW ENABLED
MONDAY_WINDOW ENABLED
7 rows selected