0% found this document useful (0 votes)
335 views19 pages

Upgrade Oracle GI DB From 12 2 To 19c 1644774477

The document outlines the steps to upgrade Oracle Grid Infrastructure (GI) and Database (DB) from release 12.2.0.1 to 19c. It involves downloading required software, applying patches to the 12.2 source homes, upgrading GI, installing the 19c software, performing pre-upgrade actions, upgrading the database, and post-upgrade actions. Key steps include taking backups, applying patches 33559966 and 33567274 to source homes, upgrading OPatch, and following Oracle's upgrade guides and documentation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
335 views19 pages

Upgrade Oracle GI DB From 12 2 To 19c 1644774477

The document outlines the steps to upgrade Oracle Grid Infrastructure (GI) and Database (DB) from release 12.2.0.1 to 19c. It involves downloading required software, applying patches to the 12.2 source homes, upgrading GI, installing the 19c software, performing pre-upgrade actions, upgrading the database, and post-upgrade actions. Key steps include taking backups, applying patches 33559966 and 33567274 to source homes, upgrading OPatch, and following Oracle's upgrade guides and documentation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Upgrade Oracle GI & DB from 12.

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.

The following should be your references:


• Oracle Grid Infrastructure Installation and Upgrade Guide 19c for Linux
• Oracle Database Upgrade Guide 19c
• Doc ID 2539778.1: Complete Checklist for Manual Upgrades to Non-CDB Oracle Database 19c
• Doc ID 2551169.1: Requirements for Installing Oracle Database 19c on OL7 or RHEL7 64-bit (x86-64)
• Doc ID 2539751.1: Required Patches to apply before upgrading Oracle GI and DB to 19c.
• Doc ID 2525596.1: Required Patches to apply target ORACLE_HOME 19c
• Doc ID 1410202.1: How to Apply a Grid Infrastructure Patch Before Grid Infrastructure Configuration
• Doc ID 2550798.1: Autonomous Health Framework (AHF)

Specification of oracle software products


Oracle Grid Home /u01/app/12.2.0/grid
Source Oracle Home
Oracle Database Home /u01/app/oracle/product/12.2.0/db_1
Oracle Grid Home /u01/app/19.0.0/grid
Target Oracle Home
Oracle Database Home /u01/app/oracle/product/19.0.0/db_1
OS Oracle Linux 7.4

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.

Majid Shabani Page |2


Upgrade Oracle GI & DB from 12.2 to 19c

Download Required Software


• You should download the following Oracle software products. At the time of this writing, they can be
downloaded from this link.
- Oracle Database 19c
- Oracle Grid Infrastructure 19c
• OPatch Utility
- You must use the latest OPatch utility. Download link.
• Patch 33559966
- COMBO OF OJVM RU 12.2.0.1.220118 + GI RU 12.2.0.1.220118
• Patch 33567274
- COMBO OF OJVM RU 19.14.0.0.220118 + GI RU 19.14.0.0.220118

Note: The GI Release Update includes updates for both the Oracle Grid Infrastructure home and Oracle
Database home

Majid Shabani Page |3


Upgrade Oracle GI & DB from 12.2 to 19c

Apply patch on source oracle home 12.2:


To be able to apply patch on source oracle home you must download latest Opatch utility and upgrade
the OPatch utility that exists in the source GI & DB home. To accomplish this task, do the following:

1. Perform the following steps to upgrade the OPatch utility.

# Login as root user


su

# Check the release of OPatch in GI & DB home


/u01/app/12.2.0/grid/OPatch/opatch version
/u01/app/oracle/product/12.2.0/db_1/OPatch/opatch version

# Take backup of current Opatch directory by renaming it.


cd /u01/app/12.2.0/grid/
mv OPatch/ OPatch_BKP
cd /u01/app/oracle/product/12.2.0/db_1/
mv OPatch/ OPatch_BKP

# 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/

# Change the ownership of the Opatch directory files


chown -R grid:oinstall /u01/app/12.2.0/grid/OPatch
chown -R oracle:oinstall /u01/app/oracle/product/12.2.0/db_1/OPatch

# Verify the OPatch has been upgraded


