Skip to content

Opatch Failed With Error Code 21 -

Open the most recent log file and search for the first occurrence of the word "ERROR" or "SEVERE". The real error often appears several lines before the final "error code 21". Step 2: Check OPatch Version Run:

opatch apply -debug The debug output will show every command OPatch tries to execute, making it easier to spot failures like missing make or file copy errors. If the error occurs during the relinking phase, try relinking manually before reapplying the patch:

The error message usually appears as:

opatch apply -local But you omitted -local (on a non-RAC environment), it might fail. Try running: opatch failed with error code 21

ls -la /u01/app/oraInventory/locks/* If lock files exist and no other OPatch process is running, remove them:

Checked inodes: df -i /tmp showed 100% inode usage due to millions of small temporary files. Cleaned /tmp and restarted. Patch succeeded. Case Study 3: Stale Inventory Lock After Power Outage Scenario: A power failure interrupted an OPatch session. After reboot, every OPatch command failed with error code 21.

By understanding the underlying mechanisms of OPatch and following the structured troubleshooting steps outlined in this article, you can confidently resolve error code 21 and keep your Oracle environments patched and secure. Open the most recent log file and search

rm -rf /u01/app/oraInventory/locks/* Ensure the entire Oracle home is owned by the correct user:

df -h $ORACLE_HOME df -h /tmp Check inodes (Linux/Unix):

$ORACLE_HOME/OPatch/opatch lsinventory -detail If that command also fails with error code 21, you may need to restore the inventory from a backup or recreate it using opatch inventory with repair options. If the log shows a patch conflict, you can use: If the error occurs during the relinking phase,

df -i /tmp df -i $ORACLE_HOME If space or inodes are critically low (e.g., 100% used), free up resources. Check for stale lock files:

$ORACLE_HOME/cfgtoollogs/opatch/opatch-YYYY-MM_DD_HH-MM-SS.log Alternatively, you can run OPatch with the -log flag to specify a custom log path.

Back to Top