Error:
When Starting a RAC DB instance I noticed the following error in the alertlog which was hampering the display of installed patches list:
QPI: opatch executable does not exist, opatch
QPI: OPATCH_INST_DIR not present:/u01/oracle/12.2.0.3/db/OPatch
Unable to obtain current patch information due to error: 20013, ORA-20013: DBMS_QOPATCH ran mostly in non install area
ORA-06512: at “SYS.DBMS_QOPATCH”, line 2327
ORA-06512: at “SYS.DBMS_QOPATCH”, line 854
ORA-06512: at “SYS.DBMS_QOPATCH”, line 634
ORA-06512: at “SYS.DBMS_QOPATCH”, line 2309
Analysis:
The top of the error message is clearly saying:
OPATCH_INST_DIR not present:/u01/oracle/12.2.0.3/db/OPatch
The right location of OPatch in my environment is /u01/oracle/12.2.0.3/OPatch, not as mentioned in the error message: /u01/oracle/12.2.0.3/db/OPatch
Checking the OPATCH directory location in DBA_DIRECTORIES:
SQL> set lines 170
col DIRECTORY_NAME for a30
col DIRECTORY_PATH for a100
select DIRECTORY_NAME,DIRECTORY_PATH from DBA_DIRECTORIES where DIRECTORY_NAME like ‘OPATCH%’;
It’s not only OPATCH_INST_DIR which pointing to the wrong directory, but the other OPATCH directories as well like; OPATCH_SCRIPT_DIR and OPATCH_LOG_DIR.
Solution:
As per note 2033620.1, the right OPATCH directories path should be as the following:
OPATCH_INST_DIR: $ORACLE_HOME/OPatch
OPATCH_SCRIPT_DIR: $ORACLE_HOME/QOpatch
OPATCH_LOG_DIR: $ORACLE_HOME/QOpatch
So let’s correct those paths using the following commands:
SQL> CREATE OR REPLACE DIRECTORY OPATCH_INST_DIR AS ‘/u01/oracle/12.2.0.3/OPatch‘;
SQL> CREATE OR REPLACE DIRECTORY OPATCH_SCRIPT_DIR AS ‘/u01/oracle/12.2.0.3/QOpatch‘;
SQL> CREATE OR REPLACE DIRECTORY OPATCH_LOG_DIR AS ‘/u01/oracle/12.2.0.3/QOpatch‘;
SQL> select DIRECTORY_NAME,DIRECTORY_PATH from DBA_DIRECTORIES where DIRECTORY_NAME like ‘OPATCH%’;
To verify that everything is OK after correcting the directory location:
Run the following command, where it should run successfully without returning any errors:
# $ORACLE_HOME/OPatch/datapatch -prereq