Upgrading a non-CDB to Oracle Database 21c with AutoUpgrade

Yesterday I wrote about the installation of Oracle Database 21c on Linux. But today it is time for Upgrading to Oracle Database 21c with AutoUpgrade.

Upgrading a non-CDB to Oracle Database 21c with AutoUpgrade

Photo by Arjun MJ on Unsplash

AutoUpgrade

You may have heard it already from us and other colleagues, but we can’t repeat it often enough: There is only one recommended tool to upgrade your databases – and this is AutoUpgrade.

In my 21c home, I’m checking the deployed version of AutoUpgrade at first:

[CDB3] oracle@hol:/u01/app/oracle/product/21/rdbms/admin
$ java -jar autoupgrade.jar -version
build.hash 57ab246
build.version 21.1.3
build.date 2021/04/21 13:32:13
build.max_target_version 21
build.supported_target_versions 12.2,18,19,21
build.type production

Now please compare with the newest version available on MOS Note: 2485457.1  – AutoUpgrade Tool.

The most recent version while I write this blog post is from July 21, 2021 – which is newer than the above version from April 21, 2021. Hence, I will exchange it. Luckily that is super simple: Download it and overwrite the existing version in the 21c Oracle Home:

$ cp /media/sf_TEMP/autoupgradeJUL21.jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar

[CDB3] oracle@hol:/u01/app/oracle/product/21/rdbms/admin
$ java -jar autoupgrade.jar -version
build.hash 680914c
build.version 21.2.210721
build.date 2021/07/21 11:14:54
build.max_target_version 21
build.supported_target_versions 12.2,18,19,21
build.type production

This looks good.

Big Change – you need a CDB

In the past, you simply upgraded a database from one release to another. But now things change. With the CDB-only architecture, you can’t upgrade anymore at first. We always recommended the following approach until Oracle 19c:

  • Upgrade and migration of a non-CDB to Multitenant until Oracle 19c
    • Upgrade non-CDB to Oracle 19c with AutoUpgrade
    • Plugin and convert upgraded non-CDB to precreated CDB with AutoUpgrade

This is the safer way since there are proven fallback options for the first step, the upgrade: Guaranteed Restore Points (the standard in AutoUpgrade) and Downgrade with the downgrade scripts.

But this approach does not work anymore when you move to Oracle 21c since you can’t have a non-CDB anymore in 21c. Now this is the way since Oracle 21c for non-CDBs:

  • Upgrade and migration of a non-CDB to Multitenant since Oracle 21c
    • Plugin the non-CDB into a precreated CDB with AutoUpgrade
    • Upgrade and convert the plugged in non-CDB with AutoUpgrade

Of course, it is obvious that you need a proper fallback. But I will get back to this later in another blog post.

So at first, we need a CDB.

Yes, let me repeat this. You need to create a CDB at first.

And please don’t use a seed database – use a template and create the CDB which fits your needs. Check DBA_REGISTRY in your non-CDBs beforehand and create the CDB with the components you really need.

This is the path to enter the “Options” choice in DBCA:

The select “Advanced Configuration”:

And then – and this is very important – select “Custom Database”:

Otherwise you won’t see this screen:

I create my CDB as CDB3 this way:

Again, I think it is important to state that AutoUpgrade does not create this CDB. You need to create it. And once the CDB is up and running, I can kick off my upgrade to Oracle 21c.

Let’s upgrade – analyze is always first!

As in this case I won’t be able to revert to a GRP in case of failure, I’d rather create a copy of my non-CDB instead of lifting it directly into CDB3.

This is the config file I’m using for AutoUpgrade:

global.autoupg_log_dir=/home/oracle/logs
upg1.source_home=/u01/app/oracle/product/12.2.0.1
upg1.target_home=/u01/app/oracle/product/21
upg1.sid=DB12
upg1.target_cdb=CDB3
upg1.target_pdb_copy_option=file_name_convert=('/u02/oradata/DB12', '/u02/oradata/CDB3/db12')
upg1.log_dir=/home/oracle/logs
upg1.restoration=no
upg1.catctl_options=-t

