Oracle 12C R2 DB打补丁

版权声明:未经博主允许不允许转载 https://blog.csdn.net/qianglei6077/article/details/90110867

1 下载软件

MOS文档:Quick Reference to RDBMS Database Patchset And PSU Patch Numbers(文档 ID 753736.1)

在这里插入图片描述

[root@cndba software]# ll

total 115984

-rw-r--r--. 1 root root 118763743 Dec 19 14:08 p26710464_122010_Linux-x86-64.zip

如果没有MOS账号的朋友可通过百度云下载:

链接:https://pan.baidu.com/s/1hrICoZi 密码:uiak

2 升级前准备

OPatch工具的版本必须是12.2.0.1.6及以上。 --这里纠正一下,经过下面的实验README中给出的版本要求有错误,应该是12.2.0.1.7及以上

[oracle@cndba OPatch]$ ./opatch -help
Oracle Interim Patch Installer version 12.2.0.1.6 --满足 实际上不满足,下面会报错的解决方法。
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

下载最新的OPatch工具:https://updates.oracle.com/download/6880880.html

3 安装补丁

3.1 安装前检查环境

3.1.1 确保 make, ar, ld,和 nm四个可执行命令在$PATH中
Redhat6.* export PATH=$PATH:/usr/bin/
Redhat7.* export PATH=$PATH:/bin

3.1.2 检查补丁冲突

[root@cndba software]# unzip p26710464_122010_Linux-x86-64.zip

[root@cndba software]#cd 26710464

[oracle@cndba 26710464]$ /u01/app/oracle/product/12.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 12.2.0.1.6
Copyright (c) 2017, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /u01/app/oracle/product/12.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.6
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-30-43PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

3.2 打补丁

3.2.1 DG环境

如果是DataGuard环境,必须要确保要在主备库上都要安装补丁程序。

具体参考:How do you apply a Patchset,PSU or CPU in a Data Guard Physical Standby configuration (文档 ID 278641.1)

3.2.2 RAC环境

安装DB RU时,是不需要停机的,可以通过滚动安装补丁方式来打补丁。

具体参考MOS:Rolling Patch - OPatch Support for RAC (文档 ID 244241.1)

3.2.3 单实例环境

关闭当前ORACLE_HOME下的所有实例和监听,并退出SQLPLUS客户端。否则会报错:

Following executables are active : /u01/app/oracle/product/12.2.0/db_1/bin/oracle /u01/app/oracle/product/12.2.0/db_1/lib/libclntsh.so.12.1
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-48-35PM_1.log

3.2.4 正式开始

[oracle@cndba 26710464]$ /u01/app/oracle/product/12.2.0/db_1/OPatch/opatch apply

Oracle Interim Patch Installer version 12.2.0.1.6
Copyright (c) 2017, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/12.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.6
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-36-26PM_1.log
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckMinimumOPatchVersion" failed.
The details are:

The OPatch being used has version 12.2.0.1.6 while the following patch(es) require higher versions:
Patch 26710464 requires OPatch version 12.2.0.1.7. --需要OPatch 12.2.0.1.7及以上版本
Please download latest OPatch from My Oracle Support.

UtilSession failed: Prerequisite check "CheckMinimumOPatchVersion" failed.
Log file location: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-36-26PM_1.log
OPatch failed with error code 73

我这里报错了,OPatch版本太低了。但是README中说明12.2.0.1.6是可以的,看来口径不一致啊。

那就下一个吧,版本是 12.2.0.1.11。

MOS文档:
How To Download And Install The Latest OPatch(6880880) Version (文档 ID 274526.1)

安装很简单,把原来的OPatch文件夹备份出来,然后将新的OPatch解压,复制过去即可。

[oracle@cndba db_1]$ mv OPatch/ /home/oracle/
[root@cndba software]# chown -R oracle:oinstall /software/ --修改权限
[oracle@cndba software]$ mv OPatch/ /u01/app/oracle/product/12.2.0/db_1/
3.2.4.1 再次执行apply补丁

一路“y”就行了。需要一点时间,稍等一会。

