数据库:12.2.0.1.0 系统:linux7.5
1.告警日志情况
在一台新建的数据库12c的数据库上,我们做系统测试了一阵子,查看告警日志,发现告警日志中出现
反复的日志报错,并生成追踪日志,日志如下:
Errors in file /opt/u01/app/oracle/diag/rdbms/jcpt/jcpt/trace/jcpt_j000_2603.trc:
ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_14350"
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 4719
2.告警分析
根据告警日志的内容分时是自动统计顾问出现执行报错,可能会对自动统计信息的收集会有影响,而收集统计信息又是oracle数据库最重要的
一步操作,所以继续根据故障内容查看mos文档,文档ID 2127675.1。数据库很可能是由于未运行dbms_stats.init_package软件包而创建的。
Dbms_stats.init_package创建统计顾问。在数据库创建期间执行此过程。如果在数据库创建过程中出了点问题(例如,由于某种原因未调用init_package),
则在尝试执行自动作业时,可能会在警报日志中看到此类错误
3.解决方法
在sys用户下,执行EXEC DBMS_STATS.INIT_PACKAGE();
过程入下:
sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat Jan 12 10:17:11 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> 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
SQL> EXEC dbms_stats.init_package();
PL/SQL procedure successfully completed.
SQL> 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');
NAME
--------------------------------------------------------------------------------
CTIME HOW_CREATED
--------- ------------------------------
AUTO_STATS_ADVISOR_TASK
12-JAN-19 CMD
INDIVIDUAL_STATS_ADVISOR_TASK
12-JAN-19 CMD