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

 


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 new 23c DBCS and then move 19c PDB using 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.

Benefit of this approach :

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

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

3. Another benefit is rollback scenario, we already have our source 19c PDB, if anything wrong happen during the process you can just open and use the source PDB as 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 have 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 autoupgrade logs will collect

global.keystore = this is the autoupgrade 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 db link (clonepdb) and rate at which redo transfer.

target_pdb_copy_option = I am using ASM and OMF

start_time : This is very important parameter to specify because this parameter decide 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 won't specify, it right away start upgrade after the refresh.

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

Connect to source DBCS PDB and 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 preupgrade 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 below error when analyze and do prefixups

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 these on target side.

On target DBCS:

Since our PDB is encrypted, we have to add source (db122) and target CDB(db1229) TDE password to Auto Upgrade keystore that we defined in 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 datafiles to target DBCS over the DB link.

2. Refresh the datafiles using source redo.

3. As per the start_time parameter in config file, it will do the final refresh and disconnects the PDB from 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 :)

Last thing to check, do we have this PDB on OCI console in 23c DBCS CDB. let's check.


yes we have it, so all good!


ADB App Store - Oracle autonomous database App store and how to deploy application

 


The ADB App store: is an application launchpad for Oracle supported applications. Using ADB app store, tenants can install and manage the life cycle of these applications. 

Currently below applications can be deployed using ADB App store..

Ask Oracle: This app translates the user text input to SQL and run queries against the database.

Data Visual Studio: is a visualization tool for the analytics data.

OCI Cost & Usage Analytics: Monitor and manage OCI resource consumption.

OCI Log Analytics: give insights about the logs created in oci for services like VCN, load balancers etc. For now this app only supports logs for VCN service.

Workload Analytics & Reports (WAR): a visualization tool for AWR.

More applications are in pipeline....

Pre-requisite: Should have autonomous database deployed in OCI.

Installation:

Connect to ADB using SQL*Plus as ADMIN user and run below script to install ADB App store

SQL> set define off;

SQL> @adb_app_store_install.sql

You can find all scripts at this Oracle GitHub repository https://github.com/oracle-samples/adbs-tools 

Once App store installed successfully, run below script to get the ADB App store application URL .

SQL> @adb_app_store_get_URL.sql


We can use the URL from above output to login ADB APP store.


For credentials, We can use the default database user "ADB_APP_STORE" which exists in all Autonomous Databases.

We just need to unlock this user and set the new password to use it.

 



 
Now I can access the App store using above username/password and URL.



From here you can click on any application and you will see the details on how to install and what are the pre-requisites etc. For example I click on "OCI Cost & Usage Analytics" to see the details.


For this app I need to be in root compartment to set some policies. For now let me use "Workload Analytics & Reports (WAR)" app, as this does not need any Pre-requisite if you see below.


So I just click on Install button and its installed, in above screenshot its already installed, that's why you see uninstalled and open button.

Let me click on open button, you will get below screen.


I used my ADMIN user to login and see below screen.




Here we can analyze AWR dataset and investigate performance issues. I click on Analyze button.



We can do many things here to investigate issue and can also generate AWR reports.

Same way we can install other app from ADB App store and take benefits. 

Hope you like this blog!



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...