Monday, December 2, 2013

How to fix “OPatch failed with error code 41”

 

Symptom:


[oracle@gc12c 17027533]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation. All rights reserved.


Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.0
OUI version : 12.1.0.1.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/17027533_Dec_02_2013_18_09_09/apply2013-12-02_18-09-09PM_1.log

Applying interim patch '17027533' to OH '/u01/app/oracle/product/12.1.0/dbhome_1'
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


Following executables are active :
/u01/app/oracle/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1
Log file location: /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/17027533_Dec_02_2013_18_09_09/apply2013-12-02_18-09-09PM_1.log


Recommended actions: OPatch needs to modify files which are being used by some processes.

OPatch failed with error code 41




Fix: find out which process is currently use it, and kill it



[oracle@gc12c 17027533]$ fuser /u01/app/oracle/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1
/u01/app/oracle/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1: 4063m
[oracle@gc12c 17027533]$ ps up 4063
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
oracle 4063 0.0 0.2 81256 11400 pts/2 S+ 11:41 0:02 adrci
[oracle@gc12c 17027533]$ kill 4063
[oracle@gc12c 17027533]$ ps up 4063
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[oracle@gc12c 17027533]$ fuser /u01/app/oracle/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1