Home

How to fix OPatch failed with error code 255?

Alton Alexander
By Alton AlexanderUpdated on June 4th, 2022

This error code happens when the OPatch utility is unable to apply a patch to a Oracle database. The reason this error code occurs is usually due to the fact that the system is either not in the correct state to apply the patch, or that the system does not have the required privileges to apply the patch. In some cases, it can also happen if the patch is not compatible with the current version of the Oracle database.

1. Check the environment variables and ensure that ORACLE_HOME and PATH are set correctly

  1. Open a terminal and type the following command export ORACLE_HOME=/u01/app/oracle
  2. Type the following command to verify that the ORACLE_HOME environment variable is set correctly echo $ORACLE_HOME
  3. Next, type the following command to verify that the PATH environment variable is set correctly echo $PATH
  4. If the PATH environment variable is not set correctly, type the following command to set the PATH environment variable export PATH=/u01/app/oracle/product/11.2.0/bin:$PATH
  5. Type the following command to restart your Oracle environment /u01/app/oracle/bin/oracledb.sh restart

2. Check for any process that may be using files that opatch is trying to update

  1. Check the system process list to see if opatch is using any files that are known to be outdated or that opatch may need to update.
  2. Check for any processes that may be using files that opatch is trying to update in order to fix opatch failed with error code 255.
  3. If there are any processes that are using files that opatch is trying to update, then stop those processes and update the files that opatch is trying to update.

3. Try running opatch with the -force option

  1. In a terminal window, type opatch -force.
  2. If prompted, enter the administrator password for your system.
  3. If the opatch command is not found on your system, you may need to install it. See the "Install opatch" section of this document for more information.
  4. If the opatch command is found on your system, you may need to modify its configuration. See the "Modify opatch configuration" section of this document for more information.
  5. If the opatch command is found on your system, and it is able to fix the problem, you may be prompted to restart your system. Do so, and then try running opatch again.

4. If the previous steps do not work, try uninstalling and then reinstalling opatch

If the previous steps do not work, try uninstalling and then reinstalling opatch in order to fix opatch failed with error code 255:

  1. Go to the Opatch installation directory.
  2. Uninstall opatch by typing the following command: opatch uninstall
  3. If opatch failed with error code 255, reinstall opatch by typing the following command: opatch install
  4. After reinstalling opatch, try installing opatch again.