ORA-12012: error on auto execute of job “ORACLE_OCM"."

前段时间去客户那里做数据库健康检查,环境是HP-UX,11.2.0.3,原来是10g的库,后来升级到11g的,发现他们的一个库中报了以下的错误:
 
Errors in file /u01/app/Oracle/diag/rdbms/sisdb/sisdb1/trace/sisdb1_j001_7106.trc:
ORA-12012: error on auto execute of job "ORACLE_OCM"."MGMT_CONFIG_JOB_2_1"
ORA-29280: invalid directory path
ORA-06512: at "ORACLE_OCM.MGMT_DB_LL_METRICS", line 2436
ORA-06512: at line 1
 
ORA-12012错误通常只是告诉你一件事情,那就是JOB执行失败,具体是什么原因导致的还是要看下面的ORA-29280,这里提示是非法路径。咋一看,就可以知道,这个JOB似乎并不是业务上的,因为schema是ORACLE_OCM,肯定是Oracle自己的某个组件。
 
其实这个用户是Oracle 预定义的非管理员用户:
 

ORACLE_OCM

The account used with Oracle Configuration Manager. This feature enables you to associate the configuration information for the current Oracle Database instance with OracleMetaLink. Then when you log a service request, it is associated with the database instance configuration information.

See Oracle Database Installation Guide for your platform.

 
这个用户主要是用于Oracle配置管理器,当发出SR请求时,它和数据库实例配置相联系,把配置信息发送给Oracle供分析。默认情况下是过期或锁定的。
 
Oracle官方文档是这么描述的:
 
Newer database releases are automatically instrumented for OCM collections. But in some cases, the OCM instrumentation job is trying to write to a "state" directory called "ORACLE_OCM_CONFIG_DIR2" which doesn't exist.
 
在某些情况下,新版本数据库自动为OCM做了收集,但OCM配置的JOB试图去写一个没有被内置配置创建的目录:ORACLE_OCM_CONFIG_DIR2,因此也就有了“ORA-29280: invalid directory path”的提示了
 
To verify if the OCM directories exist or not, run the following as sysdba:
 

SQL> set lin 130

SQL> col owner for a10

SQL> col DIRECTORY_NAME for a25

SQL> col DIRECTORY_PATH for a50

SQL> select * from dba_directories where DIRECTORY_NAME like '%OCM_CONFIG%';
 
MGMT_DB_LL_METRICS wants to write to ORACLE_OCM_CONFIG_DIR2, which is not created by the built-in instrumentation scripts.
 
 
首先查看OCM是否正确的配置过:
 
$ORACLE_HOME/ccr/bin/deployPackages -l
 
 
如果返回'proceed to STEP 2'的内容,则说明并没有配置过,可以运行以下2个脚本,重新创建OCM相关的directory目录并赋予权限:
 
SQL> @ORACLE_HOME/ccr/admin/scripts/ocmjb10.sql
SQL> @ORACLE_HOME/ccr/admin/scripts/execute execocm.sql
 
 
最后检验一下:

SQL> select * from dba_directories where DIRECTORY_NAME like '%OCM_CONFIG%';

OWNER    DIRECTORY_NAME         DIRECTORY_PATH
-------- ---------------------- ------------------------------------------------------------------
SYS      ORACLE_OCM_CONFIG_DIR2 /u01/app/oracle/product/11.2.0.3/dbhome_1/ccr/state
SYS      ORACLE_OCM_CONFIG_DIR  /u01/app/oracle/product/11.2.0.3/dbhome_1/ccr/hosts/dc2oda-1/state

 

看到OCM的directory确实是有一个具体路径了,就说明已经配置好了
 
这个问题通常发生在新安装或升级到11.2.0.3的Oracle数据库上,由于OCM是一个独立工具,仅用于向MOS上传搜集信息,即使删除它不会对数据库造成影响,可以通过以下命令,删除OCM用户及相应的目录:
 

SQL> drop user ORACLE_OCM cascade;

SQL> drop directory ORACLE_OCM_CONFIG_DIR;

SQL> drop directory ORACLE_OCM_CONFIG_DIR2;

或者不删除用户,只禁用该job:

exec dbms_scheduler.disable('ORACLE_OCM.MGMT_CONFIG_JOB')

exec dbms_scheduler.disable('ORACLE_OCM.MGMT_STATS_CONFIG_JOB')

这样,就不会在alert日志里报ORA-12012的错误了。

相关推荐