Oracle11.2.0.4 RAC集群补丁手动安装与回退方案
一.背景:
很多时候当RAC处于异常或等保需要,需要单节点或手动升级补丁,本次针对Oracle7月份最新发布的11204补丁包200714 ,手动在RAC环境进行安装。
二.备份:
节点1:
root用户备份GI_home
tar cvf Ghome_backup.tar $GI_HOME
oracle用户备份ORACLE_HOME
tar cvf ohome_backup.tar $ORACLE_HOME
节点2:
root用户备份GI_home
tar cvf Ghome_backup.tar $GI_HOME
oracle用户备份ORACLE_HOME
tar cvf ohome_backup.tar $ORACLE_HOME
三.GI_PSU信息:
OCW Comp_Patch# 29938455 --Both DB homes and Grid home
DB_PSU_Patch# 31103343 --Both DB homes and Grid home
ACFS Comp_Patch# 29509309 --Only Grid home
四.前期准备工作:
下载需求版本的Opatch以及补丁包并覆盖$ORACLE_HOME目录的Opatch目录
五.补丁安装流程:
1.oracle用户(停止各节点数据库)
$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac2
2.root用户(执行安装前的解锁配置)
[root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
[root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
3.grid用户(分别打入上述的三个补丁OCW,DB,ACFS)
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/29938455
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/29509309
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/31103343
4.oracle用户(分别打入上述的2个补丁OCW,DB):
OCW path
$ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch napply -oh $ORACLE_HOME -local /oracle/soft/31305209/29938455/custom/server/29938455/
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch napply -oh $ORACLE_HOME -local /oracle/soft/31305209/29938455/custom/server/29938455/
DB PATCH
$ <ORACLE_HOME>/OPatch/opatch apply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<DB_PSU_number>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch apply -oh $ORACLE_HOME -local /oracle/soft/31305209/31103343/
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch apply -oh $ORACLE_HOME -local /oracle/soft/31305209/31103343/
6.oracle用户(执行postpatch.sh)
$ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
[oracle@rac2 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
7.root用户(最后执行下面脚本)
[root@rac1 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
[root@rac2 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
[root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
[root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
8.oracle用户(启动数据库)
$ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac2
9.将修改后的SQL文件加载到数据库中(执行数据字典升级)
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
10.编译无效对象:
cd $ ORACLE_HOME / rdbms / admin
sqlplus / nolog
SQL> CONNECT / AS SYSDBA
SQL> @ utlrp.sql
11.查看补丁信息:
[grid@rac1 ~]$opatch lsinv
[grid@rac2 ~]$opatch lsinv
升级后可能遇到数据库无法打开,找不到ASM设备的错误:alert日志内容如下:
Errors in file
/u01/app/oracle/diag/rdbms/bdspoc/bdspoc/trace/bdspoc_rbal_11187.trc:
ORA-15183: ASMLIB initialization error [driver/agent not
installed]
WARNING: FAILED to load library:
/opt/oracle/extapi/64/asm/orcl/1/libasm.so
Errors in file
/u01/app/oracle/diag/rdbms/bdspoc/bdspoc/trace/bdspoc_rbal_11187.trc:
ORA-15183: ASMLIB initialization error [driver/agent not
installed]
SUCCESS: diskgroup SDATA was mounted
NOTE: dependency between database bdspoc and diskgroup
resource ora.SDATA.dg is established
Errors in file
/u01/app/oracle/diag/rdbms/bdspoc/bdspoc/trace/bdspoc_ora_11104.trc (incident=20001):
ORA-00600: internal error code, arguments: [kfioTranslateIO03],
[], [], [], [], [], [], [], [], [], [], []
Incident details in:
/u01/app/oracle/diag/rdbms/bdspoc/bdspoc/incident/incdir_20001/bdspoc_ora_11104_i20001.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and
packaging details.
Errors in file
/u01/app/oracle/diag/rdbms/bdspoc/bdspoc/trace/bdspoc_ora_11104.trc (incident=20002):
ORA-00600: internal error code, arguments: [17090], [],
[], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/bdspoc/bdspoc/incident/incdir_20002/bdspoc_ora_11104_i20002.trcDumping
diagnostic data in directory=[cdmp_20130925101448], requested by (instance=1,
osid=11104), summary=[incident=20001].
通过查找后,发现11.2安装Grid Infrastructure均需要安装执行如下命令
$ su - grid
$ cd <Grid Home>/bin
$ ./setasmgidwrap o=<11.2 RDBMS
Home>/bin/oracle
[grid@bdspoc_st bin]$ ./setasmgidwrap o=/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
六.完全回退方案:
1.oracle用户
$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac2
2.root用户
[root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
[root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
3.grid用户
$ <GI_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <GI_HOME>
$ <GI_HOME>/OPatch/opatch rollback -local -id <ACFS Components_number> -oh <GI_HOME>
$ <GI_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <GI_HOME>
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29509309 -oh $ORACLE_HOME
[grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME
[grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
[grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29509309 -oh $ORACLE_HOME
[grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME
4.oracle用户
$ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 soft]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
[oracle@rac2 soft]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
5.oracle用户
$ <ORACLE_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <ORACLE_HOME>
$ <ORACLE_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <ORACLE_HOME>
[oracle@rac1 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
[oracle@rac2 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME
6.oracle用户
$ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
[oracle@rac1 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
[oracle@rac2 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
7.root用户
# <GI_HOME>/rdbms/install/rootadd_rdbms.sh
# <GI_HOME>/crs/install/rootcrs.pl -patch
[root@rac1 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
[root@rac2 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
[root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
[root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
8.oracle用户
$ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
[oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
[oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac2
9.将加载到数据库中的SQL文件回滚
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> QUIT
10.编译无效对象:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
11.查看是否回退完成
[grid@rac1 ~]$opatch lsinv
[grid@rac2 ~]$opatch lsinv
七.未将SQL文件加载到数据库时的回退方案:
将两节点补丁安装前备份的GI_HOME以及ORACLE_HOME重新解压覆盖当前的GI_HOME和ORACLE_HOME即可
tar xf Ghome_backup.tar -d $ORACLE_HOME
tar xf ohome_backup.tar -d $ORACLE_HOME
发表评论 取消回复