一、自动升级方法
使用auto方式在两节点分别进行PSU的安装,安装PSU前注意更新opatch工具至PSU所要求版本,p22191577补丁包括GI和DB,分别执行即可。
两节点分别grid用户执行,生成ocm.rsp文件,该文件仅生成一次即可,后续为DB安装PSU依然可以使用,如下为生成ocm.rsp文件:
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -output /tmp/ocm.rsp
chmod 775 /tmp/ocm.rsp
root用户执行, /oracle/orainstall/22191577为psu介质存放目录,打GI补丁
/oracle/app/11.2.0/grid/OPatch/opatch auto /oracle/orainstall/22191577 -ocmrf /tmp/ocm.rsp
root用户执行,/oracle/orainstall/22191577为psu介质存放目录,-oh指向DB的ORACLE_HOME,,打DB补丁
/oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch auto /oracle/orainstall/22191577 -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /tmp/ocm.rsp
二、手动升级方法
升级准备
查询两个节点grid opatch版本(Opatch版本必需是11.2.0.3或更高的版本)
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ cd $ORACLE_HOME
[grid@rac1 grid]$ OPatch/opatch version
OPatch Version: 11.2.0.3.5
OPatch succeeded.
查询已安装补丁情况
[grid@rac1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
13696216;Database Patch Set Update : 11.2.0.3.2 (13696216)
13696251;Grid Infrastructure Patch Set Update : 11.2.0.3.2 (13696251)
节点2操作相同,查询两个节点oracle 用户opatch版本
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.5
OPatch succeeded.
查询已安装补丁情况
[oracle@rac1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
13696216;Database Patch Set Update : 11.2.0.3.2 (13696216)
13696251;Grid Infrastructure Patch Set Update : 11.2.0.3.2 (13696251)
节点2操作相同,上传补丁介质
[root@rac1 ~]# cd /u01/app/
[root@rac1 app]# mkdir patches
[root@rac1 app]# chown grid:oinstall patches
[root@rac1 app]# su - grid
[grid@rac1 ~]$ cd /u01/app/patches/
[grid@rac1 patches]$ ls
p14275572_1120304_Linux-x86-64.zip
节点2操作相同,解压补丁(使用grid用户执行)
[root@rac1 patches]# su grid
[grid@rac1 patches]$ unzip p14275572_1120304_Linux-x86-64.zip
节点2操作相同,补丁冲突检查,Grid用户执行1
$ opatch prereq CheckConflictAgainstOHWithDetail -ph <UNZIPPED_PATCH_LOCATION>/14275605 –oh $GRID_HOME
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph 14275605 -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.5
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/11.2.0/grid/oraInst.loc
OPatch version : 11.2.0.3.5
OUI version : 11.2.0.3.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2014-08-19_07-20-36AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
节点2操作相同,Grid用户执行2
$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/14275572 –oh $GRID_HOME
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir 14275572 -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.5
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/11.2.0/grid/oraInst.loc
OPatch version : 11.2.0.3.5
OUI version : 11.2.0.3.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2014-08-19_08-16-08AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
节点2操作相同,Oracle用户执行1
$ opatch prereq CheckConflictAgainstOHWithDetail -ph <UNZIPPED_PATCH_LOCATION>/14275605 –oh $DB_HOME
[oracle@rac1 ~]$ cd /u01/app/patches/
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph 14275605 -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.5
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.5
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-08-19_08-37-12AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
节点2操作相同,Oracle用户执行2
$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572 –oh $DB_HOME
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir 14275572/custom/server/14275572 -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.5
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.5
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-08-19_08-40-19AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
节点2操作相同,停止EM服务(oracle用户执行)
[oracle@rac1 patches]$ emctl stop dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
[oracle@rac1 patches]$ env |grep ORACLE
ORACLE_SID=enmo1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@rac1 patches]$ export ORACLE_UNQNAME=enmo
[oracle@rac1 patches]$ emctl stop dbconsole
节点2操作相同,操作步骤
- 停止应用补丁节点DB(oracle用户执行)
$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ srvctl stop home -o $ORACLE_HOME -s /home/oracle/state_file.txt -n rac1
节点2操作相同
[oracle@rac2 ~]$ srvctl stop home -o $ORACLE_HOME -s /home/oracle/state_file.txt -n rac2
- 停止crs集群(使用root用户执行)
# <GI_HOME>/crs/install/rootcrs.pl -unlock
[root@rac1 ~]# $ORACLE_HOME/crs/install/rootcrs.pl –unlock
节点2操作相同
注:停止集群后使用ps –ef | grep ora确保所有oracle进程已经停止,否则会出现文件占用报错,无法应用补丁。
升级
- 应用crs补丁(grid用户执行)
$ <GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/14275572
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /u01/app/patches/14275572
节点2操作相同,应用crs补丁2(grid用户执行)
$ <GI_HOME>/OPatch/opatch apply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/14275605
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local /u01/app/patches/14275605
节点2操作相同
- 应用db组件补丁前执行脚本(oracle用户执行)
$ <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 ~]$ cd /u01/app/patches
[oracle@rac1 patches]$ 14275572/custom/server/14275572/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
节点2操作相同
- 应用DB补丁(oracle用户执行)
$ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local 14275572/custom/server/14275572
节点2操作相同,应用DB补丁2(oracle用户执行)
$ <ORACLE_HOME>/OPatch/opatch apply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/14275605
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local 14275605
节点2操作相同
- 应用DB补丁后执行脚本(oracle用户执行)
$ <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 patches]$ 14275572/custom/server/14275572/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
节点2操作相同
- 使用root用户执行脚本
# <GI_HOME>/rdbms/install/rootadd_rdbms.sh
[root@rac1 ~]# $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
节点2操作相同
使用root用户执行脚本2启动crs
# <GI_HOME>/crs/install/rootcrs.pl -patch
[root@rac1 ~]# $ORACLE_HOME/crs/install/rootcrs.pl –patch
节点2操作相同
注:如果提示“A system reboot is recommended before using ACFS”需要重启。
- 开启应用补丁节点DB(oracle用户执行)
$ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ $ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/state_file.txt -n rac1
节点2操作相同
[oracle@rac2 ~]$ $ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/state_file.txt -n rac2
- 执行脚本更新DB补丁记录(sysdba用户登录实例)
SQL> @?/rdbms/admin/catbundle.sql psu apply
10.检查补丁状态
查询DB补丁记录
SQL> col action_time for a30
SQL> col version for a15
SQL> col id for 99
SQL> col action for a10
SQL> col namespace for a10
SQL> col COMMENTS for a20
SQL> col BUNDLE_SERIES for a15
SQL> select * from registry$history;
查询补丁状态grid用户执行
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lspatches
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lsinventory
节点2操作相同,查询补丁状态oracle用户执行
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lspatches
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lsinventory
节点2操作相同,回退操作
- 停止节点DB(oracle用户执行)
$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ $ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/state_file_rollback.txt -n rac1
节点2操作相同
[oracle@rac2 ~]$ $ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/state_file_rollback.txt -n rac2
- 停止crs集群(root用户执行脚本)
# <GI_HOME>/crs/install/rootcrs.pl -unlock
[root@rac1 ~]# $ORACLE_HOME/crs/install/rootcrs.pl –unlock
节点2操作相同
注:停止集群后使用ps –ef | grep ora确保所有oracle进程已经停止,否则会出现文件占用报错,无法应用补丁。
- 回退crs 补丁(grid用户执行),回退crs补丁1
$ <GI_HOME>/OPatch/opatch rollback -local -id 14275572 -oh <GI_HOME>
[grid@rac1 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 14275572 -oh $ORACLE_HOME
节点2操作相同,回退crs补丁2
$ <GI_HOME>/OPatch/opatch rollback -local -id 14275605 -oh <GI_HOME>
[grid@rac1 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 14275605 -oh $ORACLE_HOME
节点2操作相同
- DB补丁回退前执行脚本(使用oracle用户执行)
$ <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 ~]$ cd /u01/app/oracle/patches
[oracle@rac1 patches]$ 14275572/custom/server/14275572/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
节点2操作相同
- 回退DB补丁(oracle用户执行),回退DB补丁1
$ <ORACLE_HOME>/OPatch/opatch rollback -local -id 14275572 -oh <ORACLE_HOME>
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 14275572 -oh $ORACLE_HOME
节点2操作相同,回退DB补丁2
$ <ORACLE_HOME>/OPatch/opatch rollback -local -id 14275605 -oh <ORACLE_HOME>
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 14275605 -oh $ORACLE_HOME
节点2操作相同
- 回退DB补丁后执行脚本(oracle用户执行)
$ <UNZIPPED_PATCH_LOCATION>/14275572/custom/server/14275572/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 patches]$ 14275572/custom/server/14275572/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
节点2操作相同
- root用户执行脚本
# <GI_HOME>/rdbms/install/rootadd_rdbms.sh
[root@rac1 ~]# $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
节点2操作相同,Root用户执行启动crs脚本
# <GI_HOME>/crs/install/rootcrs.pl -patch
[root@rac1 ~]# $ORACLE_HOME/crs/install/rootcrs.pl –patch
节点2操作相同
注:如出现信息 "A system reboot is recommended before using ACFS”,需要重启。
- 开启节点DB(使用oracle用户)
[oracle@rac1 ~]$ $ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/state_file_rollback.txt -n rac1
节点2操作相同
[oracle@rac2 ~]$ $ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/state_file_rollback.txt -n rac2
- 执行脚本catbundle.sql(sysdba用户登录实例)
@catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> @?/rdbms/admin/catbundle_PSU_ENMO_ROLLBACK.sql
- 查询回退状态
查询DB补丁记录
SQL> col action_time for a30
SQL> col version for a15
SQL> col id for 99
SQL> col action for a10
SQL> col namespace for a10
SQL> col COMMENTS for a20
SQL> col BUNDLE_SERIES for a15
SQL> select * from registry$history;
查询补丁状态grid用户执行
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lspatches
[grid@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lsinventory
节点2操作相同,查询补丁状态oracle用户执行
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lspatches
[oracle@rac1 patches]$ $ORACLE_HOME/OPatch/opatch lsinventory
节点2操作相同
网友评论