./datapatch -verbose SQL Patching tool version 12.1.0.2.0 on Fri Jul 17 09:45:14 2015 Copyright (c) 2015, Oracle. All rights reserved. Log file for this invocation:/cfgtoollogs/sqlpatch/sqlpatch_22821_2015_07_17_09_45_14/sqlpatch_invocation.log Connecting to database…OK 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’ and/or check the invocation log /cfgtoollogs/sqlpatch/sqlpatch_22821_2015_07_17_09_45_14/sqlpatch_invocation.log for the complete error. Prereq check failed, exiting without installing any patches. Please refer to MOS Note 1609718.1 and/or the invocation log /cfgtoollogs/sqlpatch/sqlpatch_22821_2015_07_17_09_45_14/sqlpatch_invocation.log for information on how to resolve the above errors. SQL Patching tool complete on Fri Jul 17 09:45:21 2015
OR
Connecting to database...OK Determining current state...DBD::Oracle::st execute failed: ORA-20009: Job Load_opatch_inventory_1execution failed ORA-06512: at "SYS.DBMS_QOPATCH", line 1011 ORA-06512: at line 4 (DBD ERROR: OCIStmtExecute) [for Statement "DECLARE x XMLType; BEGIN x := dbms_qopatch.get_pending_activity; ? := x.getStringVal(); END;" with ParamValues: :p1=undef] at /RAC/oracle/12.1.0.1/dbhome_1/sqlpatch/sqlpatch.pm line 648.
Further accessing the inventory through the DBMS_QOPATCH also fails with the following error :
SQL> select dbms_sqlpatch.verify_queryable_inventory from dual; ORA-20013: DBMS_QOPATCH ran mostly in non install area SQL> select dbms_qopatch.get_opatch_install_info() from dual; ERROR: ORA-20013: DBMS_QOPATCH ran mostly in non install area ORA-06512: at “SYS.DBMS_QOPATCH”, line 1937 ORA-06512: at “SYS.DBMS_QOPATCH”, line 133
Cause:
OPATCH_INST_DIR was pointing to $ORACLE_HOME/QOpatch
or
OPATCH_LOG_DIR was pointing to $ORACLE_HOME/QOPatch
or
OPATCH_SCRIPT_DIR was pointing to $ORACLE_HOME/OPatch
or
Any one or more of the above condition is true.
This can be checked using the following query :
SQL> select DIRECTORY_NAME, DIRECTORY_PATH from dba_directories ;
Instead ,
OPATCH_INST_DIR should point to $ORACLE_HOME/OPatch
OPATCH_LOG_DIR should point to $ORACLE_HOME/QOpatch
OPATCH_SCRIPT_DIR should point to $ORACLE_HOME/QOpatch
Solution:
Drop the directory and create correct location :
1) SQL> create or replace directory OPATCH_INST_DIR as '/OPatch'; 2) SQL> create or replace directory OPATCH_LOG_DIR as ' /QOpatch'; 3) SQL> create or replace directory OPATCH_SCRIPT_DIR as ' /QOpatch'; 4) Invoke datapatch command: ./datapatch -prereq ./datapatch -verbose