How to Upgrade OCI BaseDB (DBCS) from 19c to 23c

Share on:

database

Recently there was a requirement to upgrade DBCS PDB from 19c to 23c. There might be other ways to do that but I found the best and easiest way is to create a new 23c DBCS and then move 19c PDB using the Refreshable clone method and then use Auto upgrade to upgrade it.

I will show you how to do that in this blog post.

Pre-requisite: I already have all the networking setup and have 2 DBCS, one 19c and one 23c.

 

Benefits of this approach:

1. We already have 23c DBCS with the latest Grid/ASM software. so we just need to move the PDB to this DBCS and upgrade it. It will shorten the downtime

2. Another thing is when we use the refreshable clone method, there is no downtime when files are copied over, and the copies of the data files forward with redo from the source. Downtime only starts at the time of upgrade

3. Another benefit is the rollback scenario, we already have our source 19c PDB, if anything wrong happens during the process you can just open and use the source PDB as a rollback plan

So let’s start…

Source: 19c DBCS with CDB name DB122 and PDB name Db19c

Target: 23c DBCS with CDB name DB1229 and PDB name Db23c (This is existing PDB on 23c DBCS)

 

By default, every Oracle Home has the AutoUpgrade jar file. I copied the autoupgrade.jar from 23c DBCS home to 19c DBCS home.

To use auto upgrade I created a config file called upgrade.cfg, which I store on both DBCS systems.

[oracle@source admin]$ cat upgrade.cfg
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=DB122
upg1.pdbs=DB19C
upg1.target_cdb=DB1229
upg1.source_dblink.DB19C=CLONEPDB 600
upg1.target_pdb_copy_option.DB19C=file_name_convert=none
upg1.target_version=23
upg1.start_time=28/12/2023 22:00:00
[oracle@source admin]$

Where:

global.autoupg_log_dir = is the location where auto-upgrade logs will be collected

global.keystore = This is the auto-upgrade keystore where we store TDE passwords for source and target PDBs

Source and Target Homes where specify the source and target CDB homes

sid and PDB is the source CDB and source PDB respectively

target_CDB is the target CDB name

source_dblink has the name of the db link (clonepdb) and the rate at which the redo transfer

target_pdb_copy_option = I am using ASM and OMF

start_time : This is a very important parameter to specify because this parameter decides when downtime starts. At this point, AutoUpgrade refreshes the PDB for the last time and then moves on with the upgrade.

start_time is optional, if you don’t specify, it right away starts upgrade after the refresh.

Now we have to create a dblink that we used in the above config file:

Connect to source DBCS PDB create a user for Db link and grant privileges.

[oracle@source ~]$ . oraenv
ORACLE_SID = [DB122] ?
The Oracle base has been set to /u01/app/oracle
[oracle@source ~]$ echo $ORACLE_SID
DB122
[oracle@source ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Dec 28 20:28:52 2023
Version 19.20.0.0.0

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


Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 DB19C                          READ WRITE NO
SQL> alter session set container= DB19C;

Session altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 DB19C                          READ WRITE NO
SQL> create user test identified by XXXXXXXXXXXXXXX;

User created.

SQL> grant create session, create pluggable database, select_catalog_role to test;

Grant succeeded.

SQL> grant read on sys.enc$ to test;

Grant succeeded.

SQL>

Now connect to Target DBCS CDB and create a db link:

SQL> create database link clonepdb connect to test identified by XXXXXXXXXXX using 'DB19C';

Database link created.

SQL> select * from dual@clonepdb;

D
-
X

Now we can analyze and execute pre-upgrade fixups on source PDB

[oracle@source admin]$ java -jar autoupgrade.jar -config upgrade.cfg -mode analyze

and

[oracle@source admin]$ java -jar autoupgrade.jar -config upgrade.cfg -mode fixups

We will see the below error when analyzing and doing fixups

Error Message: The following checks have ERROR severity and no fixup is available or

the fixup failed to resolve the issue. Fix them manually before continuing:

DB19C TDE_PASSWORDS_REQUIRED

DB19C TARGET_CDB_AVAILABILITY

For now, we can safely ignore these as we will fix them on the target side.

On target DBCS:

Since our PDB is encrypted, we have to add the source (db122) and target CDB(db1229) TDE password to the Auto Upgrade keystore that we defined in the config file.

[oracle@target admin]$ java -jar autoupgrade.jar -config upgrade.cfg -load_password
Processing config file ...
Starting AutoUpgrade Password Loader - Type help for available options
Creating new AutoUpgrade keystore - Password required
Enter password:
Enter password again:
AutoUpgrade keystore was successfully created
TDE> add DB122
Enter your secret/Password:
Re-enter your secret/Password:
TDE> add DB1229
Enter your secret/Password:
Re-enter your secret/Password:
TDE> save
Convert the AutoUpgrade keystore to auto-login [YES|NO] ? yes
TDE> exit
AutoUpgrade Password Loader finished - Exiting AutoUpgrade
[oracle@target admin]$

Now we are ready to start the Auto Upgrade in deploy mode.

[oracle@target admin]$ java -jar autoupgrade.jar -config upgrade.cfg -mode deploy
AutoUpgrade 23.3.230728 launched with default internal options
Processing config file ...
Loading AutoUpgrade keystore
AutoUpgrade keystore was successfully loaded
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 PDB(s) will be processed
Type 'help' to list console commands
upg> Copying remote database 'DB19C' as 'DB19C' for job 100
Remote database 'DB19C' created as PDB 'DB19C' for job 100
Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

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



Please check the summary report at:
/u01/app/oracle/cfgtoollogs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.html
/u01/app/oracle/cfgtoollogs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.log
[oracle@target admin]$

 

So what this deploy command will do:

1. Copies the data files to target DBCS over the DB link

2. Refresh the data files using source redo

3. As per the start_time parameter in the config file, it will do the final refresh and disconnect the PDB from the source, downtime starts here.

4. Upgrade the PDB

Now let’s check the target CDB for our new PDB

[oracle@target postchecks]$ sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Fri Dec 29 04:58:32 2023
Version 23.3.0.23.09

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


Connected to:
Oracle Database 23c Enterprise Edition Release 23.0.0.0.0 - Production
Version 23.3.0.23.09
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 DB23C                          READ WRITE NO
         5 DB19C                          READ WRITE NO
SQL>

We can see that PDB is there in read-write mode

So Upgrade is done and now we have upgraded PDB on 23c DBCS 🙂

The last thing to check is whether we have this PDB on the OCI console in 23c DBCS CDB. let’s check

database2

Share on:

More from this Author

oac

How to Import Custom Visualization in Oracle Analytics Cloud to See Images

In this blog, I will show you how to download and import the Image Gallery Plugin into OCI Oracle Analytics Cloud. using this plugin we can see ... Read More

Oracle 23c INTERVAL Data Type Aggregations

Analyze Invoices with Oracle Analytics and AI Document Understanding

OCI Document Understanding is an AI service that enables developers to extract text, tables, and other key data from document files through APIs and ... Read More

Back to Top