Thursday, January 8, 2015

OPatch failed with error code 41

Got an error 'OPatch failed with error code 41' while applying a database patch using 'opatch apply'.

$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/product/11.2.0
Central Inventory : /u01/app/product/oraInventory
   from           : /u01/app/product/11.2.0/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.3.0
Log file location : /u01/app/product/11.2.0/cfgtoollogs/opatch/19731665_Jan_07_2015_23_00_18/apply2015-01-07_23-00-18PM_1.log
Applying interim patch '19731665' to OH '/u01/app/product/11.2.0'
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:
Following executables are active :
/u01/app/product/11.2.0/lib/libclntsh.so.11.1
Log file location: /u01/app/product/11.2.0/cfgtoollogs/opatch/19731665_Jan_07_2015_23_00_18/apply2015-01-07_23-00-18PM_1.log
Recommended actions: OPatch needs to modify files which are being used by some processes.
OPatch failed with error code 41
$
$ more /u01/app/product/11.2.0/cfgtoollogs/opatch/19731665_Jan_07_2015_23_00_18/apply2015-01-07_23-00-18PM_1.log
...................................................
.....................................................
.....................................................
[Jan 7, 2015 11:00:18 PM]    OPatch invoked as follows: 'apply -invPtrLoc /u01/app/product/11.2.0/oraInst.loc '
[Jan 7, 2015 11:00:18 PM]    OUI-67077:
                             Oracle Home       : /u01/app/product/11.2.0
                             Central Inventory : /u01/app/product/oraInventory
                                from           : /u01/app/product/11.2.0/oraInst.loc
                             OPatch version    : 11.2.0.3.0
                             OUI version       : 11.2.0.3.0
[Jan 7, 2015 11:00:25 PM]    [ Error during Prerequisite for apply phase ] Detail: OUI-67074:ApplySession failed during prerequisite
 checks: Prerequisite check "CheckActiveFilesAndExecutables" failed.
[Jan 7, 2015 11:00:25 PM]    OUI-67035:System is intact, OPatch will not restore the system
[Jan 7, 2015 11:00:25 PM]    Finishing ApplySession at Wed Jan 07 23:00:25 PST 2015
....................................................
....................................................
$

Solution:

1) Identify the OS process which is accessing following '/u01/app/product/11.2.0/lib/libclntsh.so.11.1' executable.

$ /sbin/fuser -v /u01/app/product/11.2.0/lib/libclntsh.so.11.1
                     USER        PID ACCESS COMMAND
/u01/app/product/11.2.0/lib/libclntsh.so.11.1:
                     oracle    15411 ....m tnslsnr
$
$ ps -ef|grep 15411
oracle   15411     1  0 Jan04 ?        00:00:08 /u01/app/product/11.2.0/bin/tnslsnr test123 -inherit
oracle   22166  6514  0 23:05 pts/0    00:00:00 grep 15411
$

Here listener is running. I stopped the listener and applied the patch. Sometimes we receive same 'OPatch failed with error code 41' issue with EM agent also, by that time kill/stop the EM agent services and apply the patch.

$ sh addlnctl.sh stop test123
Logfile: /u01/app/product/11.2.0/appsutil/log/test123_rws3510511/addlnctl.txt
You are running addlnctl.sh version 120.4
Shutting down listener process test123 ...
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 07-JAN-2015 23:08:04
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rws3510511.us.oracle.com)(PORT=1523)))
The command completed successfully
addlnctl.sh: exiting with status 0
addlnctl.sh: check the logfile /u01/app/product/11.2.0/appsutil/log/test123_rws3510511/addlnctl.txt for more information ...
$
$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/product/11.2.0
Central Inventory : /u01/app/product/oraInventory
   from           : /u01/app/product/11.2.0/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.3.0
Log file location : /u01/app/product/11.2.0/cfgtoollogs/opatch/19731665_Jan_07_2015_23_09_40/apply2015-01-07_23-09-40PM_1.log
....................
....................
....................
Verifying the update...
Patch 19731665 successfully applied
Log file location: /u01/app/product/11.2.0/cfgtoollogs/opatch/19731665_Jan_07_2015_23_09_40/apply2015-01-07_23-09-40PM_1.log
OPatch succeeded.
$

Thats it. Hope this will help you.. :)

Regards,
Chowdari 

Some Most Popular Articles