测试环境:

oracle 12.2.0.1 rac 2 nodes

环境配置:

type homepath owner version shared
GI /u01/app/12.2.0/grid grid 12.2.0.1 no
DB1 /u01/app/oracle/product/12.2.0/dbhome_1 oracle 12.2.0.1 no
DB2 /u01/app/oracle/product/12.2.0/dbhome_1 oracle 12.2.0.1 no

下载最新版本的opatch 6880880

解压到GI 和 DB 目录下面,两个节点都要操作

使用grid用户

[grid@rac1 grid]$ unzip /home/oracle/p6880880_122010_Linux-x86-64.zip -d .

使用oracle用户

[oracle@rac1 dbhome_1]$ unzip /home/oracle/p6880880_122010_Linux-x86-64.zip -d .

patch 文件

[root@rac2 oracle]# unzip p28183653_122010_Linux-x86-64.zip

chmod -R 775 28183653

12cR2版本就不需要以前的ocm 响应文件了

创建wallet

如果使用非root用户,则必须要生成对应用户的wallet

命令参数

[grid@rac1 bin]$ pwd
/u01/app/12.2.0/grid/OPatch/auto/core/bin

[grid@rac1 bin]$ ./patchingWallet.sh -help
Usage: run patchingWallet.cmd or patchingWallet.sh with the following parameters:
   [ options ] { -create | -delete | -list } alias ...
    Supported alias format ::  >userName>:>hostName>{:}{/}>protocol>
    Examples : 
            abc:xyz:ssh
            abc:xyz/ssh

       -walletDir - >Path to wallet directory.>
       [-password - If you should be prompted for the wallet password.]
       [-useStdin - >Read passwords from stdin rather than attempting to use Console.>]
            [-map - >Map name within wallet.>]
          [-force - >Force overwrite of existing aliases.>]
           [-list - List wallet]
        [-listmap - List maps available in  wallet]
         [-create - Create alias]
         [-delete - Delete alias]
   [-log_priority - >Log priority. Supported values: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL.>]
            [-log - >Log file. The value can be a filename or one of the special values STDOUT, STDERR, or DISABLE.>]
           [-help - >Displays usage.>]


使用grid用户:

[grid@rac1 bin]$ ./patchingWallet.sh -walletDir /u01/app/grid/wallet -create grid:rac1:ssh grid:rac2:ssh -log /u01/app/grid/wallet/wallet.log
Session log file is /u01/app/grid/wallet/wallet.log
Enter Password for grid:rac1:ssh:
Confirm Password for grid:rac1:ssh:
Enter Password for grid:rac2:ssh:
Confirm Password for grid:rac2:ssh:

采用ssh协议 输入对应的密码即可

检查补丁冲突

[grid@rac1 bin]$ /u01/app/12.2.0/grid/OPatch/opatchauto apply /home/oracle/28183653 -oh /u01/app/12.2.0/grid -analyze -wallet /u01/app/grid/wallet

OPatchauto session is initiated at Wed Sep 26 15:28:29 2018

System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2018-09-26_03-28-38PM.log.

Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2018-09-26_03-29-24PM.log
The id for this session is SQGY
[sudo] password for grid: grid is not in the sudoers file.  This incident will be reported.

OPatchAuto failed.

OPatchauto session completed at Wed Sep 26 15:29:28 2018
Time taken to complete the session 0 minute, 59 seconds

 opatchauto failed with error code 42

有报错,因为我这里采用的grid用户 提示grid不是sudoer 添加grid到sudo

[root@rac1 oracle]# whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.d /usr/share/man/man5/sudoers.5.gz

Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
grid ALL=(ALL)       ALL
……

阅读全文