oracle 11g rac 补丁安装步骤

补丁包准备:
打补丁顺序,grid->db->ojvm,一个节点打完,打另外一个
p31720783_112040_Linux-x86-64.zip —该补丁包含ojvm
p6880880_112000_Linux-x86-64.zip

1、使用root用户进行软件备份,备份前停集群和数据库

tar -tvf可以查看备份后的文件权限是否正确

$ cd $ORACLE_HOME
$ tar -cvf oraclehome1.tar *
$ cd $GRID_HOME
$ tar -cvf gihome.tar *

2、各节点停数据库

3、使用root用户配置OPatch

–备份 OPatch

mv /u01/app/11.2.0/grid/OPatch/ /software/OPatch_grid
mv /u01/app/oracle/product/11.2.0/db_1/OPatch/ /software/OPatch_oracle

–解压最新OPatch并赋权,移植到grid家目录

cd /software/
unzip p6880880_112000_Linux-x86-64.zip
chown -R grid:oinstall OPatch
mv /software/OPatch /u01/app/11.2.0/grid/
su - grid
opatch version

–解压最新OPatch并赋权,移植到oracle家目录

cd /software/
unzip p6880880_112000_Linux-x86-64.zip
chown -R oracle:oinstall OPatch
mv /software/OPatch /u01/app/oracle/product/11.2.0/db_1/
su - oracle
opatch version

4、解压补丁

unzip p31720783_112040_Linux-x86-64.zip
chown grid:oinstall 31720783 -R

5、给集群打补丁

----gi psu----
root用户执行以下命令可将GI的 29938455(ocw)、29509309(acfs)、31537677(db psu)三个补丁打上

<GRID_HOME> OPatch/opatch auto <UNZIPPED_PATCH_LOCATION> /31718723 -oh <GRID_HOME>
[root@rac1 31720783]# /u01/app/11.2.0/grid/OPatch/opatch auto /tmp/31720783/31718723 -oh /u01/app/11.2.0/grid
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /tmp/31720783 -patchn 31718723 -oh /u01/app/11.2.0/grid -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2023-08-03_15-50-21.log
This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0/grid/cfgtoollogs/opatchauto2023-08-03_15-50-21.report.log
2023-08-03 15:50:21: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Stopping CRS...
Stopped CRS successfully
patch /tmp/31720783/31718723/29938455  apply successful for home  /u01/app/11.2.0/grid
patch /tmp/31720783/31718723/31537677  apply successful for home  /u01/app/11.2.0/grid
patch /tmp/31720783/31718723/29509309  apply successful for home  /u01/app/11.2.0/grid
Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.
Oracle Grid Infrastructure stack start initiated but failed to complete at /tmp/31720783/31718723/29938455/files/crs/install/crsconfig_lib.pm line 11821.

提示集群无法正常启动,手动重启节点1集群,集群正常启动
节点二打补丁报错,手动kill掉d.bin进程,再手动确定集群后正常

Starting CRS...
Installing Trace File Analyzer
CRS-4124: Oracle High Availability Services startup failed.
CRS-4000: Command Start failed, or completed with errors.

验证GI补丁

[grid@rac1 ~]$ cd $ORACLE_HOME/OPatch
[grid@rac1 OPatch]$ ./opatch lspatches
29509309;ACFS Patch Set Update : 11.2.0.4.190716 (29509309)
31537677;Database Patch Set Update : 11.2.0.4.201020 (31537677)
29938455;OCW Patch Set Update : 11.2.0.4.191015 (29938455)
OPatch succeeded.

在这里插入图片描述

6、给数据库软件打补丁

root用户执行以下命令可将GI的 29938455(ocw)、31537677(db psu)两个补丁打上

<ORACLE_HOME> OPatch/opatch auto <UNZIPPED_PATCH_LOCATION> /31718723 -oh <ORACLE_HOME>
[root@rac1 31720783]# /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch auto /tmp/31720783/31718723 -oh /u01/app/oracle/product/11.2.0/db_1
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/oracle/product/11.2.0/db_1/OPatch/crs/patch11203.pl -patchdir /tmp/31720783 -patchn 31718723 -oh /u01/app/oracle/product/11.2.0/db_1 -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatchauto2023-08-03_16-36-16.log
This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatchauto2023-08-03_16-36-16.report.log
2023-08-03 16:36:16: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Stopping RAC /u01/app/oracle/product/11.2.0/db_1 ...
Stopped RAC /u01/app/oracle/product/11.2.0/db_1 successfully
patch /tmp/31720783/31718723/29938455/custom/server/29938455  apply successful for home  /u01/app/oracle/product/11.2.0/db_1
patch /tmp/31720783/31718723/31537677  apply successful for home  /u01/app/oracle/product/11.2.0/db_1
Starting RAC /u01/app/oracle/product/11.2.0/db_1 ...
Started RAC /u01/app/oracle/product/11.2.0/db_1 successfully
opatch auto succeeded.

