11.2.0.4 RAC 手动打补丁

1. 下载补丁和最新OPatch
GI PSU : p25869727_112040_Linux-x86-64.zip
OPatch : p6880880_112000_Linux-x86-64.zip

说明:GI PSU包括DB PSU,CPU。单机与RAC的opatch通用,单机与rac的psu不通用。

2. 检查数据库当前OPatch版本

RAC所有节点的GI home和DB home都需要检查。
$ $ORACLE_HOME/OPatch/opatch version

3. 更新OPatch,RAC所有节点的GI home和DB home都需要更新。
3.1 更新grid用户的OPatch
-- grid用户操作
node1-> echo $ORACLE_HOME
/u01/app/11.2.0/grid

-- root用户执行,/u01/app/11.2.0/grid/为grid用户下的$ORACLE_HOME路径
[root@node1 tmp]# mv /u01/app/11.2.0/grid/OPatch /u01/app/11.2.0/grid/OPatch_bak
[root@node1 tmp]# ll p6880880_112000_Linux-x86-64.zip
-rw-r--r--. 1 grid oinstall 99065778 Aug 3 03:07 p6880880_112000_Linux-x86-64.zip
[root@node1 tmp]# unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/11.2.0/grid/
[root@node1 tmp]# chown -R grid:oinstall /u01/app/11.2.0/grid/OPatch

-- grid用户操作
node1-> $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.16
OPatch succeeded.

说明:需要注意grid用户$ORACLE_HOME 权限。

3.2 更新oracle用户的OPatch
-- oracle用户执行 
node1-> echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1

-- root用户执行,/u01/app/oracle/product/11.2.0/db_1 为oracle用户下的$ORACLE_HOME路径
[root@node1 tmp]# mv /u01/app/oracle/product/11.2.0/db_1/OPatch /u01/app/oracle/product/11.2.0/db_1/OPatch_bak
[root@node1 tmp]# unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/db_1/
[root@node1 tmp]# chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1/OPatch

-- oracle用户操作
node1-> $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.16
OPatch succeeded.

4. 解压补丁文件 (所有节点的 grid,oracle都要解压psu文件)
-- root用户执行

[root@node1 tmp]# unzip p26030799_112040_Linux-x86-64.zip -d /tmp/grid_psu/
[root@node1 tmp]# chown -R grid:oinstall /tmp/grid_psu/

[root@node1 tmp]# unzip p26030799_112040_Linux-x86-64.zip -d /tmp/ora_psu/
[root@node1 tmp]# chown -R oracle:oinstall /tmp/ora_psu/

5. 所有节点都要检查补丁之间有无冲突
5.1 Node1节点 grid用户检查
grid用户执行结果:
node1-> cd 26030799/
node1-> $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, 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.16
OUI version : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-08-03_03-53-17AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

5.2 Node1节点 oracle用户检查
oracle执行结果:
node1-> cd 26030799/
node1-> $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/grid_psu/26030799/ -oh $ORACLE_HOME 
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation. All rights reserved.

PREREQ session

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.16
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-08-03_05-39-28AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.


6. 为数据库做冷备份 (如果不考虑安全性,这步可以省略,有点点风险)

RMAN>run {
shutdown immediate;
startup mount;
allocate channel c1 type disk;
allocate channel c2 type disk;
backup full tag='db_full_bak' database format '/home/oracle/rmanbak/full_cold_%d_%s.bak';
alter database open;
}

使用root用户备份oracle_home (将#ORACLE_HOME上级目录整个备份)
tar -zcvpf db_20170802.tar.gz dbhome_1/

7. 停止 node1 数据库实例 和 node1 crs服务

root用户登录节点1

-- root用户执行,/u01/app/11.2.0/grid/ 为grid用户的 $ORACLE_HOME
[root@node1 bin]# ./srvctl stop instance -d devdb -i devdb1 (停node1的数据库实例)
[root@node1 bin]# /u01/app/11.2.0/grid/crs/install/rootcrs.pl -unlock
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node1'
.....
Successfully unlock /u01/app/11.2.0/grid

8. 手动更新补丁
8.1 节点1 grid 用户执行

node1-> $ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /tmp/grid_psu/26030799/
输出略..
OPatch succeeded.

8.2 节点1 oracle 用户执行
[oracle@jyracdb1 ~]$ $ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /tmp/grid_psu/26030799/25869727/
输出略..
OPatch succeeded.

8.3 执行rootadd_rdbms.sh 、rootcrs.pl -patch

su – root
[root@node1 26030799]# /u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh
[root@node1 26030799]# /u01/app/11.2.0/grid/crs/install/rootcrs.pl -patch
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.

8.4 启动 node1 数据库实例 和 node1 crs服务(实际上前面执行 rootcrs.pl -patch 已经让node1的crs起来了)
[root@node1 bin]# ./srvctl start instance -d devdb -i devdb1

8.5 然后在节点2重复节点1(停止节点二数据库和节点二crs服务、grid、oracle打补丁、rootadd_rdbms.sh 、rootcrs.pl -patch)操作

9. 升级字典操作(升级数据库字典,要停业务。如果打补丁在DBCA之前,则不需要升级数据库字典,反之则需要升级数据库字典)

由于RAC实际只有一个数据库,因此任意节点登录数据库执行1次即可。最后重启数据库。

9.1 关闭数据库实例及相关进程 (静态监听、动态监听、EOM、相关服务)
--停止数据库外部进程
[root@11g ~]#ps -ef|grep -v grep |grep LOCAL=NO|awk '{print $2}'|xargs kill -9 
[oracle@11g rmanbak]$ cat /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
[root@node1 bin]# ./srvctl stop listener
[root@node1 bin]# ./srvctl status listener
[oracle@11g rmanbak]$ ps -ef |grep ora_|grep -v grep
[oracle@11g rmanbak]$ netstat -an |grep 1521
[oracle@11g rmanbak]$ netstat -an |grep 1158
[root@node1 bin]# ./srvctl stop database -d devdb

9.2 正式升级数据库的数据字典 
[root@node1 bin]# ./srvctl start database -d devdb 
node1-> sqlplus / as sysdba
SQL> @$ORACLE_HOME/rdbms/admin/catbundle.sql psu apply
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
[root@node1 bin]# ./srvctl stop database -d devdb
[root@node1 bin]# ./srvctl start database -d devdb

10. 验证补丁更新结果

各节点的GI HOME和ORACLE HOME都执行验证。
-- grid用户
node1-> $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation. All rights reserved.


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.16
OUI version : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-08-03_07-27-26AM_1.log

Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-08-03_07-27-26AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: node1.localdomain
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Grid Infrastructure 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.

Interim patches (3) :

Patch 25920335 : applied on Thu Aug 03 06:30:47 CST 2017
Unique Patch ID: 21279331
Patch description: "OCW Patch Set Update : 11.2.0.4.170718 (25920335)"
Created on 27 Jun 2017, 05:40:19 hrs PST8PDT
OPatch succeeded.

-- oracle用户
node1-> sqlplus / as sysdba
SQL> 
col ACTION_TIME for a30;
col COMMENTS for a20;
col BUNDLE_SERIES for a10;
select ACTION_TIME,BUNDLE_SERIES,COMMENTS from dba_registry_history;

ACTION_TIME BUNDLE_SER COMMENTS
------------------------------ ---------- --------------------
24-AUG-13 12.03.45.119862 PM PSU Patchset 11.2.0.2.0
24-FEB-17 05.51.27.427073 AM PSU Patchset 11.2.0.2.0
03-AUG-17 07.16.37.247390 AM PSU PSU 11.2.0.4.170718


--查看无效对象
select count(*) from dba_objects where status<>'VALID';
COUNT(*)
----------
0

11. 启动监听,对外提供服务,查看监听是否正常
[root@node1 bin]# ./srvctl start listener
[root@node1 bin]# ./srvctl status listener

补充:更新最新补丁 p26610246_112040_Linux-x86-64.zip 



本文转自 张冲andy 博客园博客,原文链接: http://www.cnblogs.com/andy6/p/7281493.html  ,如需转载请自行联系原作者

上一篇:ASP.NET 缓存(7)


下一篇:Oracle 11g R2 手动建库(create database manually)