Upgrade Oracle GI DB From 12 2 To 19c 1644774477
Upgrade Oracle GI DB From 12 2 To 19c 1644774477
2 to 19c
Majid Shabani
[email protected]
February 11, 2022
I will perform the following steps to perform upgrade:
• Overview
• Download Required Software
• Apply patch on source oracle home 12.2
• Upgrade Oracle Grid Infrastructure
• Installing Oracle Database 19 Software
• Upgrade Oracle Database Manually
• Perform Pre-Upgrade Actions
• Upgrading Oracle Database
• Perform Post-Upgrade Actions
Disclaimer
Do not consider this document as a reference to upgrade a production database. The author is not
responsible for any losses or damage resulted from using this article.
None of the advice is warranted to be free of errors. Please use this article at your own risk and after
thorough testing in your environment.
If anyone wishes to correct information presented in this article, please message me.
Upgrade Oracle GI & DB from 12.2 to 19c
Overview:
In this article I will upgrade the Oracle database with ASM from release 12.2.0.1 to release 19.14 non-
CDB.
Before you start an upgrade or downgrade process, Oracle strongly recommends that you update both
your earlier release and your new release Oracle Database and GI software. For Oracle Database 12c
release 2 (12.2), or later releases, update to the latest quarterly Release Update (Update) or Release
Update Revision (Revision). To do so please refer to Doc ID 888.1.
Also, it is recommended to perform GI & DB check Upgrade validations using ORAchk Health Check Tool.
This involves downloading an automated Autonomous Health Framework (AHF) from oracle support.
The method that used in this document to upgrade Oracle software is called an in-place upgrade which
makes the database inaccessible for business applications while the database software is being upgraded.
Usually, it is not acceptable in most mission-critical environments.
To minimize downtime, you can use other oracle technologies such as Oracle GoldenGate and Data Guard.
When upgrading a production database to a new release, the behavior of the optimizer in the new release
will be different from its behavior in the older release. As a result, the optimizer may change the execution
plans of some statements. Although in theory the new plan should be better but practically you cannot
guarantee that, to eliminate this risk you can save the currently used plans in SQL Plan Baselines, after the
upgrade process is done you are sure that the optimizer still uses the same plans that proved to be
optimal.
It is recommended to perform health check for upgrades using ORAchk. To accomplish this task, you must
download it from Oracle Support (Doc ID 1457357.1).
Because upgrading Grid Infrastructure on the practice environment has already be tested and for the sake
of minimizing the practice time, I have skipped this step from this practice document.
Note: The GI Release Update includes updates for both the Oracle Grid Infrastructure home and Oracle
Database home
# Extract the downloaded OPatch installation zip file to the GI & DB home directory
unzip -q /tmp/p6880880_122010_Linux-x86-64.zip -d /u01/app/12.2.0/grid/
unzip -q /tmp/p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/12.2.0/db_1/
# As grid user
crsctl stop has
tar cpPf - $ORACLE_HOME | xz -v -c -T 4 -1 > /u01/grid_home_bkp.tar
3. Disable the backup job in cron if any exists and then take a full backup of the entire database.
# As oracle user invoke rman and connect to database as target
rman target/
4. Apply patch on the source oracle home. Login as grid and perform the following task.
# login as root user and change current directory to the unzipped directory.
su -
cd /tmp/12c/33559966/33583921
# Post-installation
# Invoke SQL*PLUS and then startup DB in upgrade mode
sqlplus / as sysdba
startup upgrade
exit
su - oracle
$ORACLE_HOME/OPatch/opatch lspatches
10. As grid user, extract the image software into the grid home directory. My zip file is resided in /tmp
directory.
export ORACLE_HOME=/u01/app/19.0.0/grid
11. As grid user, Update Opatch Tool that resides in GI 19c. You must perform this task to be able to
apply latest patch on grid home during installation.
# Check the release of OPatch
# This patch requires OPatch of version 12.2.0.1.28 or later.
/u01/app/19.0.0/grid/OPatch/opatch version
12. As grid user unzip COMBO OF OJVM RU 19.14.0.0.220118 + GI RU 19.14.0.0.220118 patch file. My
patch zip file is resided in /tmp directory.
unzip -q /tmp/p33567274_190000_Linux-x86-64.zip -d /tmp/19c
13. As root user install the following packages latest release if didn’t installed before or update them.
# Check if the packages are installed
rpm -qa | \
egrep "kmod-20-2.*x86_64|kmod-libs-20-2.*x86_64|policycoreutils-python-2.5-17.*x86_64"
14. Install the new Oracle Grid Infrastructure software. Set the ORACLE_HOME variable to the new Oracle
Grid home directory then run gridSetup.sh script.
Note: Before upgrade GI, you must shutdown the database otherwise you will face INS-40436
warning message. As grid user run below command:
srvctl stop database -d db1 -o immediate
export ORACLE_HOME=/u01/app/19.0.0/grid
cd $ORACLE_HOME
./gridSetup.sh -applyRU /tmp/19c/33567274/33509923/
As you know the patch includes OJVM RU and according to readme file shipped with the patch no
need to apply it on GI home. To obtain more detail please refer to Doc ID 1929745.1.
Window Action
Configuration Option Upgrade Oracle Grid Infrastructure
Management Options Keep default values
The default location for the Oracle base directory should display as
Installation Location
/u01/app/grid.
Select the option Automatically run configuration scripts.
Root Script Execution
Enter the credentials for the root user or a sudo account.
It may show warning message that wants to update kmod and kmod-
Prerequisite Checks
lib package and install policycoreutils-python packages.
Summary Review the contents of the Summary window and then click Submit.
When the installation displays a confirmation message. Click on Yes
Install Product
button. it wants to run certain scripts.
Finish Now Grid Software upgrade is completed. Click on Close button.
# Verify patches
/u01/app/19.0.0/grid/bin/crsctl query has releasepatch
21. As oracle user, extract the image software into the database home directory. My zip file is resided
in /tmp directory.
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/db_1
unzip -q /tmp/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
24. Run the runInstaller script with -applyRU options to apply 19.14.0 RU during installation.
cd $ORACLE_HOME
./runInstaller -applyRU /tmp/19c/33567274/33509923/
Window Action
Configuration Option Select “Set Up Software Only” option.
Database Installation Options Select “Single instance database installation”
Database Edition Keep default value which is “Enterprise Edition”
Installation Location Oracle base directory should be /u01/app/oracle.
OSDBA: dba
OSOPER: dba
OSBACKUPDBA: dba
Operating system Groups
OSDGDBA: dba
OSKMDBA: dba
OSRACDBA: dba
Majid Shabani P a g e | 10
Upgrade Oracle GI & DB from 12.2 to 19c
# Run preupgrade
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
/u01/app/oracle/product/12.2.0/db_1/jdk/bin/java -jar \
/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/preupgrade.jar FILE TEXT DIR \
/home/oracle/upgrade_scripts
# Verify
SELECT STATUS FROM V$BLOCK_CHANGE_TRACKING;
30. As sysdba, run the preupgrade_fixups.sql script or perform one by one recommended
actions in the preupgrade log file.
Also, there might be some recommendation that must be manually applied. If the recommendation
doesn’t start with AUTOFIXUP then you must run it manually.
sqlplus / as sysdba
@/home/oracle/upgrade_scripts/preupgrade_fixups.sql
Majid Shabani P a g e | 11
Upgrade Oracle GI & DB from 12.2 to 19c
Note: you can purge RECYCLEBIN in parallel. please refer to this link. Thanks to Connor McDonald
for that post.
34. You must wait until all materialized views have completed refreshing. To determine if there are any
materialized view refreshes still in progress, run below command.
SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND
bitand(s.mflags, 8) =8;
Majid Shabani P a g e | 12
Upgrade Oracle GI & DB from 12.2 to 19c
# Verify
set lines 190
col name for a20
col guarantee_flashback_database for a10
col time for a60
select name, guarantee_flashback_database, time from v$restore_point;
39. Please be aware flashback log will be saved in FRA and make sure it has enough space.
# Check FRA free space
col name format a12
select name
,round(space_limit / 1024 / 1024) size_mb
,round(space_used / 1024 / 1024) used_mb
,decode(nvl(space_used,0),0,0,round((space_used/space_limit) * 100)) pct_used
from v$recovery_file_dest
order by name;
41. Ensure no files are in Back up mode before starting the upgrade.
SELECT * FROM V$BACKUP WHERE STATUS = 'ACTIVE';
Majid Shabani P a g e | 13
Upgrade Oracle GI & DB from 12.2 to 19c
# Invoke sqlplus
sqlplus / as sysdba
47. Check out the upgrade log file by running below command.
tailf ~/db_upgrade.log
Majid Shabani P a g e | 14
Upgrade Oracle GI & DB from 12.2 to 19c
@/home/oracle/upgrade_scripts/postupgrade_fixups.sql
# Verify
SELECT STATUS FROM V$BLOCK_CHANGE_TRACKING;
53. Upgrade the Time Zone File Version After Upgrading Oracle Database.
# Time zone upgrade check script (optional).
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/utltz_upg_check.sql
# Check timezone
select 'Timezone version is: '|| version from v$timezone_file;
select dbms_dst.get_latest_timezone_version from dual;
@ /tmp/dbupgdiag.sql
# Verify
ls -l $ORACLE_HOME/dbs/
Majid Shabani P a g e | 15
Upgrade Oracle GI & DB from 12.2 to 19c
58. Copy the tnsnames.ora file from the old Oracle home directory to the upgraded Oracle home
directory.
cp /u01/app/oracle/product/12.2.0/db_1/network/admin/*.ora $ORACLE_HOME/network/admin
# Verify
ls -l $ORACLE_HOME/network/admin
59. Run below command to upgrade the Oracle Clusterware keys for the database.
srvctl upgrade database -db db1 -o $ORACLE_HOME
60. Test connecting to database using the SQL*PLUS in the upgraded Oracle home.
sqlplus / as sysdba
# Verify
set lines 190
col name for a20
col guarantee_flashback_database for a10
col time for a60
select name, guarantee_flashback_database, time from v$restore_point;
# Shutdown database
shutdown immediate
# Start database
srvctl start database -d db1
63. Check out the /etc/oratab file and if needed modify the database related entry to point to the
new ORACLE_HOME location.
vi /etc/oratab
Majid Shabani P a g e | 16
Upgrade Oracle GI & DB from 12.2 to 19c
65. Now you can remove old Oracle database software to make free space (optional).
To do so you can use deinstall tool or OUI, in my opinion, there’s no difference between them,
they both are the same.
# Please set $ORACLE_HOME with the path of 12c DB home
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
# Removes GI software
$ORACLE_HOME/deinstall/deinstall
66. Switch to grid user and fix the ORACLE_HOME variable settings and copy the network configuration
files.
# Switch user
su – grid
# Verify
ls -l $ORACLE_HOME/network/admin
# Removes GI software
$ORACLE_HOME/deinstall/deinstall
Majid Shabani P a g e | 17
Upgrade Oracle GI & DB from 12.2 to 19c
As you know the non-CDB architecture is deprecated in 12cR1 and won’t have supported in new oracle
database releases.
In the next article, I will convert the upgraded non-CDB database to a CDB database. In other words, plug-
in it as a new PDB to a CDB database.
Stay tuned!
Thanks,
Majid Shabani
Majid Shabani P a g e | 18