PROBLEM:

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

$ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.1.0.1.10
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/12.1.0/dbtest
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/12.1.0/dbtest/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.2.0
Log file location : /oracle/app/oracle/product/12.1.0/dbtest/cfgtoollogs/opatch/opatch2017-02-16_15-30-33PM_1.log

Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


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
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /oracle/app/oracle/product/12.1.0/dbtest/cfgtoollogs/opatch/opatch2017-02-16_15-30-33PM_1.log

OPatch failed with error code 73

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.

Find which process are using the active executables  mentioned in the above error.

/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.

# $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.1.0.1.10
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/app/oracle/product/12.1.0/dbtest
Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/12.1.0/dbtest/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.2.0
Log file location : /oracle/app/oracle/product/12.1.0/dbtest/cfgtoollogs/opatch/opatch2017-02-16_15-33-59PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   19769480  20299023  20831110  21359755  21948354  22291127  23054246  24006101  24732082

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y



Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/12.1.0/dbtest')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '19769480' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.util, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.xdk.parser.java, 12.1.0.2.0...

Patching component oracle.oraolap, 12.1.0.2.0...

Patching component oracle.xdk.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20299023' to OH '/oracle/app/oracle/product/12.1.0/dbtest'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.rdbms.rsf.ic, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20831110' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '21359755' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.assistants.server, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '21948354' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.rdbms.deconfig, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.xdk.parser.java, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.xdk.rsf, 12.1.0.2.0...
Applying sub-patch '22291127' to OH '/oracle/app/oracle/product/12.1.0/dbtest'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.ldap.client, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.oraolap, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Applying sub-patch '23054246' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.rdbms.dv, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.ldap.rsf, 12.1.0.2.0...

Patching component oracle.install.deinstalltool, 12.1.0.2.0...

Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...

Patching component oracle.oracore.rsf, 12.1.0.2.0...

Patching component oracle.ctx, 12.1.0.2.0...

Patching component oracle.xdk, 12.1.0.2.0...

Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...

Patching component oracle.xdk.parser.java, 12.1.0.2.0...

Patching component oracle.ctx.atg, 12.1.0.2.0...
Applying sub-patch '24006101' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.sqlplus, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.network.listener, 12.1.0.2.0...

Patching component oracle.network.rsf, 12.1.0.2.0...

Patching component oracle.rdbms.dv, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

Patching component oracle.sqlplus.ic, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '24732082' to OH '/oracle/app/oracle/product/12.1.0/dbtest'

Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...

Patching component oracle.rdbms.rsf, 12.1.0.2.0...

Patching component oracle.tfa, 12.1.0.2.0...

Patching component oracle.rdbms.rman, 12.1.0.2.0...

Patching component oracle.rdbms, 12.1.0.2.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...

OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
+ PATH=/bin:/usr/bin:/usr/ccs/bin
+ export PATH
+ lib=/oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/libsqlplus.so
+ makefile=/oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/ins_sqlplus.mk
+ so_ext=so
+ target=dlopenlib
+ basename /oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/libsqlplus.so .so
+ libname=libsqlplus
+ dirname /oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/libsqlplus.so
+ sodir=/oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib
+ ardir=/oracle/app/oracle/product/12.1.0/dbtest/lib/
+ [ var '=' dlopenlib ]
+ suffix=LIBS
+ var=''
+ [ ! -f /oracle/app/oracle/product/12.1.0/dbtest/lib/libsqlplus.a ]
+ [ '' '!=' '' ]
+ make -f /oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/ins_sqlplus.mk dlopenlib _FULL_LIBNAME=/oracle/app/oracle/product/12.1.0/dbtest/sqlplus/lib/libsqlplus.so _LIBNAME=libsqlplus _LIBDIR=/oracle/app/oracle/product/12.1.0/dbtest/lib/ _LIBNAME_LIBS='$(libsqlplusLIBS)' _LIBNAME_EXTRALIBS='$(libsqlplusEXTRALIBS)'
ld: warning: symbol '_init' not found, but .init section exists - possible link-edit without using the compiler driver
ld: warning: symbol '_fini' not found, but .fini section exists - possible link-edit without using the compiler driver


Composite patch 24732082 successfully applied.

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.

[oracle@eaidb3 27072683]$ $ORACLE_HOME/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./
Oracle Interim Patch Installer version 12.2.0.1.8
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/12.1.0.2/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0.2/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.8
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/opatch/opatch2017-11-12_11-58-03AM_1.log

Invoking prereq "checkactivefilesandexecutables"

Prereq "checkActiveFilesAndExecutables" for patch 27072683 failed.

The details are:


Following executables are active :
/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle

OPatch succeeded.