At first I’m kicking off an analyze run.

$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config DB12.cfg -mode analyze
AutoUpgrade 21.2.210721 launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be analyzed
Type 'help' to list console commands
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be analyzed
Type 'help' to list console commands
upg> Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished                  [1]
Jobs failed                    [0]
Jobs pending                   [0]

Please check the summary report at: 
/home/oracle/logs/cfgtoollogs/upgrade/auto/status/status.html
/home/oracle/logs/cfgtoollogs/upgrade/auto/status/status.log 

And this looks good.

Let me check the status.html report.

No ERRORs, no precheck WARNINGs – this looks good.

Let’s upgrade with -mode deploy

Since the analyze run went smoothly, the deploy shouldn’t cause trouble.

But in fact it did.

In case your database has ORDIM (Oracle Multimedia) but no SDO (Spatial Data Option), the upgrade will fail because of the LCTR (Locator), which isn’t an independent component until Oracle 19c. Please read more including the workaround in my next blog post:

I will now use the workaround and progress from there.

$ java -jar /u01/app/oracle/product/21/rdbms/admin/autoupgrade.jar -config DB12.cfg -mode deploy
AutoUpgrade 21.2.210721 launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be processed
Type 'help' to list console commands
upg> lsj
+----+-------+---------+---------+-------+--------------+--------+----------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|         MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+----------------+
| 100|   DB12|DBUPGRADE|EXECUTING|RUNNING|21/08/24 17:47|17:54:43|10%Upgraded DB12|
+----+-------+---------+---------+-------+--------------+--------+----------------+
Total jobs 1

upg> lsj
+----+-------+-------------+---------+-------+--------------+--------+------------------+
|Job#|DB_NAME|        STAGE|OPERATION| STATUS|    START_TIME| UPDATED|           MESSAGE|
+----+-------+-------------+---------+-------+--------------+--------+------------------+
| 100|   DB12|NONCDBTOPDBXY|EXECUTING|RUNNING|21/08/24 17:47|18:06:55|noncdb_to_pdb - 0%|
+----+-------+-------------+---------+-------+--------------+--------+------------------+
Total jobs 1

upg> lsj
+----+-------+-------------+---------+-------+--------------+--------+-------------------+
|Job#|DB_NAME|        STAGE|OPERATION| STATUS|    START_TIME| UPDATED|            MESSAGE|
+----+-------+-------------+---------+-------+--------------+--------+-------------------+
| 100|   DB12|NONCDBTOPDBXY|EXECUTING|RUNNING|21/08/24 17:47|18:08:25|noncdb_to_pdb - 64%|
+----+-------+-------------+---------+-------+--------------+--------+-------------------+
Total jobs 1

upg> Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished                  [1]
Jobs failed                    [0]
Jobs pending                   [0]



Please check the summary report at: 
/home/oracle/logs/cfgtoollogs/upgrade/auto/status/status.html
/home/oracle/logs/cfgtoollogs/upgrade/auto/status/status.log
[CDB3] oracle@hol:~/scripts

And finally, here we go.

$ s

SQL*Plus: Release 21.0.0.0.0 - Production on Tue Aug 24 18:15:57 2021
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle.  All rights reserved.


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 DB12 			  READ WRITE NO

Summary

Let me get you a quick summary with the most important topics.

  1. The preferred release you upgrade to is still Oracle Database 19c
  2. Oracle Database 21c is an innovation release with some nice features but also a short support time lifetime
  3. Oracle 21c is CDB-only. If you plan to move to Oracle 21c and your database is a non-CDB, you need to create a CDB now in 21c at first
  4. The ONLY RECOMMENDED way to upgrade to 21c is AutoUpgradeeven Tim Hall agrees
  5. If you have ORDIM and no SDO in your source database, then you MUST follow this blog post to avoid a terrible pitfall

So please see this blog post as a nice exercise and step-by-step instruction. But the release you will upgrade to is most likely Oracle Database 19c as this is the Long Term Support release.

Further Links and Information

–Mike

Share this: