Upgrading to Oracle Database 19c
Upgrading to Oracle Database 19c
This article provides an overview of upgrading an existing non-CDB database to Oracle 19c.
Upgrades can be very complicated, so you must always read the upgrade manual, and test
thoroughly before considering an upgrade of a production environment.
This article also includes the conversion of the upgraded database to a pluggable
database. You don't have to do this step if you want a non-CDB instance.
Remember, 19c is essentially 12.2.0.3, so the possible upgrade options will be similar to
those described in upgrading to Oracle Database 12c.
• Assumptions
• Prerequisites
• Run preupgrade.jar
• Final Steps
Related articles.
• Upgrade the Database Time Zone File Using the DBMS_DST Package
Assumptions
This article assumes your source database is of a version supported for direct upgrade to
19c.
In this example we are doing an upgrade from 11.2 to 19c. The process is very similar for all
supported versions, but the pre-upgrade and post-upgrade fixup actions may vary a little.
It's important to have backups of everything before you start! Some of these steps are
destructive, and if something goes wrong you have no alternative but to restore from
backups and start again.
Remember, this article is not a replacement for reading the upgrade documentation. Each
upgrade has the potential to be different, depending on what options are installed.
Prerequisites
Make sure you have all the OS prerequisites in place by running the 19c preinstall package.
On Oracle Linux you can do this by installing the preinstall package. It probably makes
sense to update the remaining packages also.
yum update -y
You can read about the installation process in more detail here, but for this example I'll
keep it brief. The following commands will perform a silent installation of the 19c software.
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export SOFTWARE_DIR=/u01/software
export ORA_INVENTORY=/u01/app/oraInventory
mkdir -p ${ORACLE_HOME}
cd $ORACLE_HOME
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=${ORA_INVENTORY} \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
1. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
At this point you should also patch the new Oracle home, but in this case we will forgo that
step to keep things simple.
Run preupgrade.jar
Download the latest "preupgrade.jar" file from MOS 884522.1. If you don't have MOS
access you can miss out the next step.
At the time of writing, the latest preupgrade.jar is the one shipped with 19c, so there is no
need to download a newer one. I's worth checking to see if this situation has changed when
you do your upgrade.
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
cd $ORACLE_HOME/rdbms/admin
unzip -o /u01/software/preupgrade_19_cbuild_??_lf.zip
Make sure you are using the original Oracle home and run the "preupgrade.jar".
export ORACLE_SID=db11g
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
$ORACLE_BASE/product/19.0.0/dbhome_1/jdk/bin/java -jar
$ORACLE_BASE/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar TERMINAL TEXT
$ $ORACLE_BASE/product/19.0.0/dbhome_1/jdk/bin/java -jar
$ORACLE_BASE/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar TERMINAL TEXT
=======================================
Version: 11.2.0.4.0
Compatible: 11.2.0.4.0
Blocksize: 8192
Timezone File: 14
Readonly: FALSE
Edition: EE
==============
BEFORE UPGRADE
==============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
This action may be done now or when starting the database in upgrade mode
to meet minimum values. The Oracle upgrade process itself has minimum
values which may be higher and are marked with an asterisk. After
upgrading, those asterisked parameter values may be reset if needed.
@emremove.sql
Without the set echo and serveroutput commands, you will not be able to
Starting with Oracle Database 12c, the local Enterprise Manager Database
Control does not exist anymore. The repository will be removed from your
database during the upgrade. This step can be manually performed before
the upgrade to reduce downtime.
$ORACLE_HOME/olap/admin/catnoamd.sql script.
Starting with Oracle Database 12c, the OLAP Catalog (OLAP AMD) is
(OLAP AMD) before database upgrade. This step can be manually performed
upgrade.
version 18.2.0.00.12.
execution plans and are essential for proper upgrade timing. Oracle
database upgrade.
owner of the trigger or drop and re-create the trigger with a user that
was granted directly with such. You can list those triggers using: SELECT
There is one or more database triggers whose owner does not have the
directly.
7. (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.
INFORMATION ONLY
================
upgrade process.
Min Size
TEMP 29 MB 150 MB
UNDOTBS1 70 MB 446 MB
Starting with Oracle Database release 12.1, the Expression Filter (EXF)
and Database Rules Manager (RUL) features are desupported, and are
removed during the upgrade process. This step can be manually performed
10. Check the Oracle Backup and Recovery User's Guide for information on how
If you are using a version of the recovery catalog schema that is older
than that required by the RMAN client version, then you must upgrade the
catalog schema.
It is good practice to have the catalog schema the same or higher version
=============================
=============
AFTER UPGRADE
=============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
11. Upgrade the database time zone file using the DBMS_DST package.
The database is using time zone file version 14 and the target 19 release
zone file. For more information, refer to "Upgrading the Time Zone File
12. To identify directory objects with symbolic links in the path name, run
Recreate any directory objects listed, using path names that contain no
symbolic links.
Some directory object path names may currently contain symbolic links.
object path names used with BFILE data types, the UTL_FILE package, or
external tables.
13. (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
command:
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
that have significantly changed during the upgrade or new tables that do
14. Gather statistics on fixed objects after the upgrade and when there is a
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
INFORMATION ONLY
================
15. Check the Oracle documentation for the identified components for their
The database upgrade script will not upgrade the following Oracle
The Oracle database upgrade script upgrades most, but not all Oracle
Database components that may be installed. Some components that are not
upgraded may have their own upgrade scripts, or they may be deprecated or
obsolete.
=============================
SQL>@/u01/app/oracle/cfgtoollogs/db11g/preupgrade/postupgrade_fixups.sql
==================
PREUPGRADE SUMMARY
==================
/u01/app/oracle/cfgtoollogs/db11g/preupgrade/preupgrade.log
/u01/app/oracle/cfgtoollogs/db11g/preupgrade/preupgrade_fixups.sql
/u01/app/oracle/cfgtoollogs/db11g/preupgrade/postupgrade_fixups.sql
Before upgrade:
@/u01/app/oracle/cfgtoollogs/db11g/preupgrade/preupgrade_fixups.sql
@/u01/app/oracle/cfgtoollogs/db11g/preupgrade/postupgrade_fixups.sql
$
Perform Pre-Upgrade Actions
shutdown immediate;
startup;
exit;
EOF
cp $ORACLE_BASE/product/19.0.0/dbhome_1/rdbms/admin/emremove.sql
$ORACLE_HOME/rdbms/admin/emremove.sql
@$ORACLE_HOME/rdbms/admin/emremove.sql
exit;
EOF
@$ORACLE_HOME/olap/admin/catnoamd.sql
exit;
EOF
# 4) Ignoring the APEX upgrade. This is a junk test instance. Normally APEX would be at
latest version.
# 5) Included in AUTOFIXUP.
# 7) Included in AUTOFIXUP.
@$ORACLE_HOME/rdbms/admin/utlrp.sql
EXECUTE DBMS_PREUP.INVALID_OBJECTS;
exit;
EOF
@/u01/app/oracle/cfgtoollogs/db11g/preupgrade/preupgrade_fixups.sql
exit;
EOF
With the pre-upgrade actions complete we can start the upgrade. Shutdown the source
database.
shutdown immediate;
exit;
EOF
Copy the config files from the old to the new Oracle home. You should check the contents
of the "listener.ora" file to see if there are any references to the Oracle home path. If there
are, amend them.
cp $ORACLE_HOME/network/admin/*.ora
$ORACLE_BASE/product/19.0.0/dbhome_1/network/admin
SQLNET.ALLOWED_LOGON_VERSION_SERVER=11
EOF
cp $ORACLE_HOME/dbs/orapwdb11g $ORACLE_BASE/product/19.0.0/dbhome_1/dbs/
cp $ORACLE_HOME/dbs/spfiledb11g.ora $ORACLE_BASE/product/19.0.0/dbhome_1/dbs/
lsnrctl stop
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export PATH=${ORACLE_HOME}/bin:$PATH
lsnrctl start
Start the database using the 19c Oracle home, ready for the upgrade.
startup upgrade;
exit;
EOF
You can run the upgrade using either of the following commands. The second is actually
just a shorthand for the former.
cd $ORACLE_HOME/rdbms/admin
# Shorthand command.
$ORACLE_HOME/bin/dbupgrade
$ $ORACLE_HOME/bin/dbupgrade
Run in c=0
Simulate E=0
Log Id i=0
Script s=0
STATUS: [Production]
BUILD: [RDBMS_19.2.0.0.0_LINUX.X64_190204]
/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/orahome =
[/u01/app/oracle/product/19.0.0/dbhome_1]
/u01/app/oracle/product/19.0.0/dbhome_1/bin/orabasehome =
[/u01/app/oracle/product/19.0.0/dbhome_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/dbhome_1]
Number of Cpus =2
Components in [db11g]
Installed [APEX APS CATALOG CATJAVA CATPROC CONTEXT JAVAVM ORDIM OWM SDO
XDB XML XOQ]
------------------------------------------------------
------------------------------------------------------
------------------------------------------------------
------------------------------------------------------
LOG FILES:
(/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/db11g/upgrade20190227131213/c
atupgrd*.log)
The database is shutdown at the end of the upgrade process, so you need to start it before
moving on to the post-upgrade actions.
startup
exit;
EOF
SHUTDOWN IMMEDIATE;
STARTUP UPGRADE;
SET SERVEROUTPUT ON
DECLARE
l_tz_version PLS_INTEGER;
BEGIN
l_tz_version := DBMS_DST.get_latest_timezone_version;
DBMS_OUTPUT.put_line('l_tz_version=' || l_tz_version);
DBMS_DST.begin_upgrade(l_tz_version);
END;
SHUTDOWN IMMEDIATE;
STARTUP;
-- Do the upgrade.
SET SERVEROUTPUT ON
DECLARE
l_failures PLS_INTEGER;
BEGIN
DBMS_DST.upgrade_database(l_failures);
DBMS_DST.end_upgrade(l_failures);
END;
FROM database_properties
ORDER BY property_name;
exit;
EOF
# 12) Ignored
# 13) AUTOFIXUP
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
exit;
EOF
# AUTOFIXUP
@/u01/app/oracle/cfgtoollogs/db11g/preupgrade/postupgrade_fixups.sql
exit;
EOF
Assuming you didn't hit any problems along the way, your database is upgraded and ready
to go now. The following steps are only necessary if you want to convert the non-CDB
instance to a pluggable database (PDB).
There are a number of considerations when creating a container database, but for this
example we will keep it simple. The command below creates a new container database
(CDB) with no user-defined pluggable databases (PDBs).
export SYS_PASSWORD=SysPassword1
export ORACLE_SID=cdb1
-templateName General_Purpose.dbc \
-characterSet AL32UTF8 \
-sysPassword ${SYS_PASSWORD} \
-systemPassword ${SYS_PASSWORD} \
-createAsContainerDatabase true \
-numberOfPDBs 0 \
-databaseType MULTIPURPOSE \
-memoryMgmtType auto_sga \
-totalMemory 2000 \
-storageType FS \
-datafileDestination "/u02/oradata/" \
-redoLogFileSize 500 \
-emConfiguration NONE \
-ignorePreReqs
For a proper conversion we would have to make sure the CDB had all necessary
configuration in place, including options and initialisation parameters. We will ignore the
rest of the instance setup to keep it simple