opatch报补丁时,oui-patch.xml (Permission denied)报错

发布时间 2023-09-12 12:08:37作者: 石云华

前言

一套19.19 RAC环境,使用opatch工具安装数据库补丁,第一个节点成功安装,但在第二个节点执行opatch命令时报错。主要的错误有提示:/u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied),具体如下所示。

[grid@19crac2 35074478]$ $ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local /software/35074478/35074478

Oracle Interim Patch Installer version 12.2.0.1.36

Copyright (c) 2023, Oracle Corporation.  All rights reserved.

 

 

Oracle Home       : /u01/app/19.0.0/grid

Central Inventory : /u01/app/oraInventory

   from           : /u01/app/19.0.0/grid/oraInst.loc

OPatch version    : 12.2.0.1.36

OUI version       : 12.2.0.7.0

Log file location : /u01/app/19.0.0/grid/cfgtoollogs/opatch/opatch2023-09-08_15-43-51PM_1.log

 

Verifying environment and performing prerequisite checks...

OPatch continues with these patches:   35074478 

 

Do you want to proceed? [y|n]

y

User Responded with: Y

All checks passed.

 

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.

(Oracle Home = '/u01/app/19.0.0/grid')

 

 

Is the local system ready for patching? [y|n]

y

User Responded with: Y

Backing up files...

Applying interim patch '35074478' to OH '/u01/app/19.0.0/grid'

 

Patching component oracle.rdbms.rsf, 19.0.0.0.0...

 

Patching component oracle.rdbms, 19.0.0.0.0...

ApplySession failed in system modification phase... 'ApplySession::apply failed: java.io.IOException: oracle.sysman.oui.patch.PatchException: java.io.FileNotFoundException: /u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)'

 

Restoring "/u01/app/19.0.0/grid" to the state prior to running NApply...

 

#### Stack trace of processes holding locks ####

 

Time: 2023-09-08_03-43-53PM

Command: oracle/opatch/OPatch apply -oh /u01/app/19.0.0/grid -local /software/35074478/35074478 -invPtrLoc /u01/app/19.0.0/grid/oraInst.loc

Lock File Name: /u01/app/oraInventory/locks/_u01_app_19.0.0_grid_writer.lock

StackTrace:

-----------

java.lang.Throwable

        at oracle.sysman.oii.oiit.OiitLockHeartbeat.writeStackTrace(OiitLockHeartbeat.java:193)

        at oracle.sysman.oii.oiit.OiitLockHeartbeat.<init>(OiitLockHeartbeat.java:173)

        at oracle.sysman.oii.oiit.OiitTargetLocker.getWriterLock(OiitTargetLocker.java:346)

        at oracle.sysman.oii.oiit.OiitTargetLocker.getWriterLock(OiitTargetLocker.java:238)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.acquireLocks(OiicStandardInventorySession.java:564)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initAreaControl(OiicStandardInventorySession.java:359)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:332)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:294)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:243)

        at oracle.sysman.oui.patch.impl.HomeOperationsImpl.initialize(HomeOperationsImpl.java:107)

        at oracle.glcm.opatch.common.api.install.HomeOperationsShell.initialize(HomeOperationsShell.java:117)

        at oracle.opatch.ipm.IPMRWServices.addPatchCUP(IPMRWServices.java:134)

        at oracle.opatch.ipm.IPMRWServices.add(IPMRWServices.java:146)

        at oracle.opatch.ApplySession.apply(ApplySession.java:898)

        at oracle.opatch.ApplySession.processLocal(ApplySession.java:4109)

        at oracle.opatch.ApplySession.process(ApplySession.java:4979)

        at oracle.opatch.ApplySession.process(ApplySession.java:4841)

        at oracle.opatch.OPatchACL.processApply(OPatchACL.java:310)

        at oracle.opatch.opatchutil.NApply.legacy_process(NApply.java:1415)

        at oracle.opatch.opatchutil.NApply.legacy_process(NApply.java:373)

        at oracle.opatch.opatchutil.NApply.process(NApply.java:353)

        at oracle.opatch.opatchutil.OUSession.napply(OUSession.java:1138)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at oracle.opatch.UtilSession.process(UtilSession.java:355)

        at oracle.opatch.OPatchSession.process(OPatchSession.java:2643)

        at oracle.opatch.OPatch.process(OPatch.java:873)

        at oracle.opatch.OPatch.main(OPatch.java:930)

 

 ------------------------------------

 