验证DB补丁

[oracle@rac1 31720783]$ $ORACLE_HOME/OPatch/opatch lspatches
31537677;Database Patch Set Update : 11.2.0.4.201020 (31537677)
29938455;OCW Patch Set Update : 11.2.0.4.191015 (29938455)
OPatch succeeded.

7、给OJVM打补丁

7.1 停集群

停止当前crs

[root@rac1 31720783]# /u01/app/11.2.0/grid/bin/crsctl stop crs

7.2 将补丁权限给oracle用户

[root@rac1 31720783]# chown oracle:oinstall -R 31720783/

7.3 应用OJVM补丁

[oracle@rac1 31720783]$ cd $ORACLE_HOME/OPatch
[oracle@rac1 OPatch]$ ./opatch apply /tmp/31720783/31668908
Oracle Interim Patch Installer version 11.2.0.3.43
Copyright (c) 2023, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.43
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2023-08-03_16-58-38PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   31668908
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '31668908' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ]  not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.javavm.client, 11.2.0.4.0...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
Patch 31668908 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2023-08-03_16-58-38PM_1.log
OPatch succeeded.

7.4 启动集群

/u01/app/11.2.0/grid/bin/crsctl start crs

7.5 在数据库中运行脚本,只在其中一个节点运行即可

(1)对于Oracle RAC环境,请使用以下命令在一个节点上重新加载程序包。确保远程节点上没有其他数据库实例在运行。

cd $ORACLE_HOME/sqlpatch/31668908
sqlplus / as sysdba
SQL> startup
SQL> alter system set cluster_database=false scope=spfile;
SQL> shutdown
SQL> startup upgrade
SQL> @postinstall.sql
SQL> alter system set cluster_database=true scope=spfile;
SQL> shutdown
SQL> startup

(2)安装补丁的SQL部分后,某些软件包可能变为无效。访问时将重新编译该文件,或者您可以运行utlrp.sql以使其恢复为有效状态。

cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
SQL> @utlrp.sql

8、自此节点一补丁已经完全安装完成,查询版本信息

8.1 在操作系统中查看OJVM补丁版本:

[oracle@rac1 OPatch]$ ./opatch lspatches
31668908;OJVM PATCH SET UPDATE 11.2.0.4.201020
31537677;Database Patch Set Update : 11.2.0.4.201020 (31537677)
29938455;OCW Patch Set Update : 11.2.0.4.191015 (29938455)
OPatch succeeded.

8.2 在数据库中查询补丁版本:

set line 200
col ACTION_TIME for a35
col COMMENTS for a45
select ACTION_TIME,version,COMMENTS from registry$history;
ACTION_TIME                VERSION               COMMENTS
--------------------------------------------------------------------------------
24-AUG-13 12.03.45.119862 PM        11.2.0.4                       Patchset 11.2.0.2.0
03-AUG-23 10.57.23.325552 AM        11.2.0.4                       Patchset 11.2.0.2.0
03-AUG-23 05.13.30.692877 PM        11.2.0.4.201020OJVMPSU       RAN jvmpsu.sql
03-AUG-23 05.13.32.208310 PM        11.2.0.4.201020OJVMPSU       OJVM PSU post-install
03-AUG-23 05.13.32.213314 PM                                        Patch 31668908 applied

9、关闭节点1数据库,节点2按照上述顺序,打补丁

回退方案

回退方案一

1、卸载OJVM补丁

1.1 关闭所以节点数据库实例和集群

1.2 使用oracle用户卸载OJVM

