Oracle11g(RAC)补丁安装(31718723,31668908)

本文详细介绍了如何在Oracle11g RAC环境下安装PSU和OJVM补丁,包括备份、关闭数据库、升级OPatch、逐个节点打补丁等关键步骤,并强调了每个步骤的重要性,特别是备份和遵循正确的补丁顺序。
摘要由CSDN通过智能技术生成

Oracle11g(RAC)补丁安装

注:本篇文章也适用于21年第一季度补丁与21年第二季度补丁

安装环境及补丁版本:

Oracle版本:11.2.0.4
Linux版本:Red Hat Enterprise Linux Server release 7.6 (Maipo)
PSU版本号:p31718723_112040_Linux-x86-64.zip
OJVM版本号:p31668908_112040_Linux-x86-64.zip
OPatch版本:p6880880_112000_Linux-x86-64_11.2.0.3.27.zip

打补丁前注意事项及要点(划重点!):

1、备份 (可以救命)!!!
2、关闭数据库
3、先打GI psu
4、再打DB psu
5、grid用户打 ACFS(在GI psu打完之后才能打)
6、打补丁要指定补丁安装目录:(opatch auto -oh $ORACLE_HOME)
7、打OJVM之前停crs,打那个节点停那个节点,出问题至少还有一个节点正常
8、先把一个节点补丁彻底打完后在打第二个节点
一定要仔细阅读readme!!!!!!!!!!!!!!!!!!!!!!!!!!!!

一、备份!!!
1、将Oracle软件打包备份
$ cd $ORACLE_HOME
$ tar -pzcvf oraclehome1.tar *
2、将Grid软件打包备份
$ cd $GRID_HOME
$ tar -cvf gihome.tar *

希望你用不到,但是有备无患,生产环境,补丁打废了,数据库就废了,这也是非常危险的操作。

二、关闭数据库
# su - oracle

$ sqlplus / as sysdba

SQL> shutdown immediate
三、将Oracle与Grid自带OPatch备份

其实改个名字即可

备份ORACLE_HOME下OPatch:
# su - oracle

$ cd $ORACLE_HOME/OPatch/

$ mv OPatch OPatch20201214

$ exit

备份GRID_HOME下OPatch (环境变量设置的也是ORACLE_HOME)# su - grid

$ cd $ORACLE_HOME/OPatch/

$ mv OPatch OPatch20201214

$ exit
四、root用户上传补丁授权并解压
1、更改补丁介质权限
因为刚刚上传的补丁介质属主都为root,为了使oracle用户和grid用户都可以解压安装补丁,所以更改补丁介质权限:
# chmod 755 /u01/software/p31668908_112040_Linux-x86-64.zip
# chmod 755 /u01/software/p31718723_112040_Linux-x86-64.zip
# chmod 755 /u01/software/p6880880_112000_Linux-x86-64_11.2.0.3.27.zip

# chown grid:oinstall /u01/software/p31718723_112040_Linux-x86-64.zip
# chown oracle:oinstall /u01/software/p31668908_112040_Linux-x86-64.zip
# chown grid:oinstall /u01/software/p6880880_112000_Linux-x86-64_11.2.0.3.27.zip
2、解压补丁与OPatch(升级OPatch)
1、使用grid用户解压p31718723_112040_Linux-x86-64.zip(PSU):
# su - grid

$ unzip /u01/software/p31718723_112040_Linux-x86-64.zip -d /u01/software

2、解压OPatch到GRID_HOME(升级OPatch):
$ unzip /u01/software/p6880880* -d $ORACLE_HOME/

3、查看opatch版本:
$ opatch version
OPatch Version: 11.2.0.3.27

OPatch succeeded.

$ exit
1、使用oracle用户解压p31668908_112040_Linux-x86-64.zip(OJVM):
# su - oracle

$ unzip /u01/software/p31668908_112040_Linux-x86-64.zip -d /u01/software

2、解压OPatch到ORACLE_HOME(升级OPatch):
$ unzip /u01/software/p6880880* -d $ORACLE_HOME/

3、查看opatch版本:
$ opatch version
OPatch Version: 11.2.0.3.27

OPatch succeeded.

$ exit
五、开始安装补丁

解压p31718723_112040_Linux-x86-64.zip的目录中,readme对于补丁使用对象的说明:
在这里插入图片描述
1、打31718723(PSU)补丁

(1)打gi psu
----gi psu----
root用户执行以下命令可将GI的 29938455(ocw)、29509309(acfs)、31537677(db psu)三个补丁打上
# <GRID_HOME> OPatch/opatch auto <UNZIPPED_PATCH_LOCATION> /31718723 -oh <GRID_HOME>

输出如下:

