当前位置: 首页 > article >正文

ORACLE 19C 安装数据库补丁的详细过程

ORACLE 19c安装DB补丁:
1 确定OPatch的可用性:这里需要注意的是p6880880_190000_Linux-x86-64.zip是有版本对应区别的,需要注意你要打的补丁版本是否支持。

2 将原$ORACLE_HOME目录下的OPatch目录删除或者改名,比如说:
cd $ORACLE_HOME
mv OPatch OPatch_1
或rm -rf OPatch

3 将p6880880_190000_Linux-x86-64.zip上传到你的$ORACLE_HOME目录下并解压。
unzip p6880880_190000_Linux-x86-64.zip
解压后你就可以得到一个新的OPatch目录。

4修改环境变量添加:
export ORACLE_OPatch=$ORACLE_HOME/OPatch
在export PATH=.....这行字符最后添加:$ORACLE_OPatch
比如:
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin:$ORACLE_OPatch
然后环境变量生成
source ~/.bash_profile

5 执行opatch version
[oracle@oracle19c ~]$ opatch version
OPatch Version: 12.2.0.1.28

OPatch succeeded.
看到这样就可以了。

6 使用ORACLE用户将你的补丁文件压缩包上传到服务器上。并解压,准备打补丁。

7 解压补丁 : unzip p33515361_190000_Linux-x86-64.zip

8 关闭监听和关闭数据库:
lsnrctl stop

[oracle@oracle19c u01]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 23 22:22:57 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
这里我们可以看到我们数据库版本为19300,关闭数据库
shutdown immediate

9 检查补丁信息:
cd 33515361/(这个33515361是刚才解压出来的,你们要根据你们的实际情况而定)
opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 12.2.0.1.28
Copyright (c) 2022, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.28
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-23_22-26-20PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

没有问题,证明一切OK.

10 开始打补丁
cd 33515361/
opatch apply (这个需要在解压出来的补丁目录下执行)

Do you want to proceed? [y|n] 出这种东西的话 一律 'y'

看到这些:
Patching component oracle.jdk, 1.8.0.201.0...
Patch 33515361 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [33515361].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-23_22-29-14PM_1.log

OPatch succeeded.
代表数据库补丁安装完毕。

11 启动数据库
[oracle@oracle19c 33515361]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 23 22:36:38 2022
Version 19.14.0.0.0(看这里)

Copyright (c) 1982, 2021, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  733999360 bytes
Fixed Size                  8900864 bytes
Variable Size             201326592 bytes
Database Buffers          520093696 bytes
Redo Buffers                3678208 bytes
Database mounted.
Database opened.
SQL>

这里应景看到了是191400而不是19300了

12 执行datapatch
datapatch -verbose (千万别再SQLPLUS下执行,要在ORACLE用户的LINUX终端上执行)
[oracle@oracle19c 33515361]$ datapatch -verbose

SQL Patching tool version 19.14.0.0.0 Production on Sun Jan 23 22:43:26 2022
Copyright (c) 2012, 2021, Oracle.  All rights reserved.

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

Connecting to database...OK
Gathering database info...done
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    19.14.0.0.0 Release_Update 211225122123: Installed
  SQL registry:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 18-JAN-21 02.54.27.541960 AM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  No interim patches need to be rolled back
  Patch 33515361 (Database Release Update : 19.14.0.0.220118 (33515361)):
    Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.14.0.0.0 Release_Update 211225122123
  No interim patches need to be applied

Installing patches...

看到下列信息代表成功了。
Patch installation complete.  Total patches installed: 1

Validating logfiles...done
Patch 33515361 apply: SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/33515361/24589353/33515361_apply_ORCL_2022Jan23_22_43_55.log (no errors)
SQL Patching tool complete on Sun Jan 23 22:51:58 2022

13 进入到sqlplus / as sysdba下:
执行:@?/rdbms/admin/utlrp.sql

SQL> @?/rdbms/admin/utlrp.sql
 @?/rdbms/admin/utlrp.sql

Session altered.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2022-01-23 22:54:50

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.

直到看到
ERRORS DURING RECOMPILATION
---------------------------
                          0


Function created.


PL/SQL procedure successfully completed.


Function dropped.


PL/SQL procedure successfully completed.

代表成功。

14 检查补丁是否成功
col ACTION for a8
col status for a10
set line 230
col ACTION_TIME for a30
col DESCRIPTION for a60

执行下列SQL语句
select patch_id, action,status,action_time,description  from dba_registry_sqlpatch;

  PATCH_ID ACTION   STATUS     ACTION_TIME                    DESCRIPTION
---------- -------- ---------- ------------------------------ ------------------------------------------------------------
  29517242 APPLY    SUCCESS    18-JAN-21 02.54.27.541960 AM   Database Release Update : 19.3.0.0.190416 (29517242)
  33515361 APPLY    SUCCESS    23-JAN-22 10.51.58.754167 PM   Database Release Update : 19.14.0.0.220118 (33515361)

看到SUCCESS后代表成功,我们把数据库从 19.3.0.0.190416 (29517242) 升级到  19.14.0.0.220118 (33515361)

这里的29517242代表19300的补丁编号,一旦失败,我们需要回滚我们的补丁。

到这里补丁就算成功打完了。


http://www.kler.cn/a/383488.html

相关文章:

  • nmap扫描优化
  • webrtc获取IceCandidate流程
  • 一个比RTK或redux更轻量级更易使用的 React 第三方状态管理工具库的配置与使用
  • 【087】基于51单片机智能宠物喂食器【Proteus仿真+Keil程序+报告+原理图】
  • Day1 苍穹外卖前端 Vue基础、Vue基本使用方式、Vue-router、Vuex、TypeScript
  • 亚远景-SO 21434标准下的汽车网络安全:风险评估与管理的关键实践
  • 利用全排列解决LeetCode第3343题“统计平衡排列的数目”问题
  • 【Java SE语法】抽象类(abstract class)和接口(interface)有什么异同?
  • 一个国产 API 开源项目,在 ProductHunt 杀疯了...
  • 【HarmonyOS】引导用户跳转APP设置详情页开启权限
  • AI预测体彩排3采取888=3策略+和值012路+胆码+通杀1码测试11月7日升级新模型预测第127弹
  • AI在创造还是毁掉音乐?
  • Vue 指令
  • ENSP RIP动态路由
  • HLS SAMPLE-AES加密方法
  • 京东毫秒级热key探测框架JD-hotkey
  • 哈希表,哈希桶及配套习题
  • 数据分析:转录组差异fgsea富集分析
  • 第08章 排序ORDER BY
  • 创新实践:基于边缘智能+扣子的智慧婴儿监控解决方案
  • 歌词结构的艺术:写歌词的技巧和方法深度剖析,妙笔生词AI智能写歌词软件
  • 一篇掌握springboot集成gRPC
  • dcdc3节锂电池串联9-12V升压32V 3A/5A 音响供电恒压芯片 SL4010
  • CentOS 7 更换软件仓库
  • 【LeetCode】返回链表的中间结点、删除链表的倒数第 N 个结点
  • C#如何锁定和解除鼠标及键盘BlockInput