准备给客户升级数据库,下载最新的opath之后,解压缩,查看当前的opatch补丁,但是却出现报错:
$ ./opatch lsinventory
Java could not be located. OPatch cannot proceed!
OPatch returns with error code = 1
百度搜索了一下,基本都是说java不对或者说ORACLE_HOME不对.但是我这里的环境都是正确的.
检查opatch的README发现有如下一段:
How to install the utility:
---------------------------To install this patch, Please extract the file "zipped file" using unzip or winzip,
depending upon the platform. You should extract the zip file directly under the
ORACLE_HOME. Please follow the following steps for extracting the zip file of OPatch.(1) Please take a backup of ORACLE_HOME/OPatch into a dedicated backup
location.
(2) Please make sure no directory ORACLE_HOME/OPatch exist.
(3) Please unzip the OPatch downloaded zip into ORACLE_HOME directory.
这里客户的环境为HP-UX,由于系统没有安装unzip,所以使用的是java -jar来解压缩,当时安装oracle的时候,就发现用java -jar来解压缩会出现权限的问题,导致无法运行图形化安装界面.那么这里也很可能是因为解压缩的方式不对导致.
根据实验发现用java -jar来解压缩,不能保持原来文件的权限,会导致各种奇怪的问题,所以必须使用unzip来解压缩.
手工将OPath目录赋予777权限后恢复正常,但是建议不要这么做,这样之后发现在打补丁的时候会出现一些chmod错误,所以建议还是先安装unzip工具,进行解压缩,再安装补丁.