Sunday, November 4, 2018

ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_16656"

Error

ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_16656"
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 47207
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 22201
ORA-06512: at "SYS.DBMS_STATS", line 47197

Cause Its an known BUG, Advisory packages were not created properly during database creation.

Solution

Verify advisory packages are exist or not, if you are getting these errors means you will not found these objects.

select name, ctime, how_created
from sys.wri$_adv_tasks
where owner_name = 'SYS'
and name in ('AUTO_STATS_ADVISOR_TASK','INDIVIDUAL_STATS_ADVISOR_TASK');

no rows selected

Create these objects using below command

SQL> EXEC dbms_stats.init_package();

PL/SQL procedure successfully completed.