In today’s article, I will explain how to upgrade our Oracle Database 19.3 database built on Grid Infrastructure.
The database we will upgrade is running 19.3 and we will update it to 19.9.
Oracle publishes Patch Set Updates every 6 months.
These patches, which we can follow from the link below, are necessary for the security, performance and stable operation of both the Grid environment and the database.
1 | ” https://www.oracle.com/security-alerts/ ” |
First, the grid will be upgraded, then the database will be upgraded.
First of all, we make the following installations via support.
For GI Upgrade: 31750108
For DB Upgrade: 31771877
Let’s start ;
1 2 3 | $ mkdir -p /u01/patch /u01/patch/db df /u01/patch/grid $ chown -R oracle:oinstall /u01/patch $ chmod -R 775 /u01/patch |
First of all, we will upgrade the GI, or Grid.
1 2 | $ cd /u01/patch/grid $ unzip p31750108_190000_Linux-x86-64.zip |
1 2 3 4 | $ <ORACLE_HOME>/OPatch/opatch version [oracle@node1 OPatch]$ ./opatch version OPatch Version: 12.2.0.1.17 OPatch succeeded. |
On the readme I used for the patch, it is stated that the Opatch version must be at least 12.2.0.1.19 and later.
I will update Opatch now. Then I download the latest version (Patch 6880880) from support.
1 2 3 4 5 | $ cd /u01/app/19.0.0.0/grid $ mv OPatch OPatch_old $ unzip p6880880_200000_Linux-x86-64.zip $ chmod -R 775 OPatch $ chown -R oracle:oinstall OPatch |
Let’s check the update.
1 2 3 | [root@node1 OPatch]# ./opatch version OPatch Version: 12.2.0.1.23 OPatch succeeded. |
We are checking if there is another patch that affects us.
If there are, we will need to rollback with the specified patch numbers.
I start as follows. The first 5 steps will be on GRID_HOME and the last 2 steps will be on ORACLE_HOME.
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31771877 Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_16-46-17PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
There is no problem, I continue with the others, one by one.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31772784 Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_16-47-11PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31773437 Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_16-47-37PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31780966 Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_16-47-58PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/ Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_16-48-25PM_1.log This command doesn't support System Patch. OPatch failed with error code 21 |
The last error doesn’t matter to us, this line is actually extra in the readme.
I run tests via Oracle HOME.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31771877 Oracle Interim Patch Installer version 12.2.0.1.17 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/19.0.0.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.17 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-01-03_16-50-10PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/grid/31750108/31772784 Oracle Interim Patch Installer version 12.2.0.1.17 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/19.0.0.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.17 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-01-03_16-50-54PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
We are coming to the final stages. We open a file named “patch_list_gihome.txt” in tmp and add the following lines.
1 2 3 4 5 6 | $ nano /tmp/patch_list_gihome.txt /u01/patch/grid/31750108/31771877 /u01/patch/grid/31750108/31772784 /u01/patch/grid/31750108/31773437 /u01/patch/grid/31750108/31780966 |
We make final checks after the addition process.
1 | $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [oracle@node1 ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/19.0.0.0/grid Central Inventory : /u01/app/oraInventory from : /u01/app/19.0.0.0/grid/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/19.0.0.0/grid/cfgtoollogs/opatch/opatch2021-01-03_17-03-36PM_1.log Invoking prereq "checksystemspace" Prereq "checkSystemSpace" pass OPatch succeeded. |
We will upgrade for GI with “opatchauto”.
In this way, all operations such as closing and opening CRS will be done automatically.
1 2 | # export PATH=$PATH:$ORACLE_HOME/OPatch # opatchauto apply /u01/patch/grid//31750108 -oh /u01/app/19.0.0.0/grid |
Opatch process for GI started
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [root@node1 OPatch]# opatchauto apply /u01/patch/grid//31750108 -oh /u01/app/19.0.0.0/grid OPatchauto session is initiated at Sun Jan 3 17:29:48 2021 System initialization log file is /u01/app/19.0.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-01-03_05-29-52PM.log. Session log file is /u01/app/19.0.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-01-03_05-29-57PM.log The id for this session is P3IG Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.0.0.0/grid Patch applicability verified successfully on home /u01/app/19.0.0.0/grid Executing patch validation checks on home /u01/app/19.0.0.0/grid Patch validation checks successfully completed on home /u01/app/19.0.0.0/grid Bringing down CRS service on home /u01/app/19.0.0.0/grid Prepatch operation log file location: /u01/app/oracle/crsdata/node1/crsconfig/hapatch_2021-01-03_05-30-31PM.log CRS service brought down successfully on home /u01/app/19.0.0.0/grid Start applying binary patch on home /u01/app/19.0.0.0/grid . . . . |
If you want, you can follow the situation via log file location.
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 | tail -100f /u01/app/oracle/crsdata/node1/crsconfig/hapatch_2021-01-03_05-30-31PM.log . . . . . End Command output 2021-01-03 17:30:57: Configured CRS Home: /u01/app/19.0.0.0/grid 2021-01-03 17:30:57: Executing cmd: /u01/app/19.0.0.0/grid/bin/crsctl check has 2021-01-03 17:30:57: Command output: CRS-4639: Could not contact Oracle High Availability Services End Command output 2021-01-03 17:30:57: The GI home to unlock: /u01/app/19.0.0.0/grid 2021-01-03 17:30:57: Unlocking the GI home: /u01/app/19.0.0.0/grid 2021-01-03 17:30:57: Processing directory permissions 2021-01-03 17:30:57: set the permissions on the /u01/app/19.0.0.0/grid/jdk directory 2021-01-03 17:30:57: set the permissions on the /u01/app/19.0.0.0/grid/perl directory 2021-01-03 17:30:57: set the permissions on the /u01/app/19.0.0.0/grid/bin directory 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/asmcmdcore 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/asmcmdcore 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/extjob 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/cluvfyrac.sh 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/dbstart 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/extjobo 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/extjobo 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/extproc 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/oracle 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/oradism 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/relink 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/oklist0 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/xmlwf 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/asmcmd 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/jssu 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/onsctl 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/okinit0 2021-01-03 17:30:57: skip setting perms for exclude file /u01/app/19.0.0.0/grid/bin/okdstry0 2021-01-03 17:30:57: set the permissions on the /u01/app/19.0.0.0/grid/lib directory 2021-01-03 17:30:57: Executing cmd: /u01/app/19.0.0.0/grid/bin/clsecho -p has -f clsrsc -m 347 '/u01/app/19.0.0.0/grid' 2021-01-03 17:30:57: Executing cmd: /u01/app/19.0.0.0/grid/bin/clsecho -p has -f clsrsc -m 347 '/u01/app/19.0.0.0/grid' 2021-01-03 17:30:57: Command output: CLSRSC-347: Successfully unlock /u01/app/19.0.0.0/grid End Command output 2021-01-03 17:30:57: CLSRSC-347: Successfully unlock /u01/app/19.0.0.0/grid 2021-01-03 17:30:57: Executing cmd: /u01/app/19.0.0.0/grid/bin/clsecho -p has -f clsrsc -m 671 2021-01-03 17:30:57: Executing cmd: /u01/app/19.0.0.0/grid/bin/clsecho -p has -f clsrsc -m 671 |
GI Patch process is over and we have completed the process successfully.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Host:node1 SIHA Home:/u01/app/19.0.0.0/grid Version:19.0.0.0.0 Summary: ==Following patches were SUCCESSFULLY applied: Patch: /u01/patch/grid/31750108/31771877 Log: /u01/app/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-01-03_17-31-00PM_1.log Patch: /u01/patch/grid/31750108/31772784 Log: /u01/app/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-01-03_17-31-00PM_1.log Patch: /u01/patch/grid/31750108/31773437 Log: /u01/app/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-01-03_17-31-00PM_1.log Patch: /u01/patch/grid/31750108/31780966 Log: /u01/app/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-01-03_17-31-00PM_1.log OPatchauto session completed at Sun Jan 3 17:38:50 2021 Time taken to complete the session 9 minutes, 2 seconds |
Now we will continue for the database.
I quickly update Opatch from scratch. I am transferring the latest version of Opatch that I downloaded here.
1 2 3 | $ cd /u01/app/oracle/product/19.0.0.0/dbhome_1 $ mv OPatch OPatch_old $ cp -r /u01/app/19.0.0.0/grid/OPatch /u01/app/oracle/product/19.0.0.0/dbhome_1/ |
Let’s start with database updates.
1 2 3 4 5 | $ cd /u01/patch/db $ unzip p31771877_190000_Linux-x86-64.zip $ $ORALCE_HOME/opatch version OPatch Version: 12.2.0.1.23 OPatch succeeded. |
I’m doing the checks.
1 | $ export PATH=$PATH:/usr/ccs/bin |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $ cd /u01/patch/db/31771877 $ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/19.0.0.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-01-03_17-47-55PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded. |
The problem does not appear. Now we close the Listener and the database.
1 2 3 4 5 | $ lsnrctl stop LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-JAN-2021 17:49:39 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) The command completed successfully |
1 2 3 4 5 6 7 8 9 10 11 12 | $ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 3 17:49:44 2021 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 SQL> shu immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> |
And let the Patch begin.
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 | $ $ORACLE_HOME/OPatch/opatch apply Oracle Interim Patch Installer version 12.2.0.1.23 Copyright (c) 2021, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/19.0.0.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.0.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.23 OUI version : 12.2.0.7.0 Log file location : /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-01-03_17-50-59PM_1.log Verifying environment and performing prerequisite checks… OPatch continues with these patches: 31771877 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/19.0.0.0/dbhome_1') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files… Applying interim patch '31771877' to OH '/u01/app/oracle/product/19.0.0.0/dbhome_1' ApplySession: Optional component(s) [ oracle.network.gsm, 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.options.olap.awm, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.assistants.usm, 19.0.0.0.0 ] , [ oracle.assistants.asm, 19.0.0.0.0 ] , [ oracle.sqlj, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] not present in the Oracle Home or a higher version is found. |
Database patching process has been completed.
1 2 3 4 5 6 7 8 9 10 11 | Patching component oracle.xdk.rsf, 19.0.0.0.0… Patching component oracle.xdk.parser.java, 19.0.0.0.0… Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0… Patching component oracle.precomp.common, 19.0.0.0.0… Patching component oracle.precomp.lang, 19.0.0.0.0… Patching component oracle.jdk, 1.8.0.201.0… Patch 31771877 successfully applied. Sub-set patch [29517242] has become inactive due to the application of a super-set patch [31771877]. Please refer to Doc ID 2161861.1 for any possible further required actions. Log file location: /u01/app/oracle/product/19.0.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-01-03_17-50-59PM_1.log OPatch succeeded. |
From now on, it’s comfortable. Let’s see what happened.
1 2 3 4 5 6 7 | $ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 3 17:55:20 2021 Version 19.9.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. SQL> |
It looks like it’s loaded now.