# /u01/app/11.2.0.4/grid/OPatch/opatch auto /u01/software/31718723 -oh /u01/app/11.2.0.4/grid
Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/11.2.0.4/grid/OPatch/crs/patch11203.pl -patchdir /u01/software -patchn 3171
8723 -oh /u01/app/11.2.0.4/grid -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2020-12-14_11-22-22.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.4/grid/cfgtoollogs/opatchauto2020-12-14_11-22-22.report.log

2020-12-14 11:22:22: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

Stopping CRS...
Stopped CRS successfully

patch /u01/software/31718723/29938455  apply successful for home  /u01/app/11.2.0.4/grid 
patch /u01/software/31718723/31537677  apply successful for home  /u01/app/11.2.0.4/grid 
patch /u01/software/31718723/29509309  apply successful for home  /u01/app/11.2.0.4/grid 

Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.

opatch auto succeeded.
#

查看已经安装的Grid补丁:

# su - grid
$ 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.
$ 
(2)打db psu
----db psu----
root用户执行以下命令可将GI的 29938455(ocw)、31537677(db psu)两个补丁打上
# <ORACLE_HOME> OPatch/opatch auto <UNZIPPED_PATCH_LOCATION> /31718723 -oh <ORACLE_HOME>

输出如下:

# /u01/app/oracle/product/11.2.0.4/OPatch/opatch auto /u01/software/31718723 -oh /u01/app/oracle/product/11.2.0.4
Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/oracle/product/11.2.0.4/OPatch/crs/patch11203.pl -patchdir /u01/software -p
atchn 31718723 -oh /u01/app/oracle/product/11.2.0.4 -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params
This is the main log file: /u01/app/oracle/product/11.2.0.4/cfgtoollogs/opatchauto2020-12-14_11-39-41.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.4/cfgtoollogs/opatchauto2020-12-14_11-39-41.report.log

2020-12-14 11:39:41: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

Stopping RAC /u01/app/oracle/product/11.2.0.4 ...
Stopped RAC /u01/app/oracle/product/11.2.0.4 successfully

patch /u01/software/31718723/29938455/custom/server/29938455  apply successful for home  /u01/app/oracle/product/11.2.0.4 
patch /u01/software/31718723/31537677  apply successful for home  /u01/app/oracle/product/11.2.0.4 

Starting RAC /u01/app/oracle/product/11.2.0.4 ...
Started RAC /u01/app/oracle/product/11.2.0.4 successfully

opatch auto succeeded.
# 

2、打31668908(OJVM)补丁

(1)停crs服务

一个个停,一个个打,这样最起码确保有一个节点是安全的(生产环境尤其重要!)

停止当前crs
# /u01/app/11.2.0.4/grid/bin/crsctl stop crs

crs状态
# /u01/app/11.2.0.4/grid/bin/crsctl status resource -t
(2)OJVM要使用oracle用户下的opatch打
# su - oracle

$ opatch apply <UNZIPPED_PATCH_LOCATION> /31668908

输出如下:

$ opatch apply /u01/software/31668908
Oracle Interim Patch Installer version 11.2.0.3.27
Copyright (c) 2020, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.4
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0.4/oraInst.loc
OPatch version    : 11.2.0.3.27
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/cfgtoollogs/opatch/opatch2020-12-14_11-58-40AM_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.4')


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.4'
ApplySession: Optional component(s) [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ]  not present in the Oracle Hom
e 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.4/cfgtoollogs/opatch/opatch2020-12-14_11-58-40AM_1.log

OPatch succeeded.
$
(3)打完补丁后执行脚本
1、将修改后的SQL文件加载到数据库中:
以下步骤将修改后的SQL文件加载到数据库中。对于Oracle RAC环境,请仅在一个节点上执行这些步骤。

(1)通过为单实例环境运行以下命令来安装补丁程序的SQL部分。
cd $ORACLE_HOME/sqlpatch/31668908
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> startup upgrade
SQL> @postinstall.sql
SQL> shutdown
SQL> startup


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

cd $ORACLE_HOME/sqlpatch/31668908
sqlplus /nolog
SQL> CONNECT / 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 

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

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

查看已安装的Oracle补丁

#1、在操作系统中查看补丁版本:
# su - oracle
Last login: Mon Dec 14 11:46:56 CST 2020 on pts/4
[csxgdb2][oracle@csxgdb2 ~]$ 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、查看具体的补丁号:
$ opatch lsinventory

#3、在数据库中查询补丁版本:
set line 200
col ACTION_TIME for a35
col COMMENTS for a45
select ACTION_TIME,version,COMMENTS from registry$history;

至此单个节点的gi和db的补丁全部安装完毕,第二个节点按照相同操作即可,
详情请参考补丁解压文件readme,谢谢。

评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值