标题: Oracle报错ORA-20001: Statistics Advisor ORA-12012 [打印本页] 作者: 刘泽宇 时间: 2025-1-5 11:23 标题: Oracle报错ORA-20001: Statistics Advisor ORA-12012 现象:
Alert log and tracefile shows statistics advisor error:
ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_88"
ORA-20001: Statistics Advisor: Invalid Task Name For the current user <== Note it
ORA-06512: at "SYS.DBMS_STATS", line 46861
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 734
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 19930
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 21934
ORA-06512: at "SYS.DBMS_STATS", line 46851
This database is 12.2.0.0.2 created as a clone from seed during installation
改动:
This is a newly created database.
原因:
Seed database was most likely not created right by package dbms_stats.init_package not being ran.
Dbms_stats.init_package creates statistics advisor. This procedure is executed during database creation. If something went wrong during database creation,(for example, init_package is not called for some reason), this kind of errors may be seen in alert log when auto job tries to execute.
处理方法:
Run dbms_stats.init_package() in the container database to create the tasks correctly:
$ sqlplus / as sysdba
EXEC dbms_stats.init_package();
column name format A35
set linesize 120
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');