Opatch Failed With Error Code 21 May 2026
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:
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.
ls -la /u01/app/oraInventory/locks/* If lock files exist and no other OPatch process is running, remove them: opatch failed with error code 21
The error message usually appears as:
cd $ORACLE_HOME/bin relink all Then retry OPatch. Case Study 1: OPatch Version Too Old Scenario: A DBA tried to apply a critical bug fix on Oracle 19.16. The patch README required OPatch 13.9.4.2.0. The system had 12.2.0.1.7. Error code 21 appeared immediately after the prerequisite check. df -i /tmp df -i $ORACLE_HOME If space
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:
Upgraded OPatch to version 13.9.4.2.0. The patch applied successfully. Case Study 2: /tmp Full of Old JAR Extractions Scenario: A middleware admin repeatedly failed with error code 21 on a WebLogic patch. Logs showed "No space left on device" even though df -h /tmp showed 30% free. Case Study 1: OPatch Version Too Old Scenario:
$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.
