Wednesday, August 6, 2014

Unable to create Patch Object Exception occured : PatchObject constructor: Input file does not exist.

Version: 

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

Issue:

Error found on invoking patch conflict check using opatch for a PSU patch on database Home.

Error:

Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail"not executed 
Unable to create Patch Object.
Exception occured : PatchObject constructor: Input file "/u01/stage/etc/config/actions" or "/u01/stage/etc/config/inventory" does not exist.

OPatch succeeded.

Reason:

Error is due to the location (directory) given for the Patch folder given using -ph.

I used the command, "opatch prereq CheckConflictAgainstOHWithDetail -ph ./". Since I gave -ph . the command should have been executed from the directory where the patch was extracted.

In this case the patch folder after extraction was /u01/stage/18522509. 

But I invoked the patch conflict check from /u01/stage and specified -ph ./ where it will look for patch files in the current directory and resulted in the error.

Fix:

Move to the folder created after extracting the patch zip file and execute the command again from there.

[oracle@DBServer1 stage]$ cd  /u01/stage/18522509
[oracle@DBServer1 18522509]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

or specify the full directory to -ph command from current directory

opatch prereq CheckConflictAgainstOHWithDetail -ph /u01/stage/18522509

Tuesday, August 5, 2014

ORA-20001: Latest xml inventory is not loaded into table

Version:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

Issue:

April 2014 PSU - Patch 18522516 - 12.1.0.1.4 Patch Set Update is applied successfully to the DB Home. On the post patching step, to loadi modified SQL files into the database, datapatch is invoked and it results in the error.

Error:

bash-4.1$ ./datapatch -verbose
SQL Patching tool version 12.1.0.1.0 on Tue Aug  5 01:08:49 2014
Copyright (c) 2014, Oracle.  All rights reserved.

Connecting to database...OK
Determining current state...
Currently installed SQL Patches: 
DBD::Oracle::st execute failed: ORA-20001: Latest xml inventory is not loaded into table
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 /u01/app/product/12.1.0/dbhome_1/sqlpatch/sqlpatch.pm line 1227.

Description:

An error lookup just shows that latest inventory file is not loaded. It could be due to some kind of permission issues with the QOpatch directory and files under it. Database uses two directories to pint to $ORACLE_HOME/QOPatch location, OPATCH_SCRIPT_DIR and OPATCH_LOG_DIR.

Solution:

Followed the Oracle support Doc (Doc ID 1602089.1) and tried workarounds mentioned there, like recreating OPATCH_SCRIPT_DIR and OPATCH_LOG_DIR from sqlplus. Also edited opatch script file as mentioned in the support doc. But both steps did not work.

1. Check the _disable_directory_link_check parameter value in the DB 
2. If its value is FALSE, set it to TRUE
3. Bounce the DB
4. Rinvoke datapatch command.

1. SQL> SELECT a.ksppinm "Parameter",b.ksppstvl "Session Value",c.ksppstvl "Instance Value" FROM x$ksppi a, x$ksppcv b, x$ksppsv c  WHERE a.indx = b.indx AND a.indx = c.indx AND a.ksppinm LIKE '/_disable_direc%' escape '/';   

Parameter                      Session Value Instance Value
------------------------------ ------------- ---------------
_disable_directory_link_check   FALSE         FALSE

2. SQL> alter system set "_disable_directory_link_check"=TRUE scope=spfile;

System altered.

3. SQL> Shutdown immediate
    SQL> startup;

4. ./datapatch -verbose
.....................
.....................
     Installing patches...
     Patch installation complete.  Total patches installed: 1
     Validating logfiles...
     Patch 18522516 apply: SUCCESS

Monday, August 4, 2014

The OPatch version is not applicable for current OUI version

Version:

Oracle WLS 12.1.2.0

Issue:

Opatch lsinventory returns error when opatch command is issued from 12.1.2.0 version of Weblogic. 

Error:

opatch lsinventory -jdk $JAVA_HOME

OPatch Version : 13.1.0.0.0
OUI  Version : 12.1.0.1.0
The OPatch version is not applicable for current OUI version.

Since OUI Version starts with 12.1, Please go to 'My Oracle Support' and get right OPatch 12.1.*.*.* based on patch 6880880, release version 12.1.0.0.0 and \appropriate platform.

OPatch failed with error code 19

Reason:

The Error was due to the mismatch in opatch version and the inventory version. A DB software of 12C version is also available in same server. In my case  MW_HOME environment variable is set and PATH is set to $MW_HOME/OPatch directory. But the ORACLE_HOME environment variable was still set to the DB Home. Because of that the opatch utility checked the inventory file which it got from the Oracle DB Home oraInst.loc and error out

Solution:

Set ORACLE_HOME to MW_HOME_PATH location and re invoke opatch. 
Still better to close the previous Unix session and open a new one to avoid reference to any variables set previously.

After the correct ORACLE_HOME setting the versions read as follows

OPatch version    : 13.1.0.0.0

OUI version       : 13.1.0.0.0

Note: The error can come also if the opatch version is old compared to the inventory version

Friday, August 1, 2014

ORA-39142: incompatible version number 4.1 in dump file with IMPDP

Scenario:

Import to a database using IMPDP is erroring out

Versions:

Source DB 12.1.0.1.0
Target DB 11.2.0.4.0

Error:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-39142: incompatible version number 4.1 in dump file "/u01/stage/schema_dump.dmp"

Reason:

As the error message rightly points out it is due to the incompatibility of EXPDP/IMPDP versions used.
Here the export was done using 12.1.0.1.0 EXPDP utility and dump created was tried to be imported using 11.2.0.4.0 IMPDP utility, resulting in the error.

Solution:

Use the "VERSION" option available with datapump.

The export data pump has the "VERSION" option which allows to create the dump file which is compatible with the previous releases.

Here is the syntax and description of VERSION from Oracle’s document.

VERSION={COMPATIBLE | LATEST | version_string}

The legal values for the VERSION parameter are as follows:

COMPATIBLE – This is the default value. The version of the metadata corresponds to the database compatibility level. 
Database compatibility must be set to 9.2 or higher.
LATEST – The version of the metadata corresponds to the database release.
version_string – A specific database release (for example, 11.2.0). In Oracle Database 11g, this value cannot be lower than 9.2.

Eg:

expdp system directory=EXPDP_DIR dumpfile=schema.dmp log=schema_expdp.log SCHEMAS=scott version=11.2.0.0.0