2016年10月18日oracle发布了最新补丁,手上有个11204的rac,顺手打上(patch auto方式打补丁)。
一.环境
1.数据库环境
操作系统版本 : centos 6.7
数据库版本 : Oracle 11.2.0.4 RAC
Grid : 11.2.0.4
Oracle database: 11.2.0.4
2.准备内容
GI PSU : p24436338_112040_Linux-x86-64.zip
OPatch : p6880880_112000_Linux-x86-64.zip
二、更新OPatch版本
OPatch下载地址:https://updates.oracle.com/download/6880880.html分别在两个节点更新OPatch版本:
[[email protected] ~]# cd /apps/11.2.0/grid [[email protected] grid]# mv OPatch OPatch.bak [[email protected] ~]# cd /apps/11.2.0/grid [[email protected] grid]# mv OPatch OPatch.bak [[email protected] ~]# cd /apps/oracle/11.2.0/db_1 [[email protected] db_1]# mv OPatch OPatch.bak [[email protected] ~]# cd /apps/oracle/11.2.0/db_1 [[email protected] db_1]# mv OPatch OPatch.bak [[email protected] ~]# cp p6880880_112000_Linux-x86-64.zip /apps/11.2.0/grid/ [[email protected] ~]# cd /apps/11.2.0/grid/ [[email protected] grid]# unzip p6880880_112000_Linux-x86-64.zip [[email protected] grid]# chown -R grid:oinstall OPatch [[email protected] ~]# cp p6880880_112000_Linux-x86-64.zip /apps/11.2.0/grid/ [[email protected] ~]# cd /apps/11.2.0/grid/ [[email protected] grid]# unzip p6880880_112000_Linux-x86-64.zip [[email protected] grid]# chown -R grid:oinstall OPatch [[email protected] ~]# cp p6880880_112000_Linux-x86-64.zip /apps/oracle/11.2.0/db_1/ [[email protected] ~]# cd /apps/oracle/11.2.0/db_1/ [[email protected] db_1]# unzip p6880880_112000_Linux-x86-64.zip [[email protected] db_1]# chown -R oracle:oinstall OPatch [[email protected] ~]# cp p6880880_112000_Linux-x86-64.zip /apps/oracle/11.2.0/db_1/ [[email protected] ~]# cd /apps/oracle/11.2.0/db_1/ [[email protected] db_1]# unzip p6880880_112000_Linux-x86-64.zip [[email protected] db_1]# chown -R oracle:oinstall OPatch
三.将补丁上传到所有节点并解压
[[email protected] apps]# unzip p24436338_112040_Linux-x86-64.zip [[email protected] apps]# chown -R grid:oinstall 24436338 [[email protected] apps]# unzip p24436338_112040_Linux-x86-64.zip [[email protected] apps]# chown -R grid:oinstall 24436338
四.检查需要打的补丁与现有补丁是否冲突
[[email protected] apps]$ cd 24436338/ [[email protected] 24436338]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ [[email protected] apps]$ cd 24436338/ [[email protected] 24436338]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
六.验证Inventory一致性
[[email protected] 24436338]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME [[email protected] 24436338]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
七.配置ocm响应文件
[[email protected] apps]# mkdir /apps/PSU [[email protected] apps]# chown -R grid:oinstall PSU [[email protected] apps]# su - grid [[email protected] ~]$ cd $ORACLE_HOME/OPatch/ocm/bin [[email protected] bin]$ ./emocmrsp -no_banner -output /apps/11.2.0/grid/OPatch/ocm/bin/ocm.rsp [[email protected] apps]# mkdir /apps/PSU [[email protected] apps]# chown -R grid:oinstall PSU [[email protected] apps]# su - grid [[email protected] ~]$ cd $ORACLE_HOME/OPatch/ocm/bin [[email protected] bin]$ ./emocmrsp -no_banner -output /apps/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
八.OPatch apply(所有节点均需执行)(无需关闭任何组件及资源)
可以使用root权限的用户自动为GI和DB打上PSU。必须在每一个节点都要执行,且GI home和DB home不是共享的。而且两个节点不可以并行执行。
[[email protected] ~]# /apps/11.2.0/grid/OPatch/opatch auto /PSU/24436338/ -ocmrf /apps/11.2.0/grid/OPatch/ocm/bin/ocm.rsp [[email protected] 11.2.0]# /apps/11.2.0/grid/OPatch/opatch auto /PSU/24436338/ -ocmrf /apps/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
grid用户验证:
su - grid
opatch lsinventory
oracle用户验证:
su - oracle
opatch lsinventory
在这一步可能会遇到问题:一般会报,The opatch minimum version check for patch
可能的原因有:
在/home/grid/目录下没有创建.patch_storage目录
grid用户的$ORACLE_HOME没有写权限
没有在空目录下解压patch
九.升级数据字典(只在一个节点运行)
cd $ORACLE_HOME/rdbms/admin [[email protected] admin]$ sqlplus / as sysdba SQL> @catbundle.sql psu apply SQL> set line 150 SQL> col action_time for a30 SQL> col action for a8 SQL> col namespace for a8 SQL> col version for a10 SQL> col bundle_series for a5 SQL> col comments for a40 SQL> select * from dba_registry_history; ACTION_TIME ACTION NAMESPAC VERSION ID BUNDL COMMENTS ------------------------------ -------- -------- ---------- ---------- ----- ---------------------------------------- 24-AUG-13 12.03.45.119862 PM APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0 24-OCT-16 04.57.07.916237 AM APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0 24-OCT-16 10.49.21.585728 AM APPLY SERVER 11.2.0.4 161018 PSU PSU 11.2.0.4.161018 3 rows selected.
打补丁前请阅读readme