While running datapatch tool in Oracle 12c, as part of post patching got ORA-20013 error.

Use below steps to solve the issue.


cd /oracle/app/oracle/product/

./datapatch -verbose
SQL Patching tool version on Thu Feb 25 11:02:17 2016
Copyright (c) 2014, Oracle.  All rights reserved.

Connecting to database...OK
catcon: ALL catcon-related output will be written to /tmp/sqlpatch_catcon__catcon_3220.lst
catcon: See /tmp/sqlpatch_catcon_*.log files for output generated by scripts
catcon: See /tmp/sqlpatch_catcon__*.lst files for spool files, if any
Bootstrapping registry and package to current versions...done

Queryable inventory could not determine the current opatch status.
Execute 'select dbms_sqlpatch.verify_queryable_inventory from dual'
for the complete error.
Prereq check failed, exiting without installing any patches.

Please refer to MOS Note 1609718.1 for information on how to resolve the above errors.

SQL Patching tool complete on Thu Feb 25 11:02:23 2016

SQL> select dbms_sqlpatch.verify_queryable_inventory from dual;

ORA-20013: DBMS_QOPATCH ran mostly in non install area



Check the patching related directories from dba_directories.


SQL> select DIRECTORY_NAME, DIRECTORY_PATH from dba_directories where DIRECTORY_NAME like '%OPATCH%';





Check the ORACLE_HOME :


We can see that directories are pointing to wrong location.
So recreate them pointing to correct ORACLE_HOME location.


SQL> create or replace  directory  OPATCH_INST_DIR as '/oracle/app/oracle/product/';

Directory created.

SQL>  create or replacce  directory OPATCH_SCRIPT_DIR  as  '/oracle/app/oracle/product/';

Directory created.

SQL> create or replace  directory OPATCH_LOG_DIR as  '/oracle/app/oracle/product/';

Directory created.

Now run the datapatch tool, it should work fine.