[oracle@rac1 ~]$ cd $ORACLE_HOME/OPatch
[oracle@rac1 OPatch]$ ./opatch rollback -d 31668908
Oracle Interim Patch Installer version 11.2.0.3.43
Copyright (c) 2023, Oracle Corporation.  All rights reserved.
Syntax Error... Unrecognized Command or Option: failed to parse arguments "unknown option '-d'"
Please use the option 'opatch rollback -help' to get correct syntax
OPatch failed with error code 14
[oracle@rac1 OPatch]$ ./opatch rollback -id 31668908
Oracle Interim Patch Installer version 11.2.0.3.43
Copyright (c) 2023, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.43
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2023-08-04_10-24-37AM_1.log
Patches will be rolled back in the following order:
31668908
The following patch(es) will be rolled back: 31668908
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Rolling back patch 31668908...
RollbackSession rolling back interim patch '31668908' from OH '/u01/app/oracle/product/11.2.0/db_1'
Patching component oracle.javavm.server, 11.2.0.4.0...
Patching component oracle.precomp.common, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Patching component oracle.javavm.client, 11.2.0.4.0...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
RollbackSession removing interim patch '31668908' from inventory
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2023-08-04_10-24-37AM_1.log
OPatch succeeded.

1.3 启动集群

1.4 运行脚本

(1)对于Oracle RAC环境,请使用以下命令在一个节点上重新加载程序包。确保远程节点上没有其他数据库实例在运行。

cd $ORACLE_HOME/sqlpatch/31668908
sqlplus / as sysdba
SQL> startup
SQL> alter system set cluster_database=false scope=spfile;
SQL> shutdown
SQL> startup upgrade
SQL> @postdeinstall.sql
SQL> alter system set cluster_database=true scope=spfile;
SQL> shutdown
SQL> startup

(2)安装补丁的SQL部分后,某些软件包可能变为无效。访问时将重新编译该文件,或者您可以运行utlrp.sql以使其恢复为有效状态。

cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
SQL> @utlrp.sql

1.5 查看OJVM补丁信息

(1) 操作系统中查看补丁

[oracle@rac1 OPatch]$ ./opatch lspatches
31537677;Database Patch Set Update : 11.2.0.4.201020 (31537677)
29938455;OCW Patch Set Update : 11.2.0.4.191015 (29938455)
OPatch succeeded.

(2) 在数据库中查询补丁版本:

set line 200
col ACTION_TIME for a35
col COMMENTS for a45
select ACTION_TIME,version,COMMENTS from registry$history;
ACTION_TIME                VERSION               COMMENTS
--------------------------------------------------------------------------------
24-AUG-13 12.03.45.119862 PM        11.2.0.4                       Patchset 11.2.0.2.0
03-AUG-23 10.57.23.325552 AM        11.2.0.4                       Patchset 11.2.0.2.0
03-AUG-23 05.13.30.692877 PM        11.2.0.4.201020OJVMPSU       RAN jvmpsu.sql
03-AUG-23 05.13.32.208310 PM        11.2.0.4.201020OJVMPSU       OJVM PSU post-install
03-AUG-23 05.13.32.213314 PM                                       Patch 31668908 applied
04-AUG-23 10.38.26.431730 AM        11.2.0.4.201020OJVMPSU       RAN jvmpsu.sql
04-AUG-23 10.38.30.286244 AM        11.2.0.4.201020OJVMPSU       OJVM PSU post-deinstall
04-AUG-23 10.38.30.291175 AM                                        Patch 31668908 rolled back

1.6 关闭节点一数据库实例

2、卸载DB补丁

[root@rac1 ~]# /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch auto /tmp/31720783/31718723 -rollback -oh /u01/app/oracle/product/11.2.0/db_1
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/oracle/product/11.2.0/db_1/OPatch/crs/patch11203.pl -patchdir /tmp/31720783 -patchn 31718723 -rollback -oh /u01/app/oracle/product/11.2.0/db_1 -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatchauto2023-08-04_10-46-15.log
This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatchauto2023-08-04_10-46-15.report.log
2023-08-04 10:46:15: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Stopping RAC /u01/app/oracle/product/11.2.0/db_1 ...
Stopped RAC /u01/app/oracle/product/11.2.0/db_1 successfully
patch 29938455  rollback successful for home /u01/app/oracle/product/11.2.0/db_1
patch 31537677  rollback successful for home /u01/app/oracle/product/11.2.0/db_1
Starting RAC /u01/app/oracle/product/11.2.0/db_1 ...
Started RAC /u01/app/oracle/product/11.2.0/db_1 successfully
opatch auto succeeded.
[root@rac1 ~]# su - oracle
Last login: Fri Aug  4 10:54:55 CST 2023 on pts/0
[oracle@rac1 ~]$ cd $ORACLE_HOME
[oracle@rac1 db_1]$ cd OPatch
[oracle@rac1 OPatch]$ ./opatch lspatches
There are no Interim patches installed in this Oracle Home "/u01/app/oracle/product/11.2.0/db_1".
OPatch succeeded.

