oracle 打补丁常见问题

psu下载文档 ID   Master Note for Database Proactive Patch Program (文档 ID 756671.1)
url:https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=19mcxkl5d5_4&id=756671.1&_afrLoop=347413785398928

oracle打补丁相对来说很简单,特别是12C的 opatchauto 打补丁更是简单的许多,简直是一键操作,但也有一些注意事项:

1.使用新版的Opatch替换原有的Opatch在$ORACLE_HOME里

2.注意Opatch的权限

3.关闭数据库、监听、adrci就是确保$ORACLE_HOME下面的所有文件都没有被使用

具体过程就不操作了,都是操作的活,很简单,下面只是列出一些常见的错误供参考:


更新opatch,此步骤注意权限问题,主要设置chmod -R 775 OPatch && chown -R oracle:oinstall OPatch

$unzip p6880880_112000_Linux-x86-64.zip

$cd $ORACLE_HOME


$mv OPatch OPatch-bak

$pwd
/u01/app/oracle/product/11.2.0/dbhome_1

$mv ~/patch/OPatch OPatch


$chmod -R 775 OPatch


$./opatch version
OPatch Version: 11.2.0.3.19

OPatch succeeded.


解压补丁,此步骤也简单,但是也得注意权限问题,设置 chmod -R 775 28317183 && chown -R oracle:oinstall 28317183

$unzip p28317183_112040_Linux-x86-64.zip


inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/net/resolver/AddrResolution.class 
   creating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/OracleDatabaseMetaData.class 
   creating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/T4CConnection.class 
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/T4CConnection$1.class 
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/OracleSql$1.class 
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/OracleSql$ParseMode.class 
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/driver/OracleSql.class 
   creating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/oracore/
  inflating: 28317183/27923163/files/jdbc/lib/ojdbc5_g.jar/oracle/jdbc/oracore/OracleTypeCOLLECTION.class 
  inflating: PatchSearch.xml        


opatch apply  此步骤出问题最多,如果前面的权限设置了,那么的权限的问题基本不成问题,问题最多的就是上面所讲的:关闭数据库、监听、adrci就是确保$ORACLE_HOME下面的所有文件都没有被使用

看下面例子:

$/s01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch apply
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2018, Oracle Corporation.  All rights reserved.


Oracle Home       : /s01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /s01/app/oraInventory
    from           : /s01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.19
OUI version       : 11.2.0.4.0
Log file location : /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch3018-09-20_14-17-04PM_1.log

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


Following executables are active :
/s01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
/s01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:


Following executables are active :
/s01/app/oracle/product/11.2.0/dbhome_1/lib/libsqlplus.so  ###此处说明sqlplus 没有退出,因此失败,因为opatch apply有可能会改变文件
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch3018-09-20_14-17-04PM_1.log

OPatch failed with error code 73

解决方法:

退出sqlplus


下面这个错误比较特备,在redhat 6上面基本上不会出现,此是在redhat 7.5上面出现的,7精简安装默认不安装psmisc包,说白了就是少安装了包,缺少fuser命令,这也很好的解释为什么需要确保$ORACLE_HOME下面的所有文件都没有被使用,其实oracle在opatch apply补丁的时候需要检查的有误文件在使用,就像上面的报错:

$/s01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch apply
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2018, Oracle Corporation.  All rights reserved.


Oracle Home       : /s01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /s01/app/oraInventory
    from           : /s01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.19
OUI version       : 11.2.0.4.0
Log file location : /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch3018-09-20_14-12-19PM_1.log

Verifying environment and performing prerequisite checks...
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser     ########提示缺少fuser命令

Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
UtilSession failed:
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Prerequisite check "CheckSystemCommandAvailable" failed.
Log file location: /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch3018-09-20_14-12-19PM_1.log

OPatch failed with error code 73

解决方法:

#yum install psmisc