大家好,欢迎来到IT知识分享网。
一、概述
数据库作为企业的核心应用节点之一,其稳定性至关重要,但是一些产品bug对oracle数据库的使用产生很大的影响,有些bug,我们通过调整参数来规避,但是一些bug需要打补丁才能解决。 作为DBA,掌握给数据库打补丁是一项必备的技能,本文分享一下在 Oracle 11g 数据库上应用 PSU 补丁的步骤。
二、过程步骤
2.1 安装OPATCH 实用程序
1、从 Oracle 支持门户下载补丁。
2、验证补丁版本:
opatch 实用程序用于将补丁应用到数据库。所以在应用补丁之前,我们需要检查补丁是否支持现有的opatch版本。因此,请参阅补丁的自述文件以了解最低支持版本。
根据补丁自述文件:
1.2.1 OPatch 实用程序 您必须使用 OPatch 实用程序版本 11.2.0.3.6 或更高版本才能应用此补丁。Oracle 建议您使用适用于 11.2 的最新发布的 OPatch 版本,该版本可通过选择 11.2.0.0.0 版本从 My Oracle Support 补丁 下载。 有关 OPatch 文档的信息,包括任何已知问题,请参阅 My Oracle Support Document .1 OPatch 文档列表。
所以对于这个补丁,opatch版本应该是11.2.0.3.6或者更高版本
让我们检查数据库中现有的 opatch 版本。
echo $ORACLE_HOME /u01/app/oracle/product/11.2.0/db_1 $ORACLE_HOME/OPatch/opatch version OPatch Version: 11.2.0.3.4 OPatch succeeded.
现有版本为 11.2.0.3.4,低于要求的版本。所以我们需要安装所需的 opatch 实用程序。
3、安装 OPATCH 实用程序
- 从 Oracle 支持链接下载 opatch 实用程序 –
- 将 zip 复制到 ORACLE_HOME。
$ cp p__Linux-x86-64.zip $ORACLE_HOME/
- 对现有的 OPatch 目录进行备份
cd $ORACLE_HOME mv OPatch OPatch.bak
- 解压缩 zip 文件。
unzip p__Linux-x86-64.zip
- 检查opatch版本
$ $ORACLE_HOME/OPatch/opatch version OPatch Version: 11.2.0.3.19 OPatch succeeded.
现在让我们继续 PSU 补丁安装。
2.2 安装 PSU 补丁
1、复制并解压 PATCH ZIP 文件
unzip p__Linux-x86-64.zip ls -ltr total drwxr-xr-x 21 oracle oinstall 4096 May 31 12:49 -rw-rw-r-- 1 oracle oinstall 93035 Jul 17 13:15 PatchSearch.xml -rw-r--r-- 1 oracle oinstall Oct 8 09:17 p__Linux-x86-64.zip
2、再次检查 ORACLE_HOME 是否有冲突
- go to patch folder. cd []$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 11.2.0.3.19 Copyright (c) 2018, 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.19 OUI version : 11.2.0.4.0 Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-10-08_09-35-06AM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
3、关闭数据库和侦听器
shutdown immediate; lsnrctl stop LISTENER_DMCRM
注意– 如果任何 Goldengate 进程正在 ORACLE_HOME 上运行,那么这些进程都需要关闭。
4、检查活动的可执行文件
$ORACLE_HOME/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./
[]$ $ORACLE_HOME/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./ Oracle Interim Patch Installer version 11.2.0.3.19 Copyright (c) 2018, 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.19 OUI version : 11.2.0.4.0 Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-10-08_09-35-58AM_1.log Invoking prereq "checkactivefilesandexecutables" Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. Prereq "checkActiveFilesAndExecutables" for patch passed. OPatch succeeded.
5、应用补丁
cd $ORACLE_HOME/OPatch/ opatch apply
[27734982]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2018, 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.19
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-10-08_09-36-41AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 17478514 18031668 18522509 19121551 19769489 20299013 20760982 21352635 21948347 22502456 23054359 24006111 24732075 25869727 26609445 26392168 26925576 27338049 27734982
Do you want to proceed? [y|n] ----------------------->> Press Y
y
User Responded with: Y
All checks passed.
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 ---- > Press Y
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] -- >> Press Y
y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH '/u01/app/oracle/product/11.2.0/db_1'
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.rsf, 11.2.0.4.0...
Patching component oracle.sdo, 11.2.0.4.0...
Patching component oracle.ctx.rsf, 11.2.0.4.0...
Patching component oracle.rdbms, 11.2.0.4.0...
Patching component oracle.rdbms.rman, 11.2.0.4.0...
OPatch found the word "error" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
chmod: changing permissions of `/u01/app/oracle/product/11.2.0/db_1/bin/extjobO': Operation not permitted
make: [iextjob] Error 1 (ignored)
Composite patch 27734982 successfully applied.
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-10-08_09-36-41AM_1.log
OPatch completed with warnings.
修补完成。可以忽略警告。
6、验证补丁是否已经更新
$ORACLE_HOME/OPatch/opatch lsinventory
[]$ $ORACLE_HOME/OPatch/opatch lsinventory Oracle Interim Patch Installer version 11.2.0.3.19 Copyright (c) 2018, 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.19 OUI version : 11.2.0.4.0 Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-10-08_09-41-09AM_1.log Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-10-08_09-41-09AM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 11g 11.2.0.4.0 There are 1 products installed in this Oracle Home. Interim patches (1) : Patch : applied on Mon Oct 08 09:39:20 AST 2018 Unique Patch ID: Patch description: "Database Patch Set Update : 11.2.0.4. ()" Created on 31 May 2018, 01:37:49 hrs PST8PDT Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4. ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.8 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.7 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.6 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.5 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.4 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.3 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.2 ()" Sub-patch ; "Database Patch Set Update : 11.2.0.4.1 ()" Bugs fixed: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , -------------------------------------------------------------------------------- OPatch succeeded.
7、启动数据库和监听器
STARTUP lsnrctl start LISTENER_DMCRM
8、运行补丁后脚本
cd $ORACLE_HOME/rdbms/admin sqlplus / as sysdba @catbundle.sql psu apply quit
9、编译无效对象
$ORACLE_HOME/rdbms/admin/utlrp.sql
10、检查补丁情况
select action_time,action from dba_registry_history; ACTION_TIME ACTION --------------------------------------------------------------------------- ------------------------------ 21-APR-15 08.52.24. AM APPLY 08-OCT-18 09.43.41. AM APPLY 2 rows selected.
三、小结
本文分享了非RAC数据库的打补丁的详细过程,随手一记,以备不时之需。
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/47917.html