Here’s a cool way of upgrading your database in OCI to Oracle Database 23c. I will move my PDB to a new Base Database System using refreshable clone PDBs and AutoUpgrade.
The benefit of using this approach is:
- Shorter downtime than an in-place upgrade.
- A brand-new Base Database System, which means the operating system and Oracle Grid Infrastructure is already on a newer version.
My Environment
I have one PDB that I want to upgrade. It’s called SALES.
Source
- Base Database System on 19.20.0
- Name DBS19
Target
- Base Database System on 23.3.0
- Name DBS23
How To
Prepare AutoUpgrade
- I must use a version of AutoUpgrade that supports upgrades to Oracle Database 23c, and I must have AutoUpgrade on the source and target system.
$ java -jar autoupgrade.jar -version
- At the time of writing, the latest version of AutoUpgrade on My Oracle Support does not support 23 as a target release. Instead, I copy AutoUpgrade from the target Oracle Home (on DBS23) to the source Oracle Home (on DBS19). This version allows upgrades to Oracle Database 23c.
- I create an AutoUpgrade config file, named sales.cfg, which I store on both servers:
global.autoupg_log_dir=/u01/app/oracle/cfgtoollogs/autoupgrade global.keystore=/u01/app/oracle/cfgtoollogs/keystore upg1.source_home=/u01/app/oracle/product/19.0.0.0/dbhome_1 upg1.target_home=/u01/app/oracle/product/23.0.0.0/dbhome_1 upg1.sid=CDB19 upg1.pdbs=SALES upg1.target_cdb=CDB23 upg1.source_dblink.SALES=CLONEPDB 600 upg1.target_pdb_copy_option.SALES=file_name_convert=none upg1.target_version=23 upg1.start_time=05/11/2023 02:00:00
- I must specify
global.keystore
to allow AutoUpgrade to create a keystore to work with my encrypted PDB. source_home
andtarget_home
list the Oracle Home of the source and target CDB, respectively. It doesn’t matter that the two homes existing on one server only.sid
andtarget_cdb
contain the SID of the source and target CDB, respectively.pdbs
contains the name of the PDB I want to upgrade, sales. If needed, I could specify more PDBs.source_dblink
has the name of the database link (CLONEPDB) and the rate at which the target CDB brings over redo and rolls forward the copy (600 seconds or 10 minutes).- I want to use ASM and Oracle Managed Files, so I set
target_pdb_copy_option
accordingly. - Since my source and target CDB are not on the same host, AutoUpgrade can’t automatically determine the target version. I specify that manually using
target_version
. start_time
specifies when downtime starts. At this point, AutoUpgrade refreshes the PDB for the last time and then moves on with the upgrade.
- I must specify
Prepare Source PDB
-
I connect to the source PDB. I create a user (for a database link) and grant privileges:
create user dblinkuser identified by ... ; grant create session, create pluggable database, select_catalog_role to dblinkuser; grant read on sys.enc$ to dblinkuser;
-
After the upgrade, I can drop the user again.
Prepare Target CDB
- I connect to the target CDB and create a database link pointing to my source PDB:
create database link clonepdb connect to dblinkuser identified by dblinkuser using '<connection-string-to-source-pdb>';
Analyze and Fix Source PDB
- First, I analyze the source PDB for upgrade readiness. On the source system:
java -jar autoupgrade.jar -config sales.cfg -mode analyze
- The summary report lists the following precheck failures, which I safely ignore:
- TDE_PASSWORDS_REQUIRED – I will fix that on the target system.
- TARGET_CDB_AVAILABILITY – the target CDB is remote, and AutoUpgrade can’t analyze it.
- Then, I execute the preupgrade fixups:
java -jar autoupgrade.jar -config sales.cfg -mode fixups
- This changes my source PDB, so I do it as close to my maintenance window as possible.
Upgrade
-
Since my PDB is encrypted, I must add the source and target CDB keystore password to the AutoUpgrade keystore. I start the TDE console on the target host:
java -jar autoupgrade.jar -config sales.cfg -load_password
-
In the TDE console, I add the keystore passwords of the source and target CDB:
TDE> add CDB19 Enter your secret/Password: Re-enter your secret/Password: TDE> add CDB23 Enter your secret/Password: Re-enter your secret/Password:
-
I save the passwords and convert the AutoUpgrade keystore to an auto-login keystore:
TDE> save Convert the keystore to auto-login [YES|NO] ?
-
I start AutoUpgrade in deploy mode:
java -jar autoupgrade.jar -config sales.cfg -mode deploy
- AutoUpgrade copies the data files over the database link.
- Rolls the copies of the data files forward with redo from the source.
- At one point, issues a final refresh and disconnects the PDB from the source.
- Upgrades the PDB.
-
I have now upgraded my PDB to Oracle Database 23c.
The Fine Print
You should:
- Check the words for caution in my previous blog post on AutoUpgrade and refreshable clone PDBs.
- Start a new full backup of the target database after the migration.
- Familiarize yourself with the concept of the AutoUpgrade keystore.
Also, notice:
- The PDB is now on a different Base Database System. You need to update your connection string.
- The source PDB must be Oracle Database 19c or newer to upgrade directly to Oracle Database 23c.
- The OCI console will recognize and display the new PDB after a while. You don’t have to do anything … than to wait for the automatic sync job.
where you run below command on the source DB node or target node
java -jar autoupgrade.jar -config sales.cfg -load_password
LikeLike
Hi,
Good question. It’s on the target host. I’ll update the post to make it clearer.
Thanks,
Daniel
LikeLike