Sunteți pe pagina 1din 2

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doc...

ORA-12012: when executing a job (ORA-6512, ORA-6550) [ID 75070.1] Modified 24-JUL-2010 Type PROBLEM Status PUBLISHED

***Checked for relevance on 25-Jul-2010*** Problem Description =================== You submit a job using DBMS_JOB.SUBMIT, but the job does not run and the following errors are written to the alert file: ORA-12012: error on auto execute of job 62 Cause: Some kind of error was caught while doing an automatic execute of a job. Action: Look at the accompanying errors for details on why the execute failed. ORA-06550: line 1, column 143 Cause: A PL/SQL compilation error has occurred. The numbers given for line and column are the location in the PL/SQL block where the error occurred. Action: Refer to the following PL/SQL messages for more information about the error. PLS-00201: identifier 'SCOTT.EMP' must be declared See: Note:27287.1 ORA-06550: line 1, column 96 Cause: A PL/SQL compilation error has occurred. The numbers given for line and column are the location in the PL/SQL block where the error occurred. Action: Refer to the following PL/SQL messages for more information about the error. PL/SQL: SQL Statement ignored The job inserts data from one schema (userA) into a table in another schema (userB), and is submitted from userB. Solution Description ==================== To fix the problem as userA we must: GRANT SELECT ON <tablename> TO <userB>; eg. GRANT SELECT ON emp to SYSTEM; Explanation =========== The problem is caused by the error: PLS-00201: identifier 'SCOTT.EMP' must be declared The job which is submitted by userB and SELECTs data from the some_table in userA schema will run successfully if userA grants SELECT ON some_table TO userB explicitly (NOT via ROLE !) Take the following example: Let's say you connected as SYSTEM and are trying to submit a job which SELECTs data from some table in other shema and inserts them into some table into the SYSTEM schema. SQL> SQL> 2 3 4 5 6 7 8 9 10 DECLARE jobno number; begin DBMS_JOB.SUBMIT(jobno, 'INSERT INTO test SELECT ename FROM scott.emp;', SYSDATE, 'SYSDATE+1/24/60'); COMMIT; end; /

PL/SQL procedure successfully completed. You can see that the job was submitted but there are no entries in the test table so it hasn't been executed.

1 of 2

8/29/2011 7:15 AM

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doc...

Checking DBA_JOBS shows failures: SQL> SELECT job,failures FROM dba_jobs; JOB FAILURES --------- --------62 1 Trying to execute this job manually gives errors: SQL> EXEC DBMS_JOB.RUN(62); begin DBMS_JOB.RUN(62); end; * ERROR at line 1: ORA-12011: execution of 1 jobs failed ORA-06512: at "SYS.DBMS_IJOB", line 242 ORA-06512: at "SYS.DBMS_JOB", line 218 ORA-06512: at line 1 Checking the ALERT.LOG file gives errors: ORA-12012: error on auto execute of job 62 ORA-06550: line 1, column 143: PLS-00201: identifier 'SCOTT.EMP' must be declared ORA-06550: line 1, column 96: PL/SQL: SQL Statement ignored ============================================ To fix the problem we MUST GRANT SELECT ON emp TO SYSTEM ============================================ The job is running under the SYSTEM schema. SYSTEM must be granted select privilege on the table in order to read the data. SQL> CONNECT scott/tiger Connected. SQL> GRANT SELECT ON emp TO SYSTEM; Grant succeeded. SQL> CONNECT system/manager Connected. SQL> EXEC DBMS_JOB.RUN(62); PL/SQL procedure successfully completed. SQL> SELECT * FROM test; F1 ---------------------------------------SMITH ALLEN ..... 14 rows selected.

Related Products Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition Errors ORA-12011; ORA-6512; ORA-12012; ORA-6550; PLS-201

Back to top Copyright (c) 2007, 2010, Oracle. All rights reserved. Legal Notices and Terms of Use | Privacy Statement

2 of 2

8/29/2011 7:15 AM

S-ar putea să vă placă și