3 Using AutoUpgrade to Upgrade and convert Non-CDBs to PDBs

The AutoUpgrade Utility simplifies the task of upgrading and converting your earlier release Oracle Database to a later Oracle Database release using the multitenant architecture.

Non-CDB to PDB Upgrade Guidelines and Examples

Before conversion, back up your datafiles and database, and follow the guidelines for your source Oracle Database release.

To ensure that no data is lost during the conversion, Oracle strongly recommends that allow time in your upgrade plan to implement your backup strategy before you use AutoUpgrade to perform a non-CDB upgrade and conversion.

Guidelines for Upgrade Planning

The non-CDB-to-PDB conversion and upgrade process is not recoverable. To ensure a proper upgrade and conversion, and to reduce unexpected downtime, Oracle strongly recommends that you address any error conditions found during the analyze phase.

If you use the target_pdb_copy_option in your configuration file to create copies of your data files, then your existing database is available as a backup. This is a safe option, but will require additional time and disk space. If you do not set the target_pdb_copy_option in your AutoUpgrade configuration file, then the database conversion uses the same file location and file names that are used with existing database files. To prevent potential data loss, ensure that your data is backed up, and consider your file placement plans before starting AutoUpgrade.

GRP and Upgrades from Non-CDB to Multitenant Architecture

  • During the upgrade, AutoUpgrade creates a guaranteed restore point (GRP) that is available only in the context of the upgrade stage of the AutoUpgrade Deploy workflow. To ensure against any potential data loss, you must implement your backup strategy before starting AutoUpgrade.
  • Database conversion from non-CDB to the multitenant architecture is performed during the AutoUpgrade Drain stage. After this stage is complete, the GRP that AutoUpgrade creates is removed, and it is not possible to use the AutoUpgrade restore command to restore the database. In the event that you require a recovery to the earlier non-CDB Oracle Database release, you must be prepared to recover the database manually.

Example 3-1 Upgrading and Converting a Non-CDB to Oracle Database 19c Using Multitenant Architecture

During the Deploy conversion and upgrade workflow, AutoUpgrade creates a GRP, and runs the Prefixup stage. If any part of the Deploy workflow up to the Prefixup stage completion fails, then AutoUpgrade can restore the database back to the GRP created at the start of the deployment,

However, after the Prefixup stage is complete, the upgraded database is plugged in to the target release Oracle Database container database (CDB) to complete conversion. As soon as the non-CDB is plugged into the CDB, the GRP is no longer valid, and is dropped.

If anything goes wrong during the plug-in, and you did not choose to use the target_pdb_copy_option in your configuration file to create copies of your data files, then be aware that AutoUpgrade cannot recover and restore the database. In that event, you must restore the database manually.

AutoUpgrade Configuration File for Non-CDB Upgrades on the Same System

Use this example to see how you can upgrade your non-CDB Oracle Database

In this scenario, you upgrade two specific PDBs, without upgrading the other PDBs in the source CDB, To perform the incremental upgrade, you direct AutoUpgrade in the configuration file to unplug the PDBs you specify from an earlier release CDB, plug them into a target release CDB, and then upgrade the earlier release PDBs on the target CDB. This selection of PDBs to unplug, plug in, and upgrade, enables you to perform an incremental upgrade of PDBs on the earlier release CDB to reduce downtime.

The following configuration file identifies the non-CDB database emp as the source database. The source database is upgraded, and the upgraded Oracle Database is placed in the new Oracle home /u01/app/oracle/product/21.1.0/dbhome_1:

global.autoupg_log_dir=/u01/app/oracle/cfgtoollogs/autoupgrade
upg1.log_dir=/u01/app/oracle/cfgtoollogs/autoupgrade/employee
upg1.sid=emp
upg1.source_home=/u01/app/oracle/product/12.2.0/dbhome_1
upg1.target_home=/u01/app/oracle/product/21.1.0/dbhome_1

In this example, the following local parameters are specified:

  • upg1.log_dir (optional) specifies that the upgrade directory for this database is placed in the folder employee, under the global AutoUpgrade log directory path.
  • upg1.sid (required) identifies the Oracle system identifier (SID) of the database that you want to upgrade is emp.
  • upg1.source_home (required) specifies the source Oracle home path.
  • upg1.target_home (required) specifies the target Oracle home path.

The upgrade job starts immediately when you run AutoUpgrade using this configuration file. By default, a guaranteed restore point is automatically created. This feature protects the upgrade, and enables you to fall back to the earlier release in case of errors.

This configuration file provides you with a minimal use case example. You can choose to add additional parameters to modify the upgrade for your needs. For example, if you want to specify a future start time to run the upgrade, then you can use the local parameter start_time. In addition, you can modify default behavior. For example, by default, time zone settings are upgraded as part of the database upgrade. Oracle recommends that you upgrade time zone files as part of the upgrade. However, if you want to defer this upgrade to a later maintenance window, then you can add the local parameter timezone_upg.

AutoUpgrade with Source and Target Database Homes on Same Server (Typical)

When your Oracle Database Source and Target Oracle homes are installed on the same physical server, use this example.

Context: Source and Target homes are on the same server.

To start the analysis, enter the following command.

java -jar autoupgrade.jar -config config.txt -mode analyze

The command produces a report that indicates any error conditions that the command finds. Review the error conditions.

To start the deployment of the upgrade, enter the following command:

java -jar autoupgrade.jar -config config.txt -mode deploy