首页 > 代码库 > 因为.patch_storage目录丢失,导致opatch打补丁失败

因为.patch_storage目录丢失,导致opatch打补丁失败

一套新装的ORACLE Restart环境(11.2.0.3.0),计划最新的PSU,在使用opath auto方式安装补丁时报错,表面上的错误信息提示opatch工具不满足版本要求:

[root@dmdb01 ~]# opatch auto /u01/20996944 -ocmrf /u01/file.rsp

Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/11.2.0.4/grid/OPatch/crs/patch11203.pl -patchdir /u01 -patchn 20996944 -ocmrf /u01/file.rsp -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

 

This is the main log file: /u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2017-04-08_04-45-04.log

 

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:

/u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2017-04-08_04-45-04.report.log

 

2017-04-08 04:45:04: Starting Oracle Restart Patch Setup

Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

The opatch minimum version check for patch /u01/20996944/17592127 failed for /u01/app/11.2.0.4/grid

The opatch minimum version check for patch /u01/20996944/20760997 failed for /u01/app/11.2.0.4/grid

Opatch version check failed for oracle home /u01/app/11.2.0.4/grid

Opatch version check failed

ERROR: update the opatch version for the failed homes and retry

 

opatch auto failed.

 

要求opatch工具的版本,发现已经是最新版本了,说明这个错误与opatch工具的版本无关。

[root@dmdb01 ~]# opatch version

OPatch Version: 11.2.0.3.15

 

OPatch succeeded.

[root@dmdb01 ~]#

 

在使用opatch auto打补丁时,生成了两个日志文件,查看opatchauto2017-04-08_04-45-04.log文件的内容,发现如下信息:

OPatch failed to lock and get an Inventory Session for the given Oracle Home /u01/app/11.2.0.4/grid

Possible causes are:

No read or write permission to $ORACLE_HOME, cannot create $ORACLE_HOME/.patch_storage

No read or write permission to $ORACLE_HOME/.patch_storage

OPatch cannot proceed further because system will not be able to backup files, or read the backup area for rollback/restore.

OPatchSession cannot load inventory for the given Oracle Home /u01/app/11.2.0.4/grid. Possible causes are:

No read or write permission to ORACLE_HOME/.patch_storage

Central Inventory is locked by another OUI instance

No read permission to Central Inventory

The lock file exists in ORACLE_HOME/.patch_storage

The Oracle Home does not exist in Central Inventory

 

UtilSession failed: IPMRWServices::verifyPatchStorageDirectory() cannot read or write to /u01/app/11.2.0.4/grid/.patch_storage

 

OPatch failed with error code 73

从以上日志,基本知道opatch报错原因了。

 

去$ORACLE_HOME 和$GRID_HOME下查看.patch_storage目录的权限,发现$GRID_HOME下基本就不存在.patch_storage目录,解决办法很简单,手动创建这个目录即可:

[root@dmdb01 grid]# mkdir .patch_storage

[root@dmdb01 grid]# chown grid:oinstall .patch_storage/

[root@dmdb01 grid]# su - oracle

[oracle@dmdb01 ~]$ cd $ORACLE_HOME

[oracle@dmdb01 db_home1]$ mkdir .patch_storage

mkdir: cannot create directory `.patch_storage‘: File exists

[oracle@dmdb01 db_home1]$

 

再次安装补丁,一切OK:

[root@dmdb01 u01]# opatch auto /u01/20996944 -ocmrf /u01/file.rsp

Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/11.2.0.4/grid/OPatch/crs/patch11203.pl -patchdir /u01 -patchn 20996944 -ocmrf /u01/file.rsp -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

 

This is the main log file: /u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2017-04-08_04-49-46.log

 

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:

/u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2017-04-08_04-49-46.report.log

 

2017-04-08 04:49:46: Starting Oracle Restart Patch Setup

Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

 

Stopping RAC /u01/app/oracle/product/11.2.0.4/db_home1 ...

Stopped RAC /u01/app/oracle/product/11.2.0.4/db_home1 successfully

 

patch /u01/20996944/17592127/custom/server/17592127 apply successful for home /u01/app/oracle/product/11.2.0.4/db_home1

patch /u01/20996944/20760997 apply successful for home /u01/app/oracle/product/11.2.0.4/db_home1

 

Stopping CRS...

Stopped CRS successfully

 

patch /u01/20996944/17592127 apply successful for home /u01/app/11.2.0.4/grid

patch /u01/20996944/20760997 apply failed for home /u01/app/11.2.0.4/grid

 

Starting CRS...

CRS-4123: Oracle High Availability Services has been started.

 

Starting RAC /u01/app/oracle/product/11.2.0.4/db_home1 ...

Started RAC /u01/app/oracle/product/11.2.0.4/db_home1 successfully

 

opatch auto succeeded.

[root@dmdb01 u01]#

处理故障,有时还是不能被表面现象迷惑。

因为.patch_storage目录丢失,导致opatch打补丁失败