升级Oracle 单实例数据库19.3到19.22

  金牌会员 | 2024-6-25 21:37:52 | 来自手机 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 993|帖子 993|积分 2979

需求

我的Oracle Database Vagrant Box初始版本为19.3,需要升级到最新的RU,当前为19.22。
以下利用时间为为2024年2月5日。
补丁下载

补丁下载文档拜见MOS文档:Primary Note for Database Proactive Patch Program (Doc ID 888.1)。
补丁安装文档拜见文档(链接在下载页面中):Patch 35943157 - Database Release Update 19.22.0.0.240116
也可以从MOS的“Patch & Updates”标签页中下载:

结果中的Patch 35943157即我们需要的:

停止数据库和监听

断开全部与数据库的连接,如应用,如管理客户端(Oracle EM, SQL Developer等)。
停止数据库:
  1. shutdown immediate
复制代码
停止监听:
  1. lsnrctl stop
复制代码
备份Oracle Home

参考MOS文档: How to Perform ORACLE_HOME Backup? (Doc ID 565017.1)
以oracle用户实行以下脚本:
  1. # 创建备份目录
  2. mkdir ~/backup
  3. # 本例中的ORACLE_HOME为/opt/oracle/product/19c/dbhome_1
  4. cd $ORACLE_HOME
  5. # 切换到上一级目录:/opt/oracle/product/19c
  6. cd ..
  7. # 启动备份
  8. tar -pcvf ~/backup/oracle_home_bkup.tar dbhome_1
复制代码
备份文件约7.4G:
  1. $ ls -l ~/backup/
  2. total 7248532
  3. -rw-r--r--. 1 oracle oinstall 7422494720 Feb  5 13:42 oracle_home_bkup.tar
复制代码
安装最新版的OPatch

下载OPatch 12.2.0.1.41 for DB 19.0.0.0.0 (Jan 2024),约120M。
  1. $ ls -l /vagrant/p6880880_190000_Linux-x86-64.zip
  2. -rwxrwxrwx. 1 vagrant vagrant 127629034 Feb  5 13:58 /vagrant/p6880880_190000_Linux-x86-64.zip
复制代码
升级过程拜见Oracle数据库升级OPatch全过程。
升级完成后:
  1. $ opatch version
  2. OPatch Version: 12.2.0.1.41
  3. OPatch succeeded.
复制代码
安装OJVM补丁

详见MOS 文档:Oracle Recommended Patches – “Oracle JavaVM Component Database PSU and Update” (OJVM PSU and OJVM Update) Patches (Doc ID 1929745.1)
实际下载是从MOS文档:Primary Note for Database Proactive Patch Program (Doc ID 888.1)
然后搜索OJVM即可。补丁约120M:
  1. $ ls -l /vagrant/p35926646_190000_Linux-x86-64.zip
  2. -rwxrwxrwx. 1 vagrant vagrant 127451050 Feb  5 14:21 /vagrant/p35926646_190000_Linux-x86-64.zip
复制代码
升级文档拜见Patch 35926646 - Oracle JavaVM Component Release Update 19.22.0.0.240116。
  1. PATCHDIR=/home/oracle/patchdir
  2. mkdir $PATCHDIR
  3. unzip -d $PATCHDIR /vagrant/p35926646_190000_Linux-x86-64.zip
  4. cd $PATCHDIR/35926646
  5. opatch prereq CheckConflictAgainstOHWithDetail -ph ./
  6. # 如果上面的先决条件检测通过,则可以安装补丁
  7. opatch apply
