Ora 12012 ошибка при автоисполнение задания

Hi all,
Evaluating a database I detected it was failing to execute the default scheduler job SYS.BSLN_MAINTAIN_STATS_JOB. This job is an Oracle defined automatic moving window baseline statistics computation job, that runs only in weekends.
Below the last stack error in the alert log:

2016-04-24 00:00:10.064000 +00:00
Errors in file /db/u1001/oracle/diag/rdbms/MYDB/MYDB/trace/MYDB_j000_15675.trc:
ORA-12012: error on auto execute of job "SYS"."BSLN_MAINTAIN_STATS_JOB"
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073
ORA-06512: at line 1
2016-04-26 15:54:07.480000 +00:00

And the full tracefile:

Trace file /db/u1001/oracle/diag/rdbms/MYDB/MYDB/trace/MYDB_j000_15675.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2
System name:    Linux
Node name:      prddb09
Release:        2.6.18-164.el5
Version:        #1 SMP Tue Aug 18 15:51:48 EDT 2009
Machine:        x86_64
Instance name: MYDB
Redo thread mounted by this instance: 1
Oracle process number: 151
Unix process pid: 15675, image: oracle@prddb09 (J000)
*** 2016-04-24 00:00:10.064
*** SESSION ID:(586.10305) 2016-04-24 00:00:10.064
*** CLIENT ID:() 2016-04-24 00:00:10.064
*** SERVICE NAME:(SYS$USERS) 2016-04-24 00:00:10.064
*** MODULE NAME:(DBMS_SCHEDULER) 2016-04-24 00:00:10.064
*** ACTION NAME:(BSLN_MAINTAIN_STATS_JOB) 2016-04-24 00:00:10.064
ORA-12012: error on auto execute of job "SYS"."BSLN_MAINTAIN_STATS_JOB"
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073
ORA-06512: at line 1

According the notes below, the recommended action is to recreate the DBSNMP component:
Bug 10110625 – DBSNMP.BSLN_INTERNAL reports ORA-6502 running BSLN_MAINTAIN_STATS_JOB (Doc ID 10110625.8)
ORA-12012: Error on Auto Execute of job SYS.BSLN_MAINTAIN_STATS_JOB (Doc ID 1413756.1)
KEWBMBTA: Maintain BSLN Thresholds Failed, Check For Details. (Doc ID 1490391.1)

However, it’s a process that can affect other mechanisms. So, I found the follow note with the same error pointing to a privilege issue:
Ora-06508: Pl/Sql: Could Not Find Program Unit Being Called: “DBSNMP.BSLN_INTERNAL” (Doc ID 1323597.1)

But after granting the privilege as workaround suggested, the fail remais…

MYDB> select * from dba_tab_privs where table_name='DBMS_JOB';
GRANTEE                        OWNER                          TABLE_NAME                     GRANTOR                        PRIVILEGE
------------------------------ ------------------------------ ------------------------------ ------------------------------ -----------
APEX_030200                    SYS                            DBMS_JOB                       SYS                            EXECUTE
SYSMAN                         SYS                            DBMS_JOB                       SYS                            EXECUTE
EXFSYS                         SYS                            DBMS_JOB                       SYS                            EXECUTE
PUBLIC                         SYS                            DBMS_JOB                       SYS                            EXECUTE
SQL> GRANT EXECUTE ON sys.dbms_job to DBSNMP;
Grant succeeded.
MYDB> select * from dba_tab_privs where table_name='DBMS_JOB';
GRANTEE                        OWNER                          TABLE_NAME                     GRANTOR                        PRIVILEGE
------------------------------ ------------------------------ ------------------------------ ------------------------------ --------------
SYSMAN                         SYS                            DBMS_JOB                       SYS                            EXECUTE
APEX_030200                    SYS                            DBMS_JOB                       SYS                            EXECUTE
EXFSYS                         SYS                            DBMS_JOB                       SYS                            EXECUTE
DBSNMP                         SYS                            DBMS_JOB                       SYS                            EXECUTE
PUBLIC                         SYS                            DBMS_JOB                       SYS                            EXECUTE
SQL> EXEC DBMS_SCHEDULER.RUN_JOB('BSLN_MAINTAIN_STATS_JOB');
BEGIN DBMS_SCHEDULER.RUN_JOB('BSLN_MAINTAIN_STATS_JOB'); END;
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 1

After that, while I was quering on DBSNMP, I realized another instance name active in DBSNMP.BSLN_BASELINES.
I guess this database was created with another instance name and then renamed without DBNID.

MYDB> select * from DBSNMP.BSLN_BASELINES;
DBID INSTANCE_NAME    BASELINE_ID BSLN_GUID                        TI A STATUS
---------- ---------------- ----------- -------------------------------- -- - ---------
4092499541 MYDB                       0 75B49690F8B4742084990643EEFFB6AA HX Y ACTIVE
4092499541 oldname                    0 415373CD9959B77AAEE1804F06D88B60 NW Y ACTIVE

So, I deleted the row and the job started to run successfully:

MYDB> DELETE FROM DBSNMP.BSLN_BASELINES WHERE INSTANCE_NAME ='oldname';
1 row deleted.
MYDB> commit;
Commit complete.
SQL> EXEC DBMS_SCHEDULER.RUN_JOB('BSLN_MAINTAIN_STATS_JOB');
PL/SQL procedure successfully completed.

Execution logs:

MYDB> select *
2    from (select owner, job_name, log_date, status, run_duration
3            from dba_scheduler_job_run_details a
4           where job_name = 'BSLN_MAINTAIN_STATS_JOB'
5           order by log_date)
6   where rownum < 10;
OWNER                          JOB_NAME                  LOG_DATE                            STATUS          RUN_DURATION
------------------------------ ------------------------- ----------------------------------- --------------- ---------------
SYS                            BSLN_MAINTAIN_STATS_JOB   03/04/16 00:00:08,484972 +00:00     FAILED          +000 00:00:08
SYS                            BSLN_MAINTAIN_STATS_JOB   10/04/16 00:00:07,943598 +00:00     FAILED          +000 00:00:07
SYS                            BSLN_MAINTAIN_STATS_JOB   17/04/16 00:00:08,486526 +00:00     FAILED          +000 00:00:08
SYS                            BSLN_MAINTAIN_STATS_JOB   24/04/16 00:00:10,067848 +00:00     FAILED          +000 00:00:09
SYS                            BSLN_MAINTAIN_STATS_JOB   29/04/16 13:58:10,779201 +00:00     FAILED          +000 00:00:01
SYS                            BSLN_MAINTAIN_STATS_JOB   29/04/16 14:01:04,162900 +00:00     SUCCEEDED       +000 00:00:00

I hope it help you too!

Matheus.

In alert log we are getting the error, So we checked the job number which is causing the error. If it is not needed then drop it or disable it by dbms_scheduler procedure.

For checking the status of job when its last run and owner and inform to application team if its belong to application job:

select
d.job_name,
d.job_action,d.NEXT_RUN_DATE,d.OWNER
from
dba_scheduler_jobs d,
sys.scheduler$_job s
where
d.job_action = s.program_action
and
s.obj# = 55536

If error related to Auto Gather stats jobs:
ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_nn"

Error:

ORA-12012: error on auto execute of job “SYS”.”ORA$AT_OS_OPT_SY_”

Solution
1. Run the following query for checking advisory package:

col name for a30
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

2. If no row found then initialize the package with following commands.

EXEC dbms_stats.init_package();

3. Verify the package create. It will fixed the issue.

col name for a30
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        05-DEC-18 CMD                                    
INDIVIDUAL_STATS_ADVISOR_TASK  05-DEC-18 CMD     

█ 06.10.2011 10:16

К сожалению ораклист из меня хреновый и я воспринимаю базу (как тут было удачно подмечено) — как коробочный софт (.Перед обновлением решил сделать пересоздание индексов. При выполнении задания в административном модуле, выскакивает флажок «сбой»
В логе пишется следующее.

SQL код:


Errors in file e:oracleproduct10.2.0adminatriumbdumpatrium_j000_3548.trc:

ORA-12012ошибка при автоисполнении задания 192

ORA
-20401Задание <%> запросило исполнение неизвестной системной функции управления

ORA
-01403данные не найдены

ORA
-06512на  "SUPERMAG.SCHEDULE"line 293

ORA
-06512на  line 1 



сам atrium_j000_3548.trc содержит следующее.

SQL код:


*** ACTION NAME:() 2011-10-05 11:35:20.574

*** MODULE NAME:(/*SMag 11*/2011-10-05 11:35:20.574

*** SERVICE NAME:(SYS$USERS2011-10-05 11:35:20.574

*** CLIENT ID:() 2011-10-05 11:35:20.574

*** SESSION ID:(118.381222011-10-05 11:35:20.574

*** 2011-10-05 11:35:20.574

ORA
-12012ошибка при автоисполнении задания 192

ORA
-20401Задание <%> запросило исполнение неизвестной системной функции управления

ORA
-01403данные не найдены

ORA
-06512на  "SUPERMAG.SCHEDULE"line 293

ORA
-06512на  line 



Кто можешь подсказать в какую сторону копать?

█ 06.10.2011 10:18

Совсем забыл, версия супермаг 1.026.4, оракл 10.2.0

█ 06.10.2011 10:26

я тоже не ораклист, но ИМХО следует заглянуть в alertlog, да и трассировочный файл e:oracleproduct10.2.0adminatriumbdumpatrium_j000_3548.trc посмотреть не помешает…

█ 06.10.2011 11:36

присоединяюсь к пожеланиям посмотреть алерт, но в целом ошибку расшифровал бы так.
1) создается джоб, внутри — процедура имени программеров СМ
2) джоб срабатывает и процедура падает (20000 ошибки — ошибки, задаваемые разработчиками)
3) джоб выдает ошибку и сознается, что с заданием не справился

ошибка, скорее Супермаговская, чем оракловая. Если принципиальное нежелание пользоваться оптимизатором, то можно потыкаться в пересоздание джоба, например. В целом вообще можно забить :)

█ 06.10.2011 14:01

Цитата:

OlegON ➤ присоединяюсь к пожеланиям посмотреть алерт, но в целом ошибку расшифровал бы так.
1) создается джоб, внутри — процедура имени программеров СМ
2) джоб срабатывает и процедура падает (20000 ошибки — ошибки, задаваемые разработчиками)
3) джоб выдает ошибку и сознается, что с заданием не справился

ошибка, скорее Супермаговская, чем оракловая. Если принципиальное нежелание пользоваться оптимизатором, то можно потыкаться в пересоздание джоба, например. В целом вообще можно забить :)

Оптимизатор стоит.
Алерт и trc.
Если забить, проблема с обновлением не возникнет? )

█ 06.10.2011 14:08

Если оптимизатор стоит, то забудьте штатные задания, как страшный сон и, если в логе оптимизатора нет ошибок, то база в порядке и можно приступать к обновлению. С оптимизатором индексы перестраиваются регулярно автоматически. Вообще не понял, при чем тут обновление и пересоздание индексов.

█ 06.10.2011 14:40

а это как понимать???? разве это нормально

SQL код:


Index SUPERMAG.FFDOCUMENTS_SALEDATEIDX or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFDOCUMENTS_INCOMEDATEIDX or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFDOCUMENTS_CREATEDAT or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFSPEC_CAUSEIDX or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFSPEC_ART or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFPRODDOCUMENTS_DATE or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFPRODDOCUMENTS_ZONE or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFPRODINSPEC_ZONEART or some [sub]partitions of the index have been marked unusable

Sat Oct 01 14
:26:30 2011

Index SUPERMAG
.FFPRODOUTSPEC_ZONEART or some [sub]partitions of the index have been marked unusable 



█ 06.10.2011 15:12

Цитата:

Shlong ➤ а это как понимать???? разве это нормально…

если оптер постоянно крутится — нормально. сам поймал, сам и накажет.

Часовой пояс GMT +3, время: 07:55.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.

Here is my code.

update netz98.order_data
set usergroup = 'DISTR'
where 
modelcode||optcode||interiortrimcode in ('CW1WXJXFZLAA6016E','CW7WXMXFZLAA6014E')
and committed = 0
;
commit;

skaffman's user avatar

skaffman

398k96 gold badges816 silver badges768 bronze badges

asked Feb 14, 2011 at 9:15

prashanth's user avatar

0

ORA-12012 is always followed by a list of error codes/descriptions causing the failure. What you must do is to check your log files and by the errors next to the 12012 itself you will realize what’s going on.

The error is not necessarily related with the sentences the JOB is running, so the provided code not necessarily tell the cause, as stated by the referenced documentation:

ORA-12012: error on auto execute of job string
Cause: An error was caught while doing an automatic execution of a job.
Action: Look at the accompanying errors for details on why the execute failed.

Emphasis is mine.

answered Feb 14, 2011 at 17:30

jachguate's user avatar

jachguatejachguate

17k3 gold badges57 silver badges98 bronze badges

April 30, 2021

I got ” ORA-12012: error on auto execute of job ” error in Oracle database.

ORA-12012: error on auto execute of job

Details of error are as follows.

ORA-12012: Error on Auto Execute of Job

Cause: An error was caught while doing an automatic execution of a job.

Action: Look at the accompanying errors for details on why the execute failed.



error on auto execute of job

This ORA-12012 errors are related with the error was caught while doing an automatic execution of a job.

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.

To solve this error, 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');

Output of the query will look like this:

NAME                                 CTIME      HOW_CREATED
----------------------------------- ---------- ------------------------------
AUTO_STATS_ADVISOR_TASK              14-APR-16 CMD
INDIVIDUAL_STATS_ADVISOR_TASK        14-APR-16 CMD
 

If the query based on “where owner_name = ‘SYS’” condition does not show any rows but the error continues, please change the query as shown below to

see if a non-SYS user like SYSTEM owns those tasks for some reason:

$ 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();

Second case is as follows:

  • Alert during auto optimizer stats collection shows following errors:

    ORA-12012: error on auto execute of job “SYS”.”ST$AUTO5548_312_B49″
    ORA-20005: object statistics are locked (stattype = ALL)
    ORA-06512: at “SYS.DBMS_STATS”, line 34850
    ORA-06512: at line 1

This is due to following bug that is still being investigated:

Bug 13969759 – AUTO STATS JOB GATHERING STATS ON LOCKED TABLES

The sql tuning advisor job which is likely causing the conflict here.
It is the stats verification query issued by autosqltune.

Auto sqltune, tunes top sqls in maintenance window and create sql profiles.
In this process, it checks if the objects in the sqls have accurate stats by
issuing the sqls mentioned in the beginning of bug description.

Disable auto tuning job and run manually when required:

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 1,404 views last month,  1 views today

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Понравилась статья? Поделить с друзьями:
  • Ora 06512 ошибка oracle
  • Ora 06510 ошибка
  • Ora 06508 ошибка
  • Ora 06502 pl sql ошибка числа или значения
  • Ora 04088 ошибка во время выполнения триггера