重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1809|回复: 0
打印 上一主题 下一主题

[Oracle] ORA-12012: error on auto execute of job “SYS“.“ORA$AT_OS_OPT_SY_xx“解决办法

[复制链接]
跳转到指定楼层
楼主
发表于 2024-9-24 11:51:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

报错现象:alter日志出现大量下面错误,而且这些错误一般是晚上22点出现
Errors in file /home/u01/app/oracle/diag/rdbms/xxx/xxx/trace/xxx_j000_106602.trc:
ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_128403"
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

数据库版本信息如下所示:

SQL> select * from v$version;
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production 0
PL/SQL Release 12.2.0.1.0 - Production 0
CORE 12.2.0.1.0 Production 0
TNS for Linux: Version 12.2.0.1.0 - Production 0
NLSRTL Version 12.2.0.1.0 - Production 0
解决办法:
SQL> EXEC dbms_stats.init_package();
PL/SQL procedure successfully completed.
SQL> column name format A35
SQL> set linesize 120
SQL>
SQL> select name, ctime, how_created
2 from sys.wri$_adv_tasks
3 where owner_name = 'SYS'
4 and name in ('AUTO_STATS_ADVISOR_TASK','INDIVIDUAL_STATS_ADVISOR_TASK');
NAME CTIME
----------------------------------- -------------------
HOW_CREATED
------------------------------------------------------------------------------------------
AUTO_STATS_ADVISOR_TASK 2021-05-03 13:29:01
CMD
INDIVIDUAL_STATS_ADVISOR_TASK 2021-05-03 13:29:01

CMD

若此方法不行,参照MOS文档中另外的解决方法:
$ sqlplus / as sysdba
select name, ctime, how_created,OWNER_NAME from sys.wri$_adv_tasks
where name in ('AUTO_STATS_ADVISOR_TASK','INDIVIDUAL_STATS_ADVISOR_TASK');
If the OWNER is a non-SYS user, you have to drop the tasks as that user first and then try to solution mention in the Note again.

This was a case for one customer.
For example:
--- Connect as SYSTEM, for example, if that user owned the tasks and non SYS for some reason
SQL> conn system/&password
DECLARE
v_tname VARCHAR2(32767);
BEGIN
v_tname := 'AUTO_STATS_ADVISOR_TASK';
DBMS_STATS.DROP_ADVISOR_TASK(v_tname);
END;
/
SQL> DECLARE
v_tname VARCHAR2(32767);
BEGIN
v_tname := 'INDIVIDUAL_STATS_ADVISOR_TASK';
DBMS_STATS.DROP_ADVISOR_TASK(v_tname);
END;
/
connect / as sysdba

EXEC DBMS_STATS.INIT_PACKAGE();



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-12-21 22:00 , Processed in 0.103424 second(s), 28 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表