3、卸载GI补丁

[root@rac1 ~]#  /u01/app/11.2.0/grid/OPatch/opatch auto /tmp/31720783/31718723 -oh /u01/app/11.2.0/grid -rollback
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /tmp/31720783 -patchn 31718723 -oh /u01/app/11.2.0/grid -rollback -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2023-08-04_10-56-11.log
This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0/grid/cfgtoollogs/opatchauto2023-08-04_10-56-11.report.log
2023-08-04 10:56:11: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Stopping CRS...
Stopped CRS successfully
patch 29938455  rollback successful for home /u01/app/11.2.0/grid
patch 31537677  rollback successful for home /u01/app/11.2.0/grid
patch 29509309  rollback successful for home /u01/app/11.2.0/grid
Starting CRS...
/u01/app/11.2.0/grid/crs/install/oracle-ohasd.service does not exist
Undefined subroutine &crspatch::dieformat called at /u01/app/11.2.0/grid/crs/install/crspatch.pm line 252.
[root@rac1 ~]# ps -ef|grep d.bin
root      76243   3417  0 11:09 pts/0    00:00:00 grep --color=auto d.bin
[root@rac1 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

回退方式二:

   此时已经默认数据库中跑完相应脚本,只需要将DB和GI软件进行回退,通过将打包的软件解压的方式回退

1、回退OJVM和DB补丁

[root@rac2 db_1]# cd /u01/app/oracle/product/11.2.0/db_1

将tar包移动到别的位置上,整个删除oracle家目录下的所有文件,再将tar包移回来

[root@rac2 db_1]# tar -xvf oraclehome1.tar

验证OJVM补丁和DB补丁

[oracle@rac2 ~]$ cd $ORACLE_HOME/OPatch/
[oracle@rac2 OPatch]$ ./opatch lspatches
There are no Interim patches installed in this Oracle Home.
[oracle@rac2 OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.

2、回退GI补丁

将集群停止后,将tar包移动到grid家目录,并解压

[root@rac1 grid]# tar -xvf gihome.tar

启动集群

[root@rac1 grid]# /u01/app/11.2.0/grid/bin/crsctl start crs

验证集群状态,发现asm没有正常启动,手工启动asm后,集群状态正常
在这里插入图片描述
在这里插入图片描述

验证GI补丁

[grid@rac1 ~]$ /u01/app/11.2.0/grid/OPatch/opatch lspatches
There are no Interim patches installed in this Oracle Home "/u01/app/11.2.0/grid".
OPatch succeeded.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
搭建Oracle11g RAC集群需要进行多项操作,以下是简要的步骤: 1. 准备环境:确保每个节点的操作系统版本和硬件配置满足Oracle11g RAC的要求,并安装必要的软件和补丁。 2. 配置网络:配置节点之间的网络通信,包括IP地址、DNS解析、网卡绑定等。 3. 创建共享存储:为Oracle实例提供共享存储,可以使用iSCSI、NFS等技术实现。 4. 安装Oracle Grid Infrastructure:在每个节点上安装Oracle Grid Infrastructure,这是管理Oracle RAC环境所需的软件。 5. 安装Oracle Database软件:在其中一个节点上安装Oracle Database软件,这是实际的数据库服务。 6. 创建数据库:使用Oracle Database创建RAC集群,包括设置参数、创建表空间、用户、角色等。 7. 配置监听器和服务:配置监听器和服务,以便客户端可以访问数据库。 对于使用静默安装的具体步骤,可以参考以下步骤: 1. 创建响应文件:使用Oracle Universal Installer(OUI)创建响应文件,其中包括所有需要的配置参数。 2. 复制软件包:将Oracle Grid Infrastructure和Oracle Database软件包复制到每个节点上。 3. 运行安装脚本:使用响应文件运行安装脚本,安装Oracle Grid Infrastructure和Oracle Database软件。 4. 创建数据库:使用静默安装后,需要手动创建数据库并进行必要的配置。 5. 配置监听器和服务:同样需要手动配置监听器和服务。 注意事项:在进行静默安装前,需要对响应文件中的参数进行仔细的配置,以确保安装过程顺利。同时,需要进行充分的测试和验证,以确保RAC集群的可用性和稳定性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值