OPatch failed to restore OH '/u01/app/19.0.0/grid'. Consult OPatch document to restore the home manually before proceeding.

 

NApply was not able to restore the home.  Please invoke the following scripts:

  - restore.[sh,bat]

  - make.txt (Unix only)

to restore the ORACLE_HOME.  They are located under

"/u01/app/19.0.0/grid/.patch_storage/NApply/2023-09-08_15-43-51PM"

 

UtilSession failed: ApplySession failed in system modification phase... 'ApplySession::apply failed: java.io.IOException: oracle.sysman.oui.patch.PatchException: java.io.FileNotFoundException: /u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)'

Log file location: /u01/app/19.0.0/grid/cfgtoollogs/opatch/opatch2023-09-08_15-43-51PM_1.log

 

OPatch failed with error code 73

[grid@19crac2 35074478]$

 

1、从错误日志可以看出,最主要的原因是/u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)。提示oui-patch.xml文件没有权限。

关于oui-patch.xml文件相关的故障案例很多,以前也遇到过几次,基本上都是因为安装补丁的节点上不存在该文件,或者该文件的权限异常,需要为660权限。

2、进入/u01/app/oraInventory/ContentsXML/目录,发现存在oui-patch.xml文件,权限也正常。

3、执行opatch lspatches命令,查看当前节点的补丁情况,计划回退刚刚安装的补丁。发现opatch相关的所有命令都报错。例如opatch lspatches命令输出如下所示。

[grid@19crac2 35074478]$ opatch lspatches

Inventory load failed... LsPatchesSession::loadAndPrintInstalledPatch()

LsPatchesSession failed: Unable to create patchObject

Possible causes are:

   ORACLE_HOME/inventory/oneoffs/35074478 is corrupted. PatchObject constructor: Input file "/u01/app/19.0.0/grid/inventory/oneoffs/35074478/etc/config/actions" or "/u01/app/19.0.0/grid/inventory/oneoffs/35074478/etc/config/inventory" does not exist.

 

 

OPatch failed with error code 2

[grid@19crac2 35074478]$

 

4、根据OPatch lsinventory or Apply New Patch With Opatch apply Fails With Error "Unable to create patchObject" Inventory Corrupted (Doc ID 2792549.1)文章的解决方案,将成功节点已经安装好的补丁复制至该节点,故障解决。

[grid@19crac1 35074478]$ cd $ORACLE_HOME/inventory/oneoffs/

[grid@19crac1 oneoffs]$ tar -cvf 35074478.tar 35074478

[grid@19crac1 oneoffs]$ scp 35074478.tar 19crac2:/u01/app/19.0.0/grid/inventory/oneoffs

[grid@19crac1 oneoffs]$ rm -rf *.tar

 

[grid@19crac1 35074478]$ cd $ORACLE_HOME/inventory/oneoffs/

[grid@19crac2 oneoffs]$ tar -xvf *.tar

[grid@19crac2 oneoffs]$ rm *.tar

 

[grid@19crac2 oneoffs]$ opatch lspatches

35074478;MERGE ON DATABASE RU 19.19.0.0.0 OF 34932268

35107512;TOMCAT RELEASE UPDATE 19.0.0.0.0 (35107512)

35050331;OCW RELEASE UPDATE 19.19.0.0.0 (35050331)

35050325;ACFS RELEASE UPDATE 19.19.0.0.0 (35050325)

35042068;Database Release Update : 19.19.0.0.230418 (35042068)

33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)

 

OPatch succeeded.

[grid@19crac2 oneoffs]$

可以看出,新安装的补丁也提示成功。