-
1.1 环境检查及包下载
说明:/u01空间不够备份,由于测试环境可以冒险一试
$ORACLE_HOME/OPatch/opatch version 版本需要在 11.2.0.3.6及其以上,目前环境不满足
OPatch Version: 11.2.0.3.6 or later
1.2 上传补丁包p30805461到/u01/soft
1.3 更新 opatch到较高版本
下载p6880880最新版本,参照 How To Download And Install The Latest OPatch(6880880) Version (Doc ID 274526.1)
下载,选择中间版本12.2.0.1.0
-
4 备份GRID、ORACLE、oraInventory目录。(说明$GI_HOME(
)代表grid用户下的$ORACLE_HOME)
grid用户停止数据库
srvctl stop database -d htdb
srvctl status database -d htdb
Instance htdb1 is not running on node htdb1
Instance htdb2 is not running on node htdb2
srvctl stop database -d longs
停止crs
[root@htdb1 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs
su - grid
[grid@htdb1 ~]$ env |grep ORA
ORACLE_SID=+ASM1
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/11.2.0/grid
su - oracle
Password:
[oracle@htdb1 ~]$ env |grep ORA
ORACLE_SID=htdb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
# su - root
export GI_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/
$GI_HOME/OPatch/opatch -version -jre /usr/java/jre1.8.0_261-amd64/
cd /u01/soft/
[root@htdb1 soft]# chown grid:oinstall p30805461_112040_Linux-x86-64.zip
[root@htdb1 soft]# chmod 776 *.zip
1.5 解压opatch,PSU
unzip p6880880_122010_LINUX.zip
[root@htdb1 soft]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 15G 2.5G 86% /
tmpfs 931M 72K 931M 1% /dev/shm
[root@htdb1 soft]# rm -f p6880880_122010_LINUX.zip
[root@htdb1 soft]# unzip p30805461_112040_Linux-x86-64.zip
还未解压完成,空间已经满了
准备给虚拟机新建磁盘8G空间,挂载到/u01/soft下
rm -fR 30805461/
[root@htdb1 soft]# df -hh
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 15G 2.6G 85% /
tmpfs 931M 72K 931M 1% /dev/shm
[root@htdb1 soft]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ef82e
Device Boot Start End Blocks Id System
/dev/sda1 1 262 2097152 82 Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 262 2611 18873344 83 Linux
Disk /dev/sdb: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdc: 20.2 GB, 20199768064 bytes
64 heads, 32 sectors/track, 19264 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/mpatha: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/mpathb: 20.2 GB, 20199768064 bytes
255 heads, 63 sectors/track, 2455 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
新加一块盘之后 fdisk -l
fdisk /dev/sdb
输入 n p 1 w
mkfs.ext4 /dev/sdb1之后
mkdir -p /u01/soft1
[root@htdb1 ~]# mount /dev/sdb1 /u01/soft1
[root@htdb1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 15G 2.6G 85% /
tmpfs 931M 72K 931M 1% /dev/shm
/dev/sdb1 7.8G 18M 7.4G 1% /u01/soft1
[root@htdb1 ~]# cd /u01/soft
[root@htdb1 soft]# ls -lrt
total 1248140
-rw-r--r-- 1 root root 207399 Mar 13 21:41 pdksh-5.2.14-30.x86_64.rpm
drwxr-x--- 14 root root 4096 Apr 22 18:55 OPatch
-rwxrwxrw- 1 grid oinstall 1277877242 Aug 11 15:33 p30805461_112040_Linux-x86-64.zip
[root@htdb1 soft]# mv p30805461_112040_Linux-x86-64.zip /u01/soft1/
unzip p30805461_112040_Linux-x86-64.zip
chown -R grid:oinstall /u01/soft1/
1.6替换opatch(root):
mv $GI_HOME/OPatch $GI_HOME/OPatch.bak
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.bak
cp -r /u01/soft/OPatch $GI_HOME
cp -r /u01/soft/OPatch $ORACLE_HOME
$GI_HOME/OPatch/opatch -version
/u01/app/11.2.0/grid/OPatch/opatch: line 839: [: too many arguments
/u01/app/11.2.0/grid/OPatch/opatch: line 839: [: too many arguments
Java (1.7) could not be located. OPatch cannot proceed!
OPatch returns with error code = 1
java版本过低
java -version
java version "1.7.0_99"
OpenJDK Runtime Environment (rhel-2.6.5.1.el6-x86_64 u99-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
https://www.java.com/zh_CN/download/linux_manual.jsp
安装 rpm -ivh jre-8u261-linux-x64.rpm
检查版本
java -versin
Unrecognized option: -versin
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[root@htdb1 redis-6.0.6]# java -version
java version "1.8.0_261"
$ORACLE_HOME/OPatch/opatch version –jre /usr/java/jre1.8.0_261-amd64
/u01/app/oracle/product/11.2.0/db_1/OPatch/opatch: line 839: [: too many arguments
/u01/app/oracle/product/11.2.0/db_1/OPatch/opatch: line 839: [: too many arguments
Java (1.7) could not be located. OPatch cannot proceed!
OPatch returns with error code = 1
http://blog.itpub.net/35489/viewspace-744473/
grid:
export GI_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/
$GI_HOME/OPatch/opatch -version -jre /usr/java/jre1.8.0_261-amd64/
报错1:root无法执行 $GI_HOME/OPatch/opatch -version -jre /usr/java/jre1.8.0_261-amd64/
2 opatch版本和OUL不匹配,需要11.2.0.4的,目前是12的
去掉version前面-号可以
二 打补丁
启动crs及数据库实例
root:/u01/app/11.2.0/grid/bin/crsctl start crs
grid: srvctl start instance -d htdb -i htdb1
srvctl start instance -d longs -i longs1
2.1 创建ocm文件并打补丁(root/grid/oracle):
export GI_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
/u01/app/11.2.0/grid/OPatch/ocm/bin/emocmrsp -no_banner -output /tmp/ocm.rsp
chmod 775 /tmp/ocm.rsp
由于没有emocmrsp命令文件,执行报错如下(该步骤可以忽略跳过)
2.2 打补丁(root)
grid安装目录的属主为ROOT用户,给grid用户写的权限,因为PATCH安装时是分别用GRID和orale用户执行的,
grid用户需要在$ORACLE_HOME/目录建立.patch_storage 目录,可见后面报错信息.
cd /u01/app/grid/product/11.2.0
mkdir .patch_storage
chown -R grid:oinstall .patch_storage
chmod -R 776 .patch_storage
--chmod 775 -R /u01/app/11.2.0/grid
--检查数据库配置信息:srvctl config database -d tycl -a
su - root
export PATH=$PATH
export GI_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
### $GI_HOME/OPatch/opatch auto /u01/soft/patch/31305209 -ocmrf /tmp/ocm.rsp
$GI_HOME/OPatch/opatch auto /u01/soft1/30805461/
查看日志
其中vi 日志 根据关键字error找到以上报错
空间问题暂时无法解决,根目录 / 及 rootvg是安装系统时候分配的大小
三 总结:问题两个 1 java版本问题 2 空间问题,看来这个补丁大约需要5G以上剩余空间。
失败是成功之母,找到问题根源就好,下次格外小心。