PROBLEM:

While applying a patch to oracle binary using opatch utility, got below error.

SOLUTION:

While applying patch using opatch, all processes using that ORACLE_HOME should be done. If any of the processes are still using the ORACLE_HOME, It will fail with above error.

The error message clearly shows the active executables.

Following executables are active :
/oracle/app/oracle/product/12.1.0/dbtest/lib/libclntsh.so.12.1
Prerequisite check “CheckActiveFilesAndExecutables” failed.
The details are:

Following executables are active :
/oracle/app/oracle/product/12.1.0/dbtest/lib/libsqlplus.so

Now find the process id using below command.

/sbin/fuser /oracle/app/oracle/product/12.1.0/dbtest/lib/libclntsh.so.12.1
/oracle/app/oracle/product/12.1.0/dbtest/lib/libclntsh.so.12.1: 29275m 29785m

ps -ef | grep 29785
oracle 29785 1 0 Feb 15 ? 0:25 /oracle/app/oracle/product/12.1.0/dbtest/bin/tnslsnr LISTENER_TEST -inherit
oracle 13640 27442 0 15:32:51 pts/1 0:00 grep 29785

ps -ef | grep 29275
oracle 29275 29255 0 15:02:33 pts/2 0:00 sqlplus / as sysdba
oracle 13802 27442 0 15:33:16 pts/1 0:00 grep 29275

Kill both the process

kill -9 29785 29275

2.
/sbin/fuser /oracle/app/oracle/product/12.1.0/dbtest/lib/libsqlplus.so
/oracle/app/oracle/product/12.1.0/dbtest/lib/libsqlplus.so:

If this shows any process id , then those need to be killed also.

Now retry the opatch.

We have applied the patch successfully.

NOTE:

So before running the opatch apply command directly, it is better to run the below command, to check whether any process using the oracle binary or not.