Oracle11.2.0.4 RAC集群补丁手动安装与回退方案

一.背景:

很多时候当RAC处于异常或等保需要,需要单节点或手动升级补丁,本次针对Oracle7月份最新发布的11204补丁包200714 ,手动在RAC环境进行安装。

二.备份:
节点1:

  1. root用户备份GI_home
  2. tar cvf Ghome_backup.tar $GI_HOME
  3. oracle用户备份ORACLE_HOME
  4. tar cvf ohome_backup.tar $ORACLE_HOME

节点2:

  1. root用户备份GI_home
  2. tar cvf Ghome_backup.tar $GI_HOME
  3. oracle用户备份ORACLE_HOME
  4. 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用户(停止各节点数据库)

  1. $ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
  2. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
  3. [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用户(执行安装前的解锁配置)

  1. [root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
  2. [root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock

3.grid用户(分别打入上述的三个补丁OCW,DB,ACFS)

  1. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/29938455
  2. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/29509309
  3. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch napply -oh /oracle/grid/crs_1/ -local /oracle/soft/31305209/31103343

4.oracle用户(分别打入上述的2个补丁OCW,DB)

  1. OCW path
  2. $ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>
  3. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch napply -oh $ORACLE_HOME -local /oracle/soft/31305209/29938455/custom/server/29938455/
  4. [oracle@rac2 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch napply -oh $ORACLE_HOME -local /oracle/soft/31305209/29938455/custom/server/29938455/

  5. DB PATCH
  6. $ <ORACLE_HOME>/OPatch/opatch apply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<DB_PSU_number>
  7. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/OPatch/opatch apply -oh $ORACLE_HOME -local /oracle/soft/31305209/31103343/
  8. [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)

  1. $ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
  2. [oracle@rac1 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
  3. [oracle@rac2 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME

7.root用户(最后执行下面脚本)

  1. [root@rac1 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
  2. [root@rac2 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
  3. [root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
  4. [root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch

8.oracle用户(启动数据库)

  1. $ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
  2. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
  3. [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文件加载到数据库中(执行数据字典升级)

  1. cd $ORACLE_HOME/rdbms/admin
  2. sqlplus /nolog
  3. SQL> CONNECT / AS SYSDBA
  4. SQL> STARTUP
  5. SQL> @catbundle.sql psu apply
  6. SQL> QUIT

10.编译无效对象:

  1. cd $ ORACLE_HOME / rdbms / admin
  2. sqlplus / nolog
  3. SQL> CONNECT / AS SYSDBA
  4. 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用户

  1. $ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>
  2. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
  3. [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用户

  1. [root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock
  2. [root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -unlock

3.grid用户

  1. $ <GI_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <GI_HOME>
  2. $ <GI_HOME>/OPatch/opatch rollback -local -id <ACFS Components_number> -oh <GI_HOME>
  3. $ <GI_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <GI_HOME>
  4. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
  5. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29509309 -oh $ORACLE_HOME
  6. [grid@rac1 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME
  7. [grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
  8. [grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 29509309 -oh $ORACLE_HOME
  9. [grid@rac2 ~]$ /oracle/grid/crs_1/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME

4.oracle用户

  1. $ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
  2. [oracle@rac1 soft]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
  3. [oracle@rac2 soft]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME

5.oracle用户

  1. $ <ORACLE_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <ORACLE_HOME>
  2. $ <ORACLE_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <ORACLE_HOME>
  3. [oracle@rac1 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 29938455 -oh $ORACLE_HOME
  4. [oracle@rac2 ~]$ $ORACLE_HOME/OPatch/opatch rollback -local -id 31103343 -oh $ORACLE_HOME

6.oracle用户

  1. $ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>
  2. [oracle@rac1 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
  3. [oracle@rac2 ~]$ /oracle/soft/31305209/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME

7.root用户

  1. # <GI_HOME>/rdbms/install/rootadd_rdbms.sh
  2. # <GI_HOME>/crs/install/rootcrs.pl -patch
  3. [root@rac1 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
  4. [root@rac2 ~]# /oracle/grid/crs_1/rdbms/install/rootadd_rdbms.sh
  5. [root@rac1 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch
  6. [root@rac2 ~]# /oracle/grid/crs_1/crs/install/rootcrs.pl -patch

8.oracle用户

  1. $ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
  2. [oracle@rac1 ~]$ /oracle/app/product/11.2.0/db_1/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/status1 -n rac1
  3. [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文件回滚

  1. cd $ORACLE_HOME/rdbms/admin
  2. sqlplus /nolog
  3. SQL> CONNECT / AS SYSDBA
  4. SQL> STARTUP
  5. SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
  6. SQL> QUIT

10.编译无效对象:

  1. cd $ORACLE_HOME/rdbms/admin
  2. sqlplus /nolog
  3. SQL> CONNECT / AS SYSDBA
  4. SQL> @utlrp.sql

11.查看是否回退完成

  1. [grid@rac1 ~]$opatch lsinv
  2. [grid@rac2 ~]$opatch lsinv

七.未将SQL文件加载到数据库时的回退方案:

  1. 将两节点补丁安装前备份的GI_HOME以及ORACLE_HOME重新解压覆盖当前的GI_HOMEORACLE_HOME即可
  2. tar xf Ghome_backup.tar -d $ORACLE_HOME
  3. tar xf ohome_backup.tar -d $ORACLE_HOME

点赞(1) 打赏

评论列表 共有 0 条评论

暂无评论

企业微信号

微信扫一扫咨询

微信公众号

关注我们,定期优惠

立即
投稿
发表
评论
返回
顶部
展开