11.2.0.3.1补丁升级学习

1.10g和11g补丁包差异

10g:crs和db补丁打包在一个psu包中

11g:crs(GI)和db补丁已经分开,需单独下载(PS:GI PSU包括DB PSU,并且是累积的,而DB PSU不包括GI PSU)

原话如下:

GI Patch Set Update (PSU) patches are cumulative, and include the DB PSU (and associated CPUs).That is, the content of all previous PSUs (if any) is included in the latest GI PSU patch, along with the current and previous DB PSU (and current and previous CPUs).One-off patches are not cumulative, that is, they will only apply a specific fix.

2.GI psu

2.1 PATCH安装先决条件
2.1.1opatch版本要求

opatch版本必须在11.2.0.1.8以上,不符合要求的话,下载个11.2.0.0(ID:6880880),查看opatch版本命令:

$ cd $ORACLE_HOME/OPatch/
$ ./opatch version

 

当下载新的OPatch工具的时候,要把它覆盖到各节点GIDB的家目录,命令如下

grid$ unzip <OPATCH-ZIP> -d <GRID_HOME> -------------解压到GI home,会提示你是否全覆盖,填ALL 
oracle$ unzip <OPATCH-ZIP> -d <ORACLE_HOME>----------解压到oracle home,会提示你是否全覆盖,填ALL
$ <GRID_HOME OR ORACLE_HOME>/OPatch/opatch version---查看是否达到opatch 版本要求

 

2.1.2OCM(Oracle Configuration Manager)配置

首先为何要配置OCM response file(ocm.rsp),为了自动安装的需要,当打GI PSU时,需要输入metalink信息,所以先前先把这个信息配置好,配置命令如下:

各节点grid用户执行!

$ <GRID_HOME>/OPatch/ocm/bin/emocmrsp

样例如下

     
     
[grid@rac1 bin]$ ./emocmrsp 
OCM Installation Response Generator 10.3.4.0.0 - Production
Copyright (c) 2005, 2010, Oracle and/or its affiliates.   All rights reserved.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: 
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:   Y
The OCM configuration response file (ocm.rsp) was successfully created.

 

readme原文如下:

The OPatch utility will prompt for your OCM (Oracle Configuration Manager) response file when it is run.

大致意思是OPatch 工具会调用到ocm相应文件,也就是ocm.rsp,因为后面PSU安装有这条命令

opatch auto <UNZIPPED_PATCH_LOCATION> -ocmrf <ocm response file>

 

2.1.3oracle inventory校验

oracle inventory存放着oracle组件清单。一般打补丁之前都要做psu版本调查,查看当前psu历史记录。

命令:

<GRID_HOME>/OPatch/opatch lsinventory -detail -oh <GRID_HOME>
<ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME>

 

2.1.4PSU解压

①不允许解压在/tmp目录下,以免导致未可预知的错误。原话:Do not unzip the patch in the top level/tmp directory.

②PSU解压所在的目录必须为空,防止发生别的错误。原话:To prevent installation failures, this location should be an empty directory.

③解压目录需具有对oinstall组有可读权限

以grid用户解压

 

PS:有些人想偷懒,就把psu解压在两个节点的共享盘的目录中,这样执行命令的时候,就不用改pus的路径,或者你也可以把psu分别解压在两个节点上的同样路径名的目录!

 

2.2 一次性补丁冲突检测(重要)

For PSU patches (USM, CRS, ASM):

opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/13343438 –oh $GRID_HOME
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/13343438 –oh $ORACLE_HOME
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/13348650 –oh $GRID_HOME
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>13348650/custom/server/13348650 –oh $ORACLE_HOME

2.3PSU两种安装方式(自动,手动)
2.3.1自动安装

 自动化补丁安装过程,不需要人工干预,并且集群、数据库会自动关闭和启动,并且执行命令只能用root用户,注意GI和ORACLE家目录的空间问题,貌似都是4G以上

The utility must be executed on each node(以下命令都得在各个节点上执行一遍)

 

①声明OPATCH工具的位置

export PATH=$PATH:<GI_HOME>/OPatch

 

②GI和ORACLE软件补丁一同自动安装

#opatch auto <UNZIPPED_PATCH_LOCATION> -ocmrf <ocm response file>

 

③执行catbundle.sql脚本,把补丁信息写进dba_registry_history视图中

For an Oracle RAC environment, perform these steps ononly one node.

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

 

During a bundle patch apply, catbundle.sql determines the last bundle in the series that was loaded in the database from information storedin thedba_registry_history view(这句话就是为何要执行)

 

同时我们也可以分开单独安装GI软件或者ORACLE软件补丁

单独安装GI软件补丁命令如下:

#opatch auto <UNZIPPED_PATCH_LOCATION> -oh <GI_HOME> -ocmrf <ocm response file>

 

单独安装ORACLE软件补丁命令如下:--为何出现两个oracle_home呢?因为一个操作系统可以安装多个oracle软件

#opatch auto <UNZIPPED_PATCH_LOCATION> -oh <path to RAC database1 home>, <path of the RAC database1 home> -ocmrf <ocm response file>

 

注:

回退命令

GI和ORACLE软件补丁一起回退

#opatch auto <UNZIPPED_PATCH_LOCATION> -rollback -ocmrf <ocm response file>

GI软件补丁单独回退

#opatch auto <UNZIPPED_PATCH_LOCATION> -oh <path to GI home> -rollback -ocmrf <ocm response file>

ORACLE软件单独回退

#opatch auto <UNZIPPED_PATCH_LOCATION> -oh <path to RAC database home> -rollback -ocmrf <ocm response file>
2.3.2手动安装

 为了减少停库的时间,采取轮换节点手动打补丁的方式

1.节点一,停止ORACLE HOME相关资源

If this is a GI Home environment, as the database home owner execute

su - oracle

$<ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>

 

注:<status file location>是自己定义的文本,用来记录stop的状态

 

2.节点一,对crs资源unlock,然后关闭节点一的crs

If this is a GI Home, as the root user execute:

su - root

#<GI_HOME>/crs/install/rootcrs.pl -unlock   ----会关闭节点一的集群

 

3.节点一,应用GI补丁

As the GI home owner execute:

su - grid

$<GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/13348650
$<GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/13343438 

 

4.节点一,应用RDBMS补丁

su - oracle

 

预安装检查

$<UNZIPPED_PATCH_LOCATION>/13348650/custom/server/13348650/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
 

应用

$<ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/13348650/custom/server/13348650$<ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/13343438

 

5.节点一,配置RDBMS home目录

Run the post script for DB component of the patch

su - oracle
$<UNZIPPED_PATCH_LOCATION>/13348650/custom/server/13348650/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>

6.节点一,启动CRS

su - root
#<GI_HOME>/rdbms/install/rootadd_rdbms.sh
#<GI_HOME>/crs/install/rootcrs.pl -patch

 

7.节点一,启动ORACLE HOME相关资源

$<ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
 

 

上述操作做完之后,再在节点二执行一遍

 

最后执行sql脚本,把补丁信息写入数据字典dba_registry_history view中

su - oracle

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

 

重启一下数据库
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值