Opatch Failed With Error Code 21 [updated] May 2026

For Oracle Database Administrators (DBAs), few things induce a cold sweat faster than seeing a red error message in the middle of a critical patching window. You have planned the downtime, tested the backup strategy, and downloaded the latest PSU or RU patch. You run the opatch apply command, the progress bar moves, and then—disaster. The process halts with the cryptic message: "OPatch failed with error code 21."

Navigate to this directory and look for the most recent log file (usually timestamped opatchYYYY-MM-DD_HH-MM-SSAM.log ). Open it and search for the keyword or "fuser" .

The most common reason for Error Code 21 is . Oracle uses a "fuser" mechanism to ensure that the files it is about to modify are not currently in use by the database or another process. If OPatch detects that a file to be patched is currently locked or "busy," it will fail with Code 21 to prevent data corruption. opatch failed with error code 21

If you see lines resembling: UtilSession failed: Patch [12345678] cannot be applied because some files are locked. ...then you are dealing with a file locking issue (Scenario 1). If the log indicates file locking, you must find the process holding the file.

cd $ORACLE_HOME/bin fuser <filename> Example: fuser oracle This command will output the Process IDs (PIDs) that are currently accessing that file. For Oracle Database Administrators (DBAs), few things induce

You can ask OPatch to check if the patch is applicable and if files are busy before actually applying it. While this doesn't fix the error post-facto, it is excellent for prevention.

Navigate to your $ORACLE_HOME/bin directory and run fuser on the libraries or binaries mentioned in the log file. The process halts with the cryptic message: "OPatch

This error is notorious in the Oracle community. It is a non-specific "catch-all" error code that essentially means OPatch failed to apply the patch, but it doesn't immediately tell you why . However, through years of community troubleshooting and Oracle support documentation, we have identified the primary culprits behind this failure.