2022-10-01
ORACLE 11G RAC更新PSU时候遇到的java环境变量问题
10M(1)系统环境:
Linux node1 2.6.32-696.el6.x86_64 #1 SMP Tue Feb 21 00:53:17 EST 2017 x86_64 x86_64 x86_64 GNU/Lin
[root@node1 dbhome_1]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)
(2)grid用户的profile设置
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
alias ls="ll -at"
ORACLE_SID=+ASM1; export ORACLE_SID
JAVA_HOME=/usr/local/java;export JAVA_HOME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm;export ORACLE_TERM
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=american_america.ZHS16GBK
#alias sqlplus="rlwrap sqlplus"
umask 022
(3)系统profile设置
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`/usr/bin/id -u`
UID=`/usr/bin/id -ru`
fi
USER="`/usr/bin/id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi
HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
unset i
unset -f pathmunge
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
ORACLE 11G安装之后运行这好几年一直没打过补丁,趁着这次假期准备更新补丁。用的是2019年4月16日的补丁。
1,更新OPatch
[root@node1 grid]# mv OPatch/ OPatch.20220930.bak
[root@node1 grid]# unzip /tmp/psu20190416/p6880880_112000_Linux-x86-64.zip -d /u01/app/11.2.0/grid
[root@node1 grid]# chown -R grid:oinstall OPatch/
[root@node1 grid]# cd /u01/app/oracle/product/11.2.0/dbhome_1/
[root@node1 dbhome_1]# mv OPatch/ OPatch.20220930.bak
[root@node1 dbhome_1]# unzip /tmp/psu20190416/p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/dbhome_1/
[root@node1 dbhome_1]# chown -R oracle:oinstall OPatch/
[root@node1 dbhome_1]# su - grid
[grid@node1 ~]$ /u01/app/11.2.0/grid/OPatch/opatch version
然后就报错了
Java (1.6) could not be located. OPatch cannot proceed!
OPatch returns with error code = 1
而用之前版本的OPatch命令则没有报错
[grid@node1 ~]$ /u01/app/11.2.0/grid/OPatch.20220930.bak/opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
百度了一下,说是因为系统JAVA_HOME没设置的原因,在opatch命令后面跟上-jre就行,于是就试着操作一下
[grid@node1 ~]$ /u01/app/11.2.0/grid/OPatch/opatch version -jre /etc/alternatives/jre_1.6.0
OPatch Version: 11.2.0.3.21
OPatch succeeded.
嘿,还真的就行了
2,查询补丁情况,命令执行成功
命令执行成功,结果显示
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
OPatch succeeded.
[grid@node1 ~]$ /u01/app/11.2.0/grid/OPatch/opatch lspatches -jre /etc/alternatives/jre_1.6.0
There are no Interim patches installed in this Oracle Home "/u01/app/11.2.0/grid".
OPatch succeeded.
至此,看起来这个opatch命令加上-jre似乎正常执行了
3,正式更新补丁时候又报错
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /tmp/psu20190416 -patchn 29255947 -oh /u01/app/11.2.0/grid/ -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2022-10-01_00-34-32.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/grid/cfgtoollogs/opatchauto2022-10-01_00-34-32.report.log
2022-10-01 00:34:32: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
ERROR: Unable to run lspatches on /u01/app/11.2.0/grid
opatch auto failed.
opatch auto命令执行失败,根据这个错误ERROR提示,无法运行lspatches命令。再次加上-jre参数,更是无法执行
[root@node1 ~]# /u01/app/11.2.0/grid/OPatch/opatch auto /tmp/psu20190416/29255947/ -oh /u01/app/11.2.0/grid/ -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -jre /etc/alternatives/jre_1.6.0
Unknown option -jre
For help invoke 'opatch auto -h'
详细日志,请看下面的附件
请问各位,这种问题是什么原因导致的,该如何解决?看起来是JAVA环境变量的问题?
我来答
添加附件
收藏
分享
问题补充
5条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
附件列表
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏

评论


