Oracle 18c RAC 集群 RUR 从18.3.0 升级到18.3.1
本文链接:https://www.cndba.cn/dave/article/3142
1. 18c 补丁版本说明
Oracle 从18c 开始,版本号和补丁结构发生了明显的变化,新的补丁体系里只有RU和RUR的概念。版本号也只有前三位有效,如下图:
- 第一位数字是Oracle数据库的主版本号,比如Oracle 18c,12c。 从Oracle 18c开始,第一个数字表示Oracle数据库版本发布的最初的年份,比如2018年是Oracle 18c(18.0.0.0.0)的最初发布年份。
- 第二位数字是Oracle RU(Release Update)的发布季度。比如18.3。
- 第三位数字是Oracle RUR(release updates revision)的发布季度,比如18.1.1,18.2.1,18.3.0。
所以从18c 开始,我们打补丁,实际上打的RU或者RUR。 本文档我们看Oracle 18c中如何打RUR的补丁。 即从18.3.0 升级到18.3.1。 具体的Patch可以从MOS上下载。
RU如下:
RUR如下:
2. 当前RAC集群环境
当前GI和DB的版本都是18.3.0。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | [root@www.cndba.cn ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ASMNET1LSNR_ASM.lsnr ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.DATA.dg ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.LISTENER.lsnr ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.MGMT.GHCHKPT.advm OFFLINE OFFLINE rac1 STABLE OFFLINE OFFLINE rac2 STABLE ora.MGMT.dg ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.OCR.dg ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.helper OFFLINE OFFLINE rac1 IDLE,STABLE OFFLINE OFFLINE rac2 IDLE,STABLE ora.mgmt.ghchkpt.acfs OFFLINE OFFLINE rac1 STABLE OFFLINE OFFLINE rac2 STABLE ora.net1.network ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.ons ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.proxy_advm ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac1 STABLE ora.MGMTLSNR 1 ONLINE ONLINE rac1 169.254.19.196 192.1 68.56.100,STABLE ora.asm 1 ONLINE ONLINE rac1 Started,STABLE 2 ONLINE ONLINE rac2 Started,STABLE 3 OFFLINE OFFLINE STABLE ora.cndba.cndba_taf.svc 2 ONLINE ONLINE rac1 STABLE ora.cndba.db 1 ONLINE ONLINE rac2 Open,HOME=/u01/app/o racle/product/18.3.0 /db_1,STABLE 2 ONLINE ONLINE rac1 Open,HOME=/u01/app/o racle/product/18.3.0 /db_1,STABLE ora.cndba.pdb_taf.svc 1 ONLINE ONLINE rac1 STABLE ora.cvu 1 ONLINE ONLINE rac1 STABLE ora.mgmtdb 1 ONLINE ONLINE rac1 Open,STABLE ora.qosmserver 1 ONLINE INTERMEDIATE rac1 STABLE ora.rac1.vip 1 ONLINE ONLINE rac1 STABLE ora.rac2.vip 1 ONLINE ONLINE rac2 STABLE ora.rhpserver 1 OFFLINE OFFLINE STABLE ora.scan1.vip 1 ONLINE ONLINE rac1 STABLE -------------------------------------------------------------------------------- [root@www.cndba.cn ~]# [grid@www.cndba.cn ~]$ crsctl query crs softwareversion Oracle Clusterware version on node [rac2] is [18.0.0.0.0] [grid@www.cndba.cn ~]$ crsctl query crs releaseversion Oracle High Availability Services release version on the local node is [18.0.0.0.0] [oracle@www.cndba.cn trace]$ sqlplus / as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Fri Nov 16 09:56:13 2018 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DAVE READ WRITE NO |
3. 开始打RUR
Oracle patch的压缩包里都会有一个readme 文件,可以查看该文件,了解打Patch的步骤。
3.1 RUR Patch 说明
在第一节讲RUR的时候,看到官方分别给出了DB和GI的RUR。 实际上,GI的RUR中,也包含了DB的RUR,所有在下载的时候只需要下载GI的RUR即可。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@www.cndba.cn ~]# unzip p28660077_180000_Linux-x86-64_GI.zip [root@www.cndba.cn ~]# cd 28660077/ [root@www.cndba.cn 28660077]# ls 28090553 28090557 28090564 28256701 28507480 automation bundle.xml README.html README.txt [root@www.cndba.cn 28660077]# ll total 128 drwxr-x--- 5 root root 62 Sep 18 05:46 28090553 drwxr-x--- 5 root root 62 Sep 18 05:45 28090557 drwxr-x--- 4 root root 48 Sep 18 05:45 28090564 drwxr-x--- 4 root root 48 Sep 18 05:46 28256701 drwxr-x--- 4 root root 67 Sep 18 05:44 28507480 drwxr-x--- 2 root root 4096 Sep 18 05:46 automation -rw-rw-r-- 1 root root 5824 Sep 18 14:00 bundle.xml -rw-rw-r-- 1 root root 118391 Oct 15 15:32 README.html -rw-r--r-- 1 root root 0 Sep 18 05:46 README.txt [root@www.cndba.cn 28660077]# |
3.2 检查OPatch工具版本
在Oracle 18c的RUR,OPatch的版本必须大于12.2.0.1.14. 最新版本的Opatch可以从MOS 6880880上下载。 目前最新版是OPatch 12.2.0.1.16 for DB 18.x releases (OCT 2018)。
1 2 3 4 5 6 7 8 9 10 11 12 13 | [oracle@www.cndba.cn trace]$ cd $ORACLE_HOME/OPatch [oracle@www.cndba.cn OPatch]$ ./opatch version OPatch Version: 12.2.0.1.14 OPatch succeeded. [oracle@www.cndba.cn OPatch]$ [grid@www.cndba.cn ~]$ cd $ORACLE_HOME/OPatch [grid@www.cndba.cn OPatch]$ ./opatch version OPatch Version: 12.2.0.1.14 OPatch succeeded. [grid@www.cndba.cn OPatch]$ |
18c中默认版本就是12.2.0.1.14,所以不用升级Opatch,如果要申请,可以参考我的博客:
Oracle 更新 OPatch 工具版本 的方法 说明
https://www.cndba.cn/cndba/dave/article/1353
3.3 验证Oracle Inventory的有效性
GI HOME 和DB HOME 都需要验证,分别使用grid和oracle用户执行如下命令,确保返回SUCCESS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | $ <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME> [grid@www.cndba.cn OPatch]$ opatch lsinventory -detail -oh $ORACLE_HOME …… Patch Location in Inventory: /u01/app/18.3.0/grid/inventory/oneoffs/28090523 Patch Location in Storage area: /u01/app/18.3.0/grid/.patch_storage/28090523_Jul_14_2018_00_03_50 -------------------------------------------------------------------------------- OPatch succeeded. [grid@www.cndba.cn OPatch]$ [oracle@www.cndba.cn OPatch]$ ./opatch lsinventory -detail -oh $ORACLE_HOME Oracle Interim Patch Installer version 12.2.0.1.14 Copyright (c) 2018, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/18.3.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/18.3.0/db_1/oraInst.loc OPatch version : 12.2.0.1.14 OUI version : 12.2.0.4.0 Log file location : /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatch/opatch2018-11-16_10-34-32AM_1.log …… Patch Location in Inventory: /u01/app/oracle/product/18.3.0/db_1/inventory/oneoffs/28090523 Patch Location in Storage area: /u01/app/oracle/product/18.3.0/db_1/.patch_storage/28090523_Jul_14_2018_00_03_50 -------------------------------------------------------------------------------- OPatch succeeded. [oracle@www.cndba.cn OPatch]$ |
3.4 检查Patch 是否冲突
18.3.1的GI RUR里包含5个补丁,所有我们需要执行5次检查:
用grid用户执行以下3条:
1 2 3 | $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/28660077/28507480 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/28660077/28090553 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/28660077/28090557 |
用oracle用户执行如下2条:
1 2 | $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/28660077/28507480 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/28660077/28090553 |
我这里的执行的命令如下,这里用不同用户执行之前先必须修改patch包的权限,否则会报错:
1 2 3 4 5 6 7 8 | [root@www.cndba.cn tmp]# chown grid:oinstall -R 28660077/ ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/28660077/28507480 ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/28660077/28090553 ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/28660077/28090557 [root@www.cndba.cn tmp]# chown oracle:oinstall -R 28660077/ ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/28660077/28507480 ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /tmp/28660077/28090553 |
3.5 检查系统空间
在打Patch之前需要先确保ORACLE_HOME 所在的文件系统有足够的空闲空间,可以执行如下命令来检查。
用GI用户创建临时文件并添加如下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [grid@www.cndba.cn OPatch]$ cat /tmp/patch_list_gihome.txt /tmp/28660077/28507480 /tmp/28660077/28090553 /tmp/28660077/28090557 [root@www.cndba.cn tmp]# chown grid:oinstall -R 28660077/ [grid@www.cndba.cn OPatch]$ ./opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt Oracle Interim Patch Installer version 12.2.0.1.14 Copyright (c) 2018, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/18.3.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/18.3.0/grid/oraInst.loc OPatch version : 12.2.0.1.14 OUI version : 12.2.0.4.0 Log file location : /u01/app/18.3.0/grid/cfgtoollogs/opatch/opatch2018-11-16_11-32-07AM_1.log Invoking prereq "checksystemspace" Prereq "checkSystemSpace" passed. OPatch succeeded. [grid@www.cndba.cn OPatch]$ |
用DB用户创建临时文件并添加以下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [oracle@www.cndba.cn OPatch]$ cat /tmp/patch_list_dbhome.txt /tmp/28660077/28507480 /tmp/28660077/28090553 [root@www.cndba.cn tmp]# chown oracle:oinstall -R 28660077/ [oracle@www.cndba.cn OPatch]$ ./opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt Oracle Interim Patch Installer version 12.2.0.1.14 Copyright (c) 2018, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/18.3.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/18.3.0/db_1/oraInst.loc OPatch version : 12.2.0.1.14 OUI version : 12.2.0.4.0 Log file location : /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatch/opatch2018-11-16_11-33-48AM_1.log Invoking prereq "checksystemspace" Prereq "checkSystemSpace" passed. OPatch succeeded. [oracle@www.cndba.cn OPatch]$ |
3.6 自动应用patch
在DB HOME的版本和GI HOME的版本一致的情况下,可以使用opatchauto对这2个HOME进行Patch操作。该操作必须使用root用户执行,如果GI HOME和DB HOME不在共享存储上,那么必须分别在不同的节点上运行,但不能同时运行,只能一个一个节点来。
根据命令选项的不同,opatchauto调用可以对GI HOME,DB HOME,或者同版本的GI 和DB HOME进行操作。
用root命令执行如下操作,首先设置OPatch的环境变量:
1 | # export PATH=$PATH:<GI_HOME>/OPatch |
对同版本的GI 和所有DB HOME 进行patch:
1 | # opatchauto apply <UNZIPPED_PATCH_LOCATION>/28660077 |
对GI HOME 进行patch:
1 | # opatchauto apply <UNZIPPED_PATCH_LOCATION>/28660077 -oh <GI_HOME> |
对一个或者多个DB HOME 进行patch:
1 | # opatchauto apply <UNZIPPED_PATCH_LOCATION>/28660077 -oh <oracle_home1_path>,<oracle_home2_path> |
示例如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | [root@www.cndba.cn tmp]# export PATH=$PATH:/u01/app/18.3.0/grid/OPatch [root@www.cndba.cn tmp]# chown grid:oinstall -R 28660077 [root@www.cndba.cn tmp]# opatchauto apply /tmp/28660077 OPatchauto session is initiated at Fri Nov 16 12:19:02 2018 System initialization log file is /u01/app/18.3.0/grid/cfgtoollogs/opatchautodb/systemconfig2018-11-16_12-19-04PM.log. Session log file is /u01/app/18.3.0/grid/cfgtoollogs/opatchauto/opatchauto2018-11-16_12-20-46PM.log The id for this session is 8N2R Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/18.3.0/db_1 Executing OPatch prereq operations to verify patch applicability on home /u01/app/18.3.0/grid Patch applicability verified successfully on home /u01/app/18.3.0/grid Patch applicability verified successfully on home /u01/app/oracle/product/18.3.0/db_1 Verifying SQL patch applicability on home /u01/app/oracle/product/18.3.0/db_1 SQL patch applicability verified successfully on home /u01/app/oracle/product/18.3.0/db_1 Preparing to bring down database service on home /u01/app/oracle/product/18.3.0/db_1 Successfully prepared home /u01/app/oracle/product/18.3.0/db_1 to bring down database service Bringing down CRS service on home /u01/app/18.3.0/grid CRS service brought down successfully on home /u01/app/18.3.0/grid Performing prepatch operation on home /u01/app/oracle/product/18.3.0/db_1 Perpatch operation completed successfully on home /u01/app/oracle/product/18.3.0/db_1 Start applying binary patch on home /u01/app/oracle/product/18.3.0/db_1 Binary patch applied successfully on home /u01/app/oracle/product/18.3.0/db_1 Performing postpatch operation on home /u01/app/oracle/product/18.3.0/db_1 Postpatch operation completed successfully on home /u01/app/oracle/product/18.3.0/db_1 Start applying binary patch on home /u01/app/18.3.0/grid Binary patch applied successfully on home /u01/app/18.3.0/grid Starting CRS service on home /u01/app/18.3.0/grid CRS service started successfully on home /u01/app/18.3.0/grid Preparing home /u01/app/oracle/product/18.3.0/db_1 after database service restarted No step execution required......... Trying to apply SQL patch on home /u01/app/oracle/product/18.3.0/db_1 SQL patch applied successfully on home /u01/app/oracle/product/18.3.0/db_1 OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:rac1 RAC Home:/u01/app/oracle/product/18.3.0/db_1 Version:18.0.0.0.0 Summary: ==Following patches were SKIPPED: Patch: /tmp/28660077/28090557 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /tmp/28660077/28090564 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /tmp/28660077/28256701 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /tmp/28660077/28090553 Reason: This patch is already been applied, so not going to apply again. ==Following patches were SUCCESSFULLY applied: Patch: /tmp/28660077/28507480 Log: /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-16_12-29-40PM_1.log Host:rac1 CRS Home:/u01/app/18.3.0/grid Version:18.0.0.0.0 Summary: ==Following patches were SKIPPED: Patch: /tmp/28660077/28090553 Reason: This patch is already been applied, so not going to apply again. Patch: /tmp/28660077/28090557 Reason: This patch is already been applied, so not going to apply again. Patch: /tmp/28660077/28090564 Reason: This patch is already been applied, so not going to apply again. Patch: /tmp/28660077/28256701 Reason: This patch is already been applied, so not going to apply again. ==Following patches were SUCCESSFULLY applied: Patch: /tmp/28660077/28507480 Log: /u01/app/18.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2018-11-16_12-36-38PM_1.log Patching session reported following warning(s): _________________________________________________ [WARNING] The database instance 'cndba1' from '/u01/app/oracle/product/18.3.0/db_1', in host'rac1' is not running. SQL changes, if any, will not be applied. To apply. the SQL changes, bring up the database instance and run the command manually from any one node (run as oracle). Refer to the readme to get the correct steps for applying the sql changes. OPatchauto session completed at Fri Nov 16 12:47:49 2018 Time taken to complete the session 28 minutes, 47 seconds [root@www.cndba.cn tmp]# |
注意事项:
操作之前,db 和 gi我都没有关闭,是在patch过程自动进行的启停,这里只会停止操作的节点,另外的节点正常运行。
注意patch 的应用顺序,是先应用DB的,再GI.
Patch 应用成功,但因为之前测试Flex ASM 之后,导致db1 跑到了节点2运行,所以这里SQL 加载失败,提示让我们手工运行。
12345ora.cndba.db1 ONLINE ONLINE rac2 Open,HOME=/u01/app/oracle/product/18.3.0/db_1,STABLE2 ONLINE OFFLINE STABLE因为我们的GI 和 DB HOME 不是共享的,所以讲patch 上传到节点2,然后进行同样的步骤,这里不在重复记录。
但是在第二个节点执行的时候报如下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | Connecting to database...OK Gathering database info...done 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 interim SQL patches: Interim patch 27923415 (OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)): Binary registry: Installed PDB CDB$ROOT: Applied successfully on 13-SEP-18 08.07.51.238119 PM PDB PDB$SEED: Applied successfully on 13-SEP-18 08.16.41.893607 PM PDB RAC: Applied successfully on 13-SEP-18 08.40.04.436223 PM Current state of release update SQL patches: Binary registry: 18.3.1.0.0 Release_Update_Revision 1809111630: Installed PDB CDB$ROOT: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 13-SEP-18 08.07.51.234445 PM PDB PDB$SEED: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 13-SEP-18 08.16.41.885007 PM PDB RAC: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 13-SEP-18 08.40.04.421549 PM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT PDB$SEED RAC No interim patches need to be rolled back Patch 28507480 (Database Release Update Revision : 18.3.1.0.181016 (28507480)): Apply from 18.3.0.0.0 Release_Update 1806280943 to 18.3.1.0.0 Release_Update_Revision 1809111630 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 28507480 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/grid/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply__MGMTDB_CDBROOT_2018Nov16_14_19_39.log (no errors) Patch 28507480 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/grid/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply__MGMTDB_PDBSEED_2018Nov16_14_22_32.log (no errors) Patch 28507480 apply (pdb RAC): SUCCESS logfile: /u01/app/grid/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply__MGMTDB_RAC_2018Nov16_14_22_32.log (no errors) SQL Patching tool complete on Fri Nov 16 14:24:09 2018 MGTCA-1005 : Could not connect to the GIMR. PRCZ-2104 : failed to find GIMR properties for client "dee596837a40ef53ffa7a72bc583f3e7" PRCZ-2043 : Failed to find credentials domain GIMR/SELF under the root domain. Error details: CRS-10407: (:CLSCRED1079:)Credential domain does not exist. 2018/11/16 14:24:19 CLSRSC-180: An error occurred while executing the command '/u01/app/18.3.0/grid/bin/mgmtca applysql' After fixing the cause of failure Run opatchauto resume ] OPATCHAUTO-68061: The orchestration engine failed. OPATCHAUTO-68061: The orchestration engine failed with return code 1 OPATCHAUTO-68061: Check the log for more details. OPatchAuto failed. OPatchauto session completed at Fri Nov 16 14:24:21 2018 Time taken to complete the session 45 minutes, 47 seconds opatchauto failed with error code 42。 |
从日志看已经加载过SQL了,但GIMR没有连接上,导致报错。 这个我们放到下节看。
3.7 加载修改后的SQL到数据库
打补丁后会修改一下SQL,这些SQL还没有加载到数据库中,需要运行Datapatch工具将这些修改后的SQL重新加载到数据库中,如果是RAC环境,只需要在一个节点执行就可以了。
对于18c的CDB架构,执行如下步骤:
- sqlplus /nolog
- SQL> Connect / as sysdba
- SQL> startup
- SQL> alter pluggable database all open;
- SQL> quit
- cd $ORACLE_HOME/OPatch
- ./datapatch -verbose
datapatch命令只对打开的数据库生效,所有Oracle建议在执行该命令之前将CDB和所有的PDB都打开,一次更新掉。 但如果有部分PDB没有打开,也可以在打开之后,重新运行datapatch命令。
我们从前面patch的日志看,在第二个节点执行的之后,已经执行过脚本。 我们查询视图发现并没有记录,应该是之前失败导致的。
1 2 3 4 5 6 7 8 9 10 | SQL> col action_time for a30 SQL> col comments for a50 SQL> select ACTION_TIME,VERSION,COMMENTS from dba_registry_history; ACTION_TIME VERSION COMMENTS ------------------------------ ------------------------- -------------------------------------------------- 18 RDBMS_18.3.0.0.0DBRU_LINUX.X64_180627 05-SEP-18 05.56.01.649566 AM 18.0.0.0.0 Patch applied from 18.1.0.0.0 to 18.3.0.0.0 05-SEP-18 05.59.19.425998 AM 18.3.0.0.180717OJVMRU RAN jvmpsu.sql 05-SEP-18 05.59.19.461095 AM 18.3.0.0.180717OJVMRU OJVM RU post-install |
那么我们重做执行脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | [oracle@www.cndba.cn dbs]$ sqlplus / as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Fri Nov 16 14:49:57 2018 Version 18.3.1.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.1.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 DAVE READ WRITE NO SQL> [oracle@www.cndba.cn ~]$ cd $ORACLE_HOME/OPatch [oracle@www.cndba.cn OPatch]$ ./datapatch -verbose SQL Patching tool version 18.0.0.0.0 Production on Fri Nov 16 14:50:47 2018 Copyright (c) 2012, 2018, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_26088_2018_11_16_14_50_47/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done 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 interim SQL patches: Interim patch 27923415 (OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)): Binary registry: Installed PDB CDB$ROOT: Applied successfully on 05-SEP-18 05.59.21.385206 AM PDB DAVE: Applied successfully on 05-SEP-18 06.14.06.035375 AM PDB PDB$SEED: Applied successfully on 05-SEP-18 06.14.06.035375 AM Current state of release update SQL patches: Binary registry: 18.3.1.0.0 Release_Update_Revision 1809111630: Installed PDB CDB$ROOT: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 05-SEP-18 05.59.21.379278 AM PDB DAVE: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 05-SEP-18 06.14.06.029791 AM PDB PDB$SEED: Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 05-SEP-18 06.14.06.029791 AM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT PDB$SEED DAVE No interim patches need to be rolled back Patch 28507480 (Database Release Update Revision : 18.3.1.0.181016 (28507480)): Apply from 18.3.0.0.0 Release_Update 1806280943 to 18.3.1.0.0 Release_Update_Revision 1809111630 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 28507480 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply_CNDBA_CDBROOT_2018Nov16_14_52_50.log (no errors) Patch 28507480 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply_CNDBA_PDBSEED_2018Nov16_14_54_46.log (no errors) Patch 28507480 apply (pdb DAVE): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28507480/22444948/28507480_apply_CNDBA_DAVE_2018Nov16_14_54_46.log (no errors) SQL Patching tool complete on Fri Nov 16 14:56:32 2018 [oracle@www.cndba.cn OPatch]$ |
查看版本:
1 2 3 4 5 6 7 8 9 10 | SQL> col version for a30 SQL> select ACTION_TIME,VERSION,COMMENTS from dba_registry_history; ACTION_TIME VERSION COMMENTS ------------------------------ ------------------------------ -------------------------------------------------- 18 RDBMS_18.3.0.0.0DBRUR_LINUX.X64_180910 05-SEP-18 05.56.01.649566 AM 18.0.0.0.0 Patch applied from 18.1.0.0.0 to 18.3.0.0.0 05-SEP-18 05.59.19.425998 AM 18.3.0.0.180717OJVMRU RAN jvmpsu.sql 05-SEP-18 05.59.19.461095 AM 18.3.0.0.180717OJVMRU OJVM RU post-install 16-NOV-18 02.54.25.563626 PM 18.0.0.0.0 Patch applied from 18.3.0.0.0 to 18.3.1.0.0 |
这次SQL更新注册到了视图。但是之前GIMR的错误还没有处理,我们连接GIMR查看一下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | [grid@www.cndba.cn OPatch]$ srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node rac2 [grid@www.cndba.cn OPatch]$ [grid@www.cndba.cn tmp]$ export ORACLE_SID=-MGMTDB [grid@www.cndba.cn tmp]$ sqlplus / as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Fri Nov 16 15:09:45 2018 Version 18.3.1.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.1.0.0 SQL> SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- -MGMTDB SQL> col action_time for a40 SQL> select ACTION_TIME,VERSION,COMMENTS from dba_registry_history; ACTION_TIME VERSION COMMENTS ---------------------------------------- ---------------------------------------- --------------------------------------------- 18 RDBMS_18.3.0.0.0DBRUR_LINUX.X64_180910 13-SEP-18 08.07.49.144286 PM 18.0.0.0.0 Patch applied from 18.1.0.0.0 to 18.3.0.0.0 16-NOV-18 02.21.58.013704 PM 18.0.0.0.0 Patch applied from 18.3.0.0.0 to 18.3.1.0.0 |
从查询看,已经升级了。
因为这里加载SQL只对已经open的实例有效,我们这里在操作之前库都已经打开了。如果有未打开的数据库,参考我的博客,单独对这些实例进行操作:
Oracle 18c 单实例 RUR 从18.3.0 升级到18.3.1 操作手册
https://www.cndba.cn/dave/article/3138
3.8 通过OPatch 确认Patch信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | [grid@www.cndba.cn OPatch]$ ./opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.14 Copyright (c) 2018, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/18.3.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/18.3.0/grid/oraInst.loc OPatch version : 12.2.0.1.14 OUI version : 12.2.0.4.0 Log file location : /u01/app/18.3.0/grid/cfgtoollogs/opatch/opatch2018-11-16_15-20-10PM_1.log Lsinventory Output file location : /u01/app/18.3.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2018-11-16_15-20-10PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: rac1 ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Grid Infrastructure 18c 18.0.0.0.0 There are 1 products installed in this Oracle Home. Interim patches (7) : Patch 28507480 : applied on Fri Nov 16 12:41:07 CST 2018 Unique Patch ID: 22444948 Patch description: "Database Release Update Revision : 18.3.1.0.181016 (28507480)" Created on 14 Sep 2018, 04:53:55 hrs PST8PDT Bugs fixed: 9062315, 13554903, 21547051, 21766220, 21806121, 23003564, 23310101 24489904, 24689376, 24737581, 24925863, 25035594, 25035599, 25287072 25348956, 25634405, 25726981, 25743479, 25824236, 25943740, 26226953 26336101, 26423085, 26427905, 26450454, 26476244, 26598422, 26615291 …… [oracle@www.cndba.cn OPatch]$ ./opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.14 Copyright (c) 2018, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/18.3.0/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/18.3.0/db_1/oraInst.loc OPatch version : 12.2.0.1.14 OUI version : 12.2.0.4.0 Log file location : /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatch/opatch2018-11-16_15-22-28PM_1.log Lsinventory Output file location : /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-11-16_15-22-28PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: rac2 ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 18c 18.0.0.0.0 There are 1 products installed in this Oracle Home. Interim patches (4) : Patch 28507480 : applied on Fri Nov 16 13:59:53 CST 2018 Unique Patch ID: 22444948 Patch description: "Database Release Update Revision : 18.3.1.0.181016 (28507480)" Created on 14 Sep 2018, 04:53:55 hrs PST8PDT Bugs fixed: 9062315, 13554903, 21547051, 21766220, 21806121, 23003564, 23310101 24489904, 24689376, 24737581, 24925863, 25035594, 25035599, 25287072 …… |
3.9 处理无效对象
最后一步就是处理无效对象,因为之前datapatch命令会加载SQL,这个过程可能会产生无效对象。 可以执行@utlrp.sql脚本处理这些无效对象:
1 2 3 4 | cd $ORACLE_HOME/rdbms/admin sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> @utlrp.sql |
至此Oracle 18c RAC 集群RUR升级完成。