复制代码
安装过程如下:
  1. [oracle@oracle-19c-vagrant 35926646]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
  2. Oracle Interim Patch Installer version 12.2.0.1.41
  3. Copyright (c) 2024, Oracle Corporation.  All rights reserved.
  4. PREREQ session
  5. Oracle Home       : /opt/oracle/product/19c/dbhome_1
  6. Central Inventory : /opt/oracle/oraInventory
  7.    from           : /opt/oracle/product/19c/dbhome_1/oraInst.loc
  8. OPatch version    : 12.2.0.1.41
  9. OUI version       : 12.2.0.7.0
  10. Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_14-25-44PM_1.log
  11. Invoking prereq "checkconflictagainstohwithdetail"
  12. Prereq "checkConflictAgainstOHWithDetail" passed.
  13. OPatch succeeded.
  14. [oracle@oracle-19c-vagrant 35926646]$ opatch apply
  15. Oracle Interim Patch Installer version 12.2.0.1.41
  16. Copyright (c) 2024, Oracle Corporation.  All rights reserved.
  17. Oracle Home       : /opt/oracle/product/19c/dbhome_1
  18. Central Inventory : /opt/oracle/oraInventory
  19.    from           : /opt/oracle/product/19c/dbhome_1/oraInst.loc
  20. OPatch version    : 12.2.0.1.41
  21. OUI version       : 12.2.0.7.0
  22. Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_14-26-37PM_1.log
  23. Verifying environment and performing prerequisite checks...
  24. OPatch continues with these patches:   35926646
  25. Do you want to proceed? [y|n]
  26. y
  27. User Responded with: Y
  28. All checks passed.
  29. Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
  30. (Oracle Home = '/opt/oracle/product/19c/dbhome_1')
  31. Is the local system ready for patching? [y|n]
  32. y
  33. User Responded with: Y
  34. Backing up files...
  35. Applying interim patch '35926646' to OH '/opt/oracle/product/19c/dbhome_1'
  36. Patching component oracle.javavm.server, 19.0.0.0.0...
  37. Patching component oracle.javavm.server.core, 19.0.0.0.0...
  38. Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
  39. Patching component oracle.rdbms, 19.0.0.0.0...
  40. Patching component oracle.javavm.client, 19.0.0.0.0...
  41. Patch 35926646 successfully applied.
  42. Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_14-26-37PM_1.log
  43. OPatch succeeded.
复制代码
另有一些后续工作:
  1. connect / as sysdba
  2. startup
  3. alter pluggable database all open;
  4. quit
复制代码
实行安装后脚本,datapatch 是一款新工具,可实现 RDBMS 补丁的补丁后 SQL 利用自动化:
  1. cd $ORACLE_HOME/OPatch
  2. ./datapatch -verbose
复制代码
如果都正常,则实行以下脚本:
  1. cd $ORACLE_HOME/rdbms/admin
  2. sqlplus /nolog
  3. SQL> CONNECT / AS SYSDBA
  4. SQL> @utlrp.sql
复制代码
然后关闭数据库。
  1. shutdown immediate
复制代码
这个补丁安装的时间有点长。如果是新库,最好是打完补丁再建库,而非建完库再打补丁。
安装数据库补丁

由于我没有GI,以是仅升级数据库就好。
补丁约1.8G:
  1. $ ls -l /vagrant/p35943157_190000_Linux-x86-64.zip
  2. -rwxrwxrwx. 1 vagrant vagrant 1817908992 Feb  5 13:29 /vagrant/p35943157_190000_Linux-x86-64.zip
复制代码
解压:
  1. PATCHDIR=/home/oracle/patchdir
  2. # 解压完大约3.6G
  3. unzip -qd $PATCHDIR /vagrant/p35943157_190000_Linux-x86-64.zip
  4. cd $PATCHDIR/35943157
  5. opatch prereq CheckConflictAgainstOHWithDetail -ph ./
  6. # 如果上面的先决条件检测通过,则可以安装补丁
  7. opatch apply
复制代码
先决条件查抄确实通过了:
  1. $ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
  2. Oracle Interim Patch Installer version 12.2.0.1.41
  3. Copyright (c) 2024, Oracle Corporation.  All rights reserved.
  4. PREREQ session
  5. Oracle Home       : /opt/oracle/product/19c/dbhome_1
  6. Central Inventory : /opt/oracle/oraInventory
  7.    from           : /opt/oracle/product/19c/dbhome_1/oraInst.loc
  8. OPatch version    : 12.2.0.1.41
  9. OUI version       : 12.2.0.7.0
  10. Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_15-10-48PM_1.log
  11. Invoking prereq "checkconflictagainstohwithdetail"
  12. Prereq "checkConflictAgainstOHWithDetail" passed.
  13. OPatch succeeded.