[oracle@cndba 26710464]$ /u01/app/oracle/product/12.2.0/db_1/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.11
Copyright (c) 2017, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/12.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.11
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-52-32PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   26710464  
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/12.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '26710464' to OH '/u01/app/oracle/product/12.2.0/db_1'
ApplySession: Optional component(s) [ oracle.has.crs, 12.2.0.1.0 ] , [ oracle.ons.daemon, 12.2.0.1.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.rdbms.deconfig, 12.2.0.1.0...
Patching component oracle.tfa, 12.2.0.1.0...
Patching component oracle.rdbms, 12.2.0.1.0...
Patching component oracle.rdbms.util, 12.2.0.1.0...
Patching component oracle.rdbms.dbscripts, 12.2.0.1.0...
Patching component oracle.has.deconfig, 12.2.0.1.0...
Patching component oracle.xdk.parser.java, 12.2.0.1.0...
Patching component oracle.xdk.rsf, 12.2.0.1.0...
Patching component oracle.ctx.rsf, 12.2.0.1.0...
Patching component oracle.rdbms.rman, 12.2.0.1.0...
Patching component oracle.rdbms.oci, 12.2.0.1.0...
Patching component oracle.rdbms.crs, 12.2.0.1.0...
Patching component oracle.oracore.rsf, 12.2.0.1.0...
Patching component oracle.ctx, 12.2.0.1.0...
Patching component oracle.xdk, 12.2.0.1.0...
Patching component oracle.nlsrtl.rsf, 12.2.0.1.0..
Patching component oracle.rdbms.rsf, 12.2.0.1.0...
Patching component oracle.ons, 12.2.0.1.0...
Patching component oracle.rdbms.lbac, 12.2.0.1.0...
Patching component oracle.rdbms.rsf.ic, 12.2.0.1.0...
Patching component oracle.sdo, 12.2.0.1.0...
Patching component oracle.precomp.common, 12.2.0.1.0...
Patching component oracle.precomp.lang, 12.2.0.1.0...
Patch 26710464 successfully applied.
Log file location: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-19_14-52-32PM_1.log

OPatch succeeded.---成功

日志:
[Dec 19, 2017 2:52:45 PM] [INFO] OUI-67117:Backing up files affected by the patch ‘NApply’ for restore. This might take a while… --备份受影响的文件。

3.2.5 安装完成后,将修改SQL文件加载到数据库中

步骤如下:
在这里插入图片描述

[oracle@cndba OPatch]$ ./datapatch -verbose

SQL Patching tool version 12.2.0.1.0 Production on Tue Dec 19 15:07:11 2017
Copyright (c) 2012, 2017, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_28921_2017_12_19_15_07_11/sqlpatch_invocation.log

Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series DBRU:
  ID 171017 in the binary registry and not installed in any PDB

Adding patches to installation queue and performing prereq checks...

Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED LEIPDB
    Nothing to roll back
    The following patches will be applied:
      26710464 (DATABASE RELEASE UPDATE 12.2.0.1.171017)

Installing patches...
Patch installation complete.  Total patches installed: 3

Validating logfiles... --验证日志文件是否有错误

Patch 26710464 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/26710464/21632407/26710464_apply_ORCL_CDBROOT_2017Dec19_15_07_33.log (no errors)

Patch 26710464 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/26710464/21632407/26710464_apply_ORCL_PDBSEED_2017Dec19_15_09_25.log (no errors)

Patch 26710464 apply (pdb LEIPDB): WITH ERRORS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/26710464/21632407/26710464_apply_ORCL_LEIPDB_2017Dec19_15_09_27.log (errors)
    Error at line 32: ORA-65254: invalid path specified for the directory --具体错误信息

Please refer to MOS Note 1609718.1 and/or the invocation log
/u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_28921_2017_12_19_15_07_11/sqlpatch_invocation.log
for information on how to resolve the above errors.
SQL Patching tool complete on Tue Dec 19 15:10:44 2017

结果MOS搜索,确认为Bug 26203745,Bug 25074866目前还没有修复。

解决方法:
打补丁25074866,并重新加载SQL文件即可。

参考:
https://blog.csdn.net/qianglei6077/article/details/90110906

Datapatch Fails With “ORA-65254: invalid path specified for the directory” on PDB Where PATH_PREFIX is set (文档 ID 2296226.1)

3.2.6 检查log文件是否有错误

如果有错误,则需要检查什么原因造成,然后解决掉。否则,要回滚掉之前打的补丁。

其他信息请查看相应补丁文件中的README.html文件,里面有更为详细的说明。

猜你喜欢

转载自blog.csdn.net/qianglei6077/article/details/90110867