Oracle JOB異常ORA-06512

來源:互聯網
上載者:User

題記:今天在監控系統上收到一套資料庫的JOB異常警示,這裡記錄一下解決過程,分享出來!

alert日誌:

Tue Dec 13 04:00:03 2011
Errors in file /opt/Oracle/diag/rdbms/ndmcdb/NDMCDB/trace/NDMCDB_j000_11169.trc:
ORA-12012: error on auto execute of job 30
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 512
ORA-29283: invalid file operation
ORA-06512: at "NDMC.PROC_TODO_TASK", line 74
ORA-06512: at line 1

 於是到資料庫中查詢:

       Job Schema User      Last Date    Next Date        Total Time B Interval        Failures What
---------- ----------------- -------------------- -------------------- ---------- - ------------------------------ ---------- -------------------------
         30    NDMC       01-Jan-4000 00:00:00                           0 Y TRUNC(sysdate + 1) + 4/24     16 PROC_TODO_TASK;
現在這個Job已經不可用了。

根據日誌中的提示,用PL/SQL Developer找到該預存程序:
定位到74行:

這裡是要開啟一個目錄,那麼這個PATH是在哪裡定義的呢?

於是查看資料庫:
SQL> col DIRECTORY_PATH for a50
SQL> col OWNER for a20
SQL> select * from dba_directories;

OWNER       DIRECTORY_NAME      DIRECTORY_PATH
-------------------- ------------------------------ --------------------------------------------------
SYS       NDMIGEXPDIR2      /home/oracle/ndmig_expdpdata
SYS       NDMIGEXPDIR      /home/oracle/archive/ndmig/expdpdata
SYS       BACK_MSG_LOGS_PATH      /home/oracle/msgBackup/work
SYS       UNSUB_DATA_PATH      /home/oracle/backup/unsub_data
SYS       SHARELOG       /home/oracle/share/
SYS       DISKPKGFILECATALOG      /home/oracle/backup/pkg_incon_data/diskpkgfile
SYS       LOGCATALOG       /home/oracle/backup/pkg_incon_data
SYS       DATA_PUMP_DIR      /opt/oracle/product/11g/db/rdbms/log/
SYS       ORACLE_OCM_CONFIG_DIR     /opt/oracle/product/11g/db/ccr/state

那麼確認系統中是否存在這個目錄或是這個目錄許可權是否正確:
oracle@NDMCDB05:~> cd /home/oracle/backup/unsub_data
-bash: cd: /home/oracle/backup/unsub_data: No such file or directory
發現這個目錄不存在,於是手工建立:
oracle@NDMCDB05:~> mkdir  -p  /home/oracle/backup/unsub_data

接著需要將job的屬性修改正確:

問題解決!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.