复制代码
但第一次安装却失败了,由于空间不够:
  1. [oracle@oracle-19c-vagrant 35943157]$ time opatch apply
  2. Oracle Interim Patch Installer version 12.2.0.1.41
  3. Copyright (c) 2024, Oracle Corporation.  All rights reserved.
  4. Oracle Home       : /opt/oracle/product/19c/dbhome_1
  5. Central Inventory : /opt/oracle/oraInventory
  6.    from           : /opt/oracle/product/19c/dbhome_1/oraInst.loc
  7. OPatch version    : 12.2.0.1.41
  8. OUI version       : 12.2.0.7.0
  9. Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_15-12-31PM_1.log
  10. Verifying environment and performing prerequisite checks...
  11. Prerequisite check "CheckSystemSpace" failed.
  12. The details are:
  13. Required amount of space(7550.384MB) is not available.
  14. UtilSession failed:
  15. Prerequisite check "CheckSystemSpace" failed.
  16. Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_15-12-31PM_1.log
  17. OPatch failed with error code 73
复制代码
空间问题处置惩罚完后,再次安装:
  1. $ time opatch apply
  2. Oracle Interim Patch Installer version 12.2.0.1.41
  3. Copyright (c) 2024, Oracle Corporation.  All rights reserved.
  4. Oracle Home       : /opt/oracle/product/19c/dbhome_1
  5. Central Inventory : /opt/oracle/oraInventory
  6.    from           : /opt/oracle/product/19c/dbhome_1/oraInst.loc
  7. OPatch version    : 12.2.0.1.41
  8. OUI version       : 12.2.0.7.0
  9. Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_15-41-25PM_1.log
  10. Verifying environment and performing prerequisite checks...
  11. OPatch continues with these patches:   35943157
  12. Do you want to proceed? [y|n]
  13. y
  14. User Responded with: Y
  15. All checks passed.
  16. Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
  17. (Oracle Home = '/opt/oracle/product/19c/dbhome_1')
  18. Is the local system ready for patching? [y|n]
  19. y
  20. User Responded with: Y
  21. Backing up files...
  22. Applying interim patch '35943157' to OH '/opt/oracle/product/19c/dbhome_1'
  23. ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.crypto.rsf, 19.0.0.0.0 ] , [ oracle.pg4mq, 19.0.0.0.0 ] , [ oracle.precomp.companion, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.pg4appc, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ]  not present in the Oracle Home or a higher version is found.
  24. Patching component oracle.rdbms, 19.0.0.0.0...
  25. Patching component oracle.rdbms.util, 19.0.0.0.0...
  26. Patching component oracle.rdbms.rsf, 19.0.0.0.0...
  27. Patching component oracle.assistants.acf, 19.0.0.0.0...
  28. Patching component oracle.assistants.deconfig, 19.0.0.0.0...
  29. Patching component oracle.assistants.server, 19.0.0.0.0...
  30. Patching component oracle.blaslapack, 19.0.0.0.0...
  31. Patching component oracle.buildtools.rsf, 19.0.0.0.0...
  32. Patching component oracle.ctx, 19.0.0.0.0...
  33. Patching component oracle.dbdev, 19.0.0.0.0...
  34. Patching component oracle.dbjava.ic, 19.0.0.0.0...
  35. Patching component oracle.dbjava.jdbc, 19.0.0.0.0...
  36. Patching component oracle.dbjava.ucp, 19.0.0.0.0...
  37. Patching component oracle.duma, 19.0.0.0.0...
  38. Patching component oracle.javavm.client, 19.0.0.0.0...
  39. Patching component oracle.ldap.owm, 19.0.0.0.0...
  40. Patching component oracle.ldap.rsf, 19.0.0.0.0...
  41. Patching component oracle.ldap.security.osdt, 19.0.0.0.0...
  42. Patching component oracle.marvel, 19.0.0.0.0...
  43. Patching component oracle.network.rsf, 19.0.0.0.0...
  44. Patching component oracle.odbc.ic, 19.0.0.0.0...
  45. Patching component oracle.ons, 19.0.0.0.0...
  46. Patching component oracle.ons.ic, 19.0.0.0.0...
  47. Patching component oracle.oracore.rsf, 19.0.0.0.0...
  48. Patching component oracle.perlint, 5.28.1.0.0...
  49. Patching component oracle.precomp.common.core, 19.0.0.0.0...
  50. Patching component oracle.precomp.rsf, 19.0.0.0.0...
  51. Patching component oracle.rdbms.crs, 19.0.0.0.0...
  52. Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
  53. Patching component oracle.rdbms.deconfig, 19.0.0.0.0...
  54. Patching component oracle.rdbms.oci, 19.0.0.0.0...
  55. Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...
  56. Patching component oracle.rdbms.scheduler, 19.0.0.0.0...
  57. Patching component oracle.rhp.db, 19.0.0.0.0...
  58. Patching component oracle.sdo, 19.0.0.0.0...
  59. Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...
  60. Patching component oracle.sqlplus, 19.0.0.0.0...
  61. Patching component oracle.sqlplus.ic, 19.0.0.0.0...
  62. Patching component oracle.wwg.plsql, 19.0.0.0.0...
  63. Patching component oracle.xdk.rsf, 19.0.0.0.0...
  64. Patching component oracle.install.deinstalltool, 19.0.0.0.0...
  65. Patching component oracle.sdo.locator, 19.0.0.0.0...
  66. Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...
  67. Patching component oracle.dbtoolslistener, 19.0.0.0.0...
  68. Patching component oracle.xdk, 19.0.0.0.0...
  69. Patching component oracle.rdbms.drdaas, 19.0.0.0.0...
  70. Patching component oracle.xdk.xquery, 19.0.0.0.0...
  71. Patching component oracle.rdbms.rman, 19.0.0.0.0...
  72. Patching component oracle.network.client, 19.0.0.0.0...
  73. Patching component oracle.rdbms.hs_common, 19.0.0.0.0...
  74. Patching component oracle.nlsrtl.rsf.lbuilder, 19.0.0.0.0...
  75. Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...
  76. Patching component oracle.mgw.common, 19.0.0.0.0...
  77. Patching component oracle.rdbms.dv, 19.0.0.0.0...
  78. Patching component oracle.ldap.ssl, 19.0.0.0.0...
  79. Patching component oracle.xdk.parser.java, 19.0.0.0.0...
  80. Patching component oracle.ctx.rsf, 19.0.0.0.0...
  81. Patching component oracle.rdbms.lbac, 19.0.0.0.0...
  82. Patching component oracle.rdbms.hsodbc, 19.0.0.0.0...
  83. Patching component oracle.ctx.atg, 19.0.0.0.0...
  84. Patching component oracle.oraolap, 19.0.0.0.0...
  85. Patching component oracle.oraolap.api, 19.0.0.0.0...
  86. Patching component oracle.odbc, 19.0.0.0.0...
  87. Patching component oracle.ldap.client, 19.0.0.0.0...
  88. Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...
  89. Patching component oracle.rdbms.install.common, 19.0.0.0.0...
  90. Patching component oracle.ovm, 19.0.0.0.0...
  91. Patching component oracle.network.listener, 19.0.0.0.0...
  92. Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...
  93. Patching component oracle.javavm.server, 19.0.0.0.0...
  94. Patching component oracle.precomp.lang, 19.0.0.0.0...
  95. Patching component oracle.precomp.common, 19.0.0.0.0...
  96. Patching component oracle.jdk, 1.8.0.201.0...
  97. Patch 35943157 successfully applied.
  98. Sub-set patch [29517242] has become inactive due to the application of a super-set patch [35943157].
  99. Please refer to Doc ID 2161861.1 for any possible further required actions.
  100. Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2024-02-05_15-41-25PM_1.log
  101. OPatch succeeded.
  102. real    36m32.647s
  103. user    20m16.850s
  104. sys     9m43.814s
复制代码
成功,耗时半小时。
以上安装是交互式的,中心有两处需要用户输入Y或N。可以指定-silent选项以静默运行。
补丁安装后的利用:
  1. connect / as sysdba
  2. startup
  3. alter pluggable database all open;
  4. quit
复制代码
实行脚本:
  1. cd $ORACLE_HOME/OPatch
  2. ./datapatch -verbose
复制代码
输出如下:
  1. $ time ./datapatch -verbose
  2. SQL Patching tool version 19.22.0.0.0 Production on Mon Feb  5 21:09:00 2024
  3. Copyright (c) 2012, 2024, Oracle.  All rights reserved.
  4. Log file for this invocation: /opt/oracle/cfgtoollogs/sqlpatch/sqlpatch_5704_2024_02_05_21_09_00/sqlpatch_invocation.log
  5. Connecting to database...OK
  6. Gathering database info...done
  7. Note:  Datapatch will only apply or rollback SQL fixes for PDBs
  8.        that are in an open state, no patches will be applied to closed PDBs.
  9.        Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
  10.        (Doc ID 1585822.1)
  11. Bootstrapping registry and package to current versions...done
  12. Determining current state...done
  13. Current state of interim SQL patches:
  14. Interim patch 35926646 (OJVM RELEASE UPDATE: 19.22.0.0.240116 (35926646)):
  15.   Binary registry: Installed
  16.   PDB CDB$ROOT: Applied successfully on 05-FEB-24 02.55.32.207669 PM
  17.   PDB ORCLPDB1: Applied successfully on 05-FEB-24 02.55.33.974523 PM
  18.   PDB PDB$SEED: Applied successfully on 05-FEB-24 02.55.33.368845 PM
  19. Current state of release update SQL patches:
  20.   Binary registry:
  21.     19.22.0.0.0 Release_Update 240104023954: Installed
  22.   PDB CDB$ROOT:
  23.     Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 11-JAN-24 04.17.24.530288 PM
  24.   PDB ORCLPDB1:
  25.     Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 11-JAN-24 04.24.22.690150 PM
  26.   PDB PDB$SEED:
  27.     Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 11-JAN-24 04.24.22.690150 PM
  28. Adding patches to installation queue and performing prereq checks...done
  29. Installation queue:
  30.   For the following PDBs: CDB$ROOT PDB$SEED ORCLPDB1
  31.     No interim patches need to be rolled back
  32.     Patch 35943157 (Database Release Update : 19.22.0.0.240116 (35943157)):
  33.       Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.22.0.0.0 Release_Update 240104023954
  34.     No interim patches need to be applied
  35. Installing patches...
  36. Patch installation complete.  Total patches installed: 3
  37. Validating logfiles...done
  38. Patch 35943157 apply (pdb CDB$ROOT): SUCCESS
  39.   logfile: /opt/oracle/cfgtoollogs/sqlpatch/35943157/25527362/35943157_apply_ORCLCDB_CDBROOT_2024Feb05_21_09_27.log (no errors)
  40. Patch 35943157 apply (pdb PDB$SEED): SUCCESS
  41.   logfile: /opt/oracle/cfgtoollogs/sqlpatch/35943157/25527362/35943157_apply_ORCLCDB_PDBSEED_2024Feb05_21_16_01.log (no errors)
  42. Patch 35943157 apply (pdb ORCLPDB1): SUCCESS
  43.   logfile: /opt/oracle/cfgtoollogs/sqlpatch/35943157/25527362/35943157_apply_ORCLCDB_ORCLPDB1_2024Feb05_21_16_01.log (no errors)
  44. SQL Patching tool complete on Mon Feb  5 21:27:20 2024
  45. real    18m19.684s
  46. user    0m33.220s
  47. sys     0m3.595s
复制代码
这里有一个小插曲,第一次实行datapatch 时非常慢,我强行中断了。
然后回家又做了一遍,这次快些了,只用了18分钟。
实行datapatch时,解压的数据库补丁我已经删除了,说明其不需要了。
其他

RMAN catalog如果有,也需要升级。我没有,此处略。
另有一些可能需要升级的,详见文档。
验证升级成功

  1. SQL> select banner_full from v$version;
  2. BANNER_FULL
  3. --------------------------------------------------------------------------------
  4. Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
  5. Version 19.22.0.0.0
  6. SQL> select banner_legacy from v$version;
  7. BANNER_LEGACY
  8. --------------------------------------------------------------------------------
  9. Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
复制代码
清算

  1. # 删除备份的Oracle Home
  2. rm ~/backup/oracle_home_bkup.tar
  3. # 删除解压的补丁包
  4. PATCHDIR=/home/oracle/patchdir
  5. rm -fr $PATCHDIR
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表