/u01/app/12.2.0/grid/OPatch/opatch version
/u01/app/oracle/product/12.2.0/db_1/OPatch/opatch version

2. Take backup of Oracle and Grid home.


# As oracle user
srvctl stop home -oraclehome $ORACLE_HOME -statefile ~/srv1_dbstate1.dmp
tar cpPf - $ORACLE_HOME | xz -v -c -T 4 -1 > /u01/oracle_home_bkp.tar

# As grid user
crsctl stop has
tar cpPf - $ORACLE_HOME | xz -v -c -T 4 -1 > /u01/grid_home_bkp.tar

# Start has service as grid user


crsctl start has

# Start database as oracle user


srvctl start home -oraclehome $ORACLE_HOME -statefile ~/srv1_dbstate1.dmp

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/

# Take full whole database backup


backup
database filesperset 8 tag 'db_before_upgrade'
current controlfile tag 'ctl_before_upgrade'
spfile tag 'spfile_before_upgrade'
plus archivelog tag 'arch_before_upgrade' delete input;

Majid Shabani Page |4


Upgrade Oracle GI & DB from 12.2 to 19c

4. Apply patch on the source oracle home. Login as grid and perform the following task.

# Unzip the COMBO OF OJVM RU 12.2.0.1.220118 + GI RU 12.2.0.1.220118 patch


unzip -q /tmp/p33559966_122010_Linux-x86-64.zip -d /tmp/12c

# login as root user and change current directory to the unzipped directory.
su -
cd /tmp/12c/33559966/33583921

# Set the PATH variable:


export PATH=$PATH:/u01/app/12.2.0/grid/OPatch/

# Check for any patch conflicts(optional). The result should be SUCCESSFULLY.


opatchauto apply -analyze

# Apply the patch using the opatchauto command.


opatchauto apply

5. Apply OJVM patch manually on Oracle DB home.


# Apply the OJVM patch manually using Opatch utility on Oracle DB Home only.
# To obtain more detail please refer to Doc ID 1929745.1
# To do so, stop database as oracle user.
su – oracle
srvctl stop home -oraclehome $ORACLE_HOME -statefile ~/srv1_dbstate2.dmp

# Check for any patch conflicts(optional). The result should be succeeded.


cd /u01/app/oracle/product/12.2.0/db_1/OPatch/
opatch prereq CheckConflictAgainstOHWithDetail -ph /tmp/12c/33559966/33561275

# Apply the patch


/u01/app/oracle/product/12.2.0/db_1/OPatch/opatch apply /tmp/12c/33559966/33561275

# Respond to installer as follow:


Do you want to proceed? [y|n]
y

Is the local system ready for patching? [y|n]


Y

# Post-installation
# Invoke SQL*PLUS and then startup DB in upgrade mode

sqlplus / as sysdba
startup upgrade
exit

# Run datapatch to Load Modified SQL Files


cd $ORACLE_HOME/OPatch
./datapatch -verbose

# Start oracle database as oracle user


srvctl start home -oraclehome $ORACLE_HOME -statefile ~/srv1_dbstate2.dmp

# Remove the patch directory as root user


rm -fr /tmp/12c

Majid Shabani Page |5


Upgrade Oracle GI & DB from 12.2 to 19c

6. After applying patch, Check the DBA_REGISTRY_SQLPATCH.


# Invoke SQL*PLUS and then run following command
sqlplus / as sysdba

SET LINES 200


COL ACTION_TIME FOR A30
COL ACTION FOR A10
COL DESCRIPTION FOR A52

SELECT ACTION_TIME, PATCH_ID, ACTION, DESCRIPTION


FROM DBA_REGISTRY_SQLPATCH
ORDER BY ACTION_TIME, PATCH_ID;

7. Verify that the patches have been applied.


su - grid
$ORACLE_HOME/OPatch/opatch lspatches

su - oracle
$ORACLE_HOME/OPatch/opatch lspatches

Majid Shabani Page |6


Upgrade Oracle GI & DB from 12.2 to 19c

Upgrade Oracle Grid Infrastructure:


8. Login as grid user.
9. Create the directory of the new Oracle Grid home.
mkdir -p /u01/app/19.0.0/grid

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

unzip -q /tmp/LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME

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

# Remove the existing OPatch folder


rm -fr /u01/app/19.0.0/grid/OPatch

# Copy the OPatch directory to the GI home directory


unzip -q /tmp/p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME

# Verify the OPatch has been upgraded.


/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"

# Install them if needed.


yum -y install kmod kmod-libs policycoreutils-python

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/

Majid Shabani Page |7


Upgrade Oracle GI & DB from 12.2 to 19c

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.

15. Respond to the Installer windows as follows:

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.

16. Verify the upgrade has been successfully.


# Verify software release
/u01/app/19.0.0/grid/bin/crsctl query has softwareversion

# Verify patches
/u01/app/19.0.0/grid/bin/crsctl query has releasepatch

17. Startup database.


srvctl start database -d db1

Majid Shabani Page |8


Upgrade Oracle GI & DB from 12.2 to 19c

Installing Oracle Database 19 Software


In this section, I will install Oracle database software and apply 19.14.0 RU, OJVM RU patches during
database software installation. Although you can apply both patches with singe simple command but in
my testing case installation with “-applyRU -applyOneOffs” fails when ojvm 19.14.0 included.

19. Login as oracle user.


20. Create the directory of the new Oracle Database home.
mkdir -p /u01/app/oracle/product/19.0.0/db_1

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

22. Perform the following steps to upgrade the OPatch utility.


To be able to apply 19.14 RU patch, the OPatch utility must be updated to version 12.2.0.1.28 or
later.
# Check the release of OPatch. It should be 12.2.0.1.28 or later.
/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch version

# Remove the existing OPatch folder


rm -fr /u01/app/oracle/product/19.0.0/db_1/OPatch

# Copy the OPatch directory to the database home 19c directory


unzip -q /tmp/p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME

# Verify the OPatch has been upgraded


/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch version

23. The patch file unzipped in step 13 in /tmp/19c directory.

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/

25. Respond to the Installer windows as follows:

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 Page |9


Upgrade Oracle GI & DB from 12.2 to 19c

Select the option Automatically run configuration scripts.


Root Script Execution
Enter the credentials for the root user or a sudo account.
The Summary window appears.
Summary Review the contents of the Summary window and then click
Install button.
When the installation displays a confirmation message. Click on
Install Product
Yes button. it wants to run certain scripts.
Now Oracle Software installation is completed. Click on Close
Finish
button.

26. Apply the OJVM patch manually using Opatch utility.


/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch apply /tmp/19c/33567274/33561310/

# Respond to installer as follow:


Do you want to proceed? [y|n]
y

Is the local system ready for patching? [y|n]


y

# After Applying patch remove the patch directory as root user.


rm -fr /tmp/19c

Majid Shabani P a g e | 10
Upgrade Oracle GI & DB from 12.2 to 19c

Upgrade Oracle Database Manually from 12.2.0.1 to 19c


In this section, it is ready to upgrade oracle database. To do so, I will perform the following steps:
• Perform Pre-Upgrade Actions
• Upgrade the Database
• Perform Post-Upgrade Actions

Perform Pre-Upgrade Actions


27. Run the Pre-Upgrade Information Tool (preupgrade.jar) by issuing the following command.
# As oracle user create a directory to save preupgrade log file and scripts
mkdir /home/oracle/upgrade_scripts

# 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

28. Examine the contents of the preupgrade log file.

29. Disable Block Change Tracking.


# Invoke SQL*PLUS
sqlplus / as sysdba

ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

# 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

31. Check dictionary and fixed objects statistics (optional).


# Check last statistics gathering job.
col "Stats Operations" for a80
SELECT 'ID: '|| ID ||chr(10)||
'Operation: ' || OPERATION ||chr(10)||
'Target: ' || TARGET ||chr(10)||
'Start Time: ' || START_TIME ||chr(10)||
'End Time: ' || END_TIME ||chr(10)||
'Status: ' || STATUS ||chr(10)||
'Job Name: ' || JOB_NAME ||chr(10)||
'Notes: ' || NOTES "Stats Operations"
FROM DBA_OPTSTAT_OPERATIONS
ORDER BY ID DESC FETCH FIRST 2 ROWS ONLY;

Majid Shabani P a g e | 11
Upgrade Oracle GI & DB from 12.2 to 19c

# Check dictionary tables analyze date.


prompt 'Statistics for SYS tables'
SELECT NVL(TO_CHAR(last_analyzed, 'YYYY-Mon-DD'), 'NO STATS') last_analyzed, COUNT(*)
dictionary_tables
FROM dba_tables
WHERE owner = 'SYS'
GROUP BY TO_CHAR(last_analyzed, 'YYYY-Mon-DD')
ORDER BY 1 DESC;

# Check Fixed Objects analyze date.


prompt 'Statistics for Fixed Objects'
select NVL(TO_CHAR(last_analyzed, 'YYYY-Mon-DD'), 'NO STATS') last_analyzed, COUNT(*)
fixed_objects
FROM dba_tab_statistics
WHERE object_type = 'FIXED TABLE'
GROUP BY TO_CHAR(last_analyzed, 'YYYY-Mon-DD')
ORDER BY 1 DESC;

32. Purge the Recycle Bin.


PURGE DBA_RECYCLEBIN;

Note: you can purge RECYCLEBIN in parallel. please refer to this link. Thanks to Connor McDonald
for that post.

33. Refresh metalized views.


# To obtain list of the materialized views:
SELECT OWNER, OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_TYPE LIKE '%MATERIA%';

# Refresh all materialized views


DECLARE
v_number_of_failures NUMBER (4):= 0;
BEGIN
DBMS_MVIEW.REFRESH_ALL_MVIEWS (v_number_of_failures,'C','', TRUE, FALSE);
END;
/

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;

35. Obtain list of invalid objects. If any exists, recompile them.


SELECT OWNER, OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS='INVALID';

36. Recompile invalid objects in parallel. (If needed)


@ ?/rdbms/admin/utlprp.sql

37. Make sure that the parameter SEC_CASE_SENSITIVE_LOGON is set to TRUE.


SHOW PARAMETER SEC_CASE_SENSITIVE_LOGON

Majid Shabani P a g e | 12
Upgrade Oracle GI & DB from 12.2 to 19c

38. Create Flashback Guaranteed Restore Point.


Although the backup of database was taken in step 4, you can optionally create a restore point.
# Invoke SQL*PLUS
sqlplus / as sysdba

# Create restore point


create restore point pre_upgrade guarantee flashback database;

# 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;

# Check File size in FRA


select file_type, percent_space_used,
percent_space_reclaimable, number_of_files
from v$recovery_area_usage
order by 1;

40. Copying Transparent Encryption Oracle Wallets.


If Oracle wallet used with Transparent Data Encryption (TDE), then copy the sqlnet.ora
and wallet file to the new Oracle home manually before starting the upgrade.

41. Ensure no files are in Back up mode before starting the upgrade.
SELECT * FROM V$BACKUP WHERE STATUS = 'ACTIVE';

42. Ensure that no files require media recovery:


SELECT FILE#, ERROR FROM V$RECOVER_FILE;

43. Copy spfile from asm disk to file system.


# Invoke sqlplus
sqlplus / as sysdba

# Create pfile from spfile


create pfile from spfile;

# Create spfile from pfile in the new oracle home.


create spfile='/u01/app/oracle/product/19.0.0/db_1/dbs/spfile.ora' from pfile;

Majid Shabani P a g e | 13
Upgrade Oracle GI & DB from 12.2 to 19c

Upgrading Oracle Database


44. As Oracle user, Shutdown database before upgrading it.
shutdown immediate

45. Startup database in Upgrade mode from oracle 19c home.


# Set PATH variable
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/db_1
export PATH=/u01/app/oracle/product/19.0.0/db_1/bin:$PATH

# Invoke sqlplus
sqlplus / as sysdba

# Startup database in upgrade mode


startup upgrade;

46. As oracle user run dbupgrade.


nohup $ORACLE_HOME/bin/dbupgrade > ~/db_upgrade.log 2>&1 &

47. Check out the upgrade log file by running below command.
tailf ~/db_upgrade.log

48. Recompile INVALID Objects.


# Invoke sql*plus
sqlplus / as sysdba

# Start up the database


startup

# Obtain list of invalid objects. If any exists, recompile them.


col owner for a30
SELECT OWNER,count(*) FROM DBA_OBJECTS WHERE STATUS='INVALID' group by OWNER order by 2;

# Recompile invalid objects


@ $ORACLE_HOME/rdbms/admin/utlrp.sql

49. Check database components.


# They all must have VALID status.
col version for a11
col status for a10
col comp_name for a37
SELECT SUBSTR(comp_name, 1, 30) comp_name, SUBSTR(version, 1, 20) version, status
FROM dba_registry
ORDER BY comp_name;

Majid Shabani P a g e | 14
Upgrade Oracle GI & DB from 12.2 to 19c

Perform Post-Upgrade Actions


In this section of the document, you will perform tasks that should be performed after the upgrade is
finished.

50. Execute post-upgrade fixup scripts generated by the pre-upgrade script.


# Invoke sql*plus
sqlplus / as sysdba

@/home/oracle/upgrade_scripts/postupgrade_fixups.sql

51. Gather fixed object statistics.


EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

52. Enable block change tracking.


ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;

# 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

# Time zone apply script.


# Warning: This script will restart the database and adjust time zone data.
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/utltz_upg_apply.sql

# Check timezone
select 'Timezone version is: '|| version from v$timezone_file;
select dbms_dst.get_latest_timezone_version from dual;

54. Check upgrade status (optional).


Execute dbupgdiag.sql and review the logs. To download this script, refer to Note 556610.1.
# Invoke sql*plus
sqlplus / as sysdba

@ /tmp/dbupgdiag.sql

# enter /tmp as directory value.

55. Fix the ORACLE_HOME variable setting in .bash_profile.


56. Source the bash_profile file.
source executes the content of the file passed as argument, in the current shell.
source .bash_profile

57. Create or Migrate Your Password File with ORAPWD.


cp /u01/app/oracle/product/12.2.0/db_1/dbs/orapw* $ORACLE_HOME/dbs/

# 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

61. Drop Flashback Guaranteed Restore Point created before upgrade.


Drop restore point pre_upgrade;

# 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;

62. Migrate Oracle database spfile to ASM.


# In SQL*PLUS session
Create pfile from spfile;
create spfile='+OCRDATA1/DB1/PARAMETERFILE/spfile.ora' from pfile;

# Shutdown database
shutdown immediate

# Update spfile in has using srvctl tool


srvctl modify database -d db1 -spfile '+OCRDATA1/DB1/PARAMETERFILE/spfile.ora'

# Start database
srvctl start database -d db1

# Check database status


srvctl status database -d db1

# Displays the configuration for the database.


srvctl config database -d db1

# Invoke SQL*PLUS and check spfile parameter value


sqlplus / as sysdba
show parameter spfile

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

64. Take a new database backup.


# Invoke RMAN
rman target/

# Take full backup of whole database.


backup force
database filesperset 8 tag 'db_after_upgrade'
current controlfile tag 'ctl_after_upgrade'
spfile tag 'spfile_after_upgrade'
plus archivelog tag 'arch_after_upgrade' delete input;

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

# Detach OLD_HOME using deinstall tool – first check


$ORACLE_HOME/deinstall/deinstall -checkonly

# 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

# Fix the ORACLE_HOME value to point to new ORACLE_HOME


vi .bash_profile

# Source the bash profile file


source .bash_profile

# Copy the network files:


cp /u01/app/12.2.0/grid/network/admin/*.ora $ORACLE_HOME/network/admin

# Verify
ls -l $ORACLE_HOME/network/admin

67. Remove the old GI home using deinstall tool (optional).


# Please replace $ORACLE_HOME with the path of 12c GI home
export ORACLE_HOME=/u01/app/12.2.0/grid

# Detach OLD_HOME using deinstall tool – first check


$ORACLE_HOME/deinstall/deinstall -checkonly

# Removes GI software
$ORACLE_HOME/deinstall/deinstall

68. Delete backup of DB & GI home.


rm -fr /u01/oracle_home_bkp.tar /u01/grid_home_bkp.tar

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

You might also like