Oracle Database 23c Free Developer Release on OKE with Portworx Essentials – Part 3

In this blog series I set out to share how to deploy the Oracle Database 23c Free Developer Release on an Oracle Cloud Infrastructure (OCI) Oracle Container Engine for Kubernetes (OKE) Cluster with Portworx storage.

In Part 1 of this series I shared how to create an OKE Kubernetes Cluster.

In part 2 I shared how to install and configure Portworx Essentials Forever Free edition into an Oracle Cloud Infrastructure (OCI) Kubernetes Cluster on Oracle Container Engine for Kubernetes (OKE).

This post will look at deploying an Oracle 23c database on OKE using Portworx software.

Before we start lets have a quick look at the OKE environment we will be using.

OKE Environment

Using kubectl version we can confirm the Oracle Kubernetes Cluster version, for example.

% kubectl version --short | awk -Fv '/Server Version: / {print $3}'
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
1.25.4

And kubectl get nodes to see Worker nodes, Kubernetes version, OCI Region, Availability Domains and Fault Domains.

% kubectl get nodes -L topology.kubernetes.io/region,topology.kubernetes.io/zone,oci.oraclecloud.com/fault-domain
NAME          STATUS   ROLES   AGE   VERSION   REGION        ZONE               FAULT-DOMAIN
10.0.10.148   Ready    node    11d   v1.25.4   uk-london-1   UK-LONDON-1-AD-1   FAULT-DOMAIN-3
10.0.10.53    Ready    node    11d   v1.25.4   uk-london-1   UK-LONDON-1-AD-3   FAULT-DOMAIN-1
10.0.10.86    Ready    node    11d   v1.25.4   uk-london-1   UK-LONDON-1-AD-2   FAULT-DOMAIN-2

Portworx Environment

To check the Portworx version, set-up an alias for pxctl and use pxctl –version to check the Portworx version installed, for example.

% PX_POD=$(kubectl get pods -l name=portworx -n portworx -o jsonpath='{.items[0].metadata.name}')
% alias pxctl='kubectl exec -n portworx ${PX_POD} -it -- /opt/pwx/bin/pxctl'
% pxctl --version
Defaulted container "portworx" out of: portworx, csi-node-driver-registrar
pxctl version 2.13.6-cc39334

Oracle 23c Environment

Now we have confirmed the environment, lets deploy an Oracle database.

Kubernetes Oracle Namespace

I will start by creating a new Kubernetes namespace called oracle-namespace with kubectl create namespace.

% kubectl create namespace oracle-namespace
namespace/oracle-namespace created

To avoid having to specify our namespace with -n each time I will use the set-context to specify a default namespace of oracle-namespace.

% kubectl config set-context –current –namespace=oracle-namespace
Context “context-cwdi2otxsoq” modified.

Kubectl will now default to using the oracle–namespace

% kubectl get pods
No resources found in oracle-namespace namespace.

Oracle Container Image

The official Oracle Database 23c Free Developer Release container image is available from Oracle Container Registry.

Good news, unlike other versions this can be pulled without requiring you to provide your Oracle SSO account details, so we don’t need to set-up a docker pull.

Kubernetes ConfigMap

For my Kubernetes build I will be using a ConfigMap to pass variables to my Oracle 23c container, this makes is very easy to change database password and characterset.

% kubectl create configmap oradb --from-env-file=oracle.properties -n oracle-namespace
configmap/oradb created

You can obtain a copy of the oracle.properies from my GitHub site.

Kubernetes StorageClass

The Portworx px-csi-db Kubernetes Storage Class that has a replication factor of 3 with I/O profile set to “db_remote”, and expansion enabled.

This means that the storage will be optimized for low latency database workloads like Oracle and automatically placed on the highest performance storage available in the cluster

We can see the details by using kubectl describe sc, for example.

% kubectl describe sc/px-csi-db
Name:                  px-csi-db
IsDefaultClass:        No
Annotations:           params/aggregation_level=Specifies the number of replication sets the volume can be aggregated from,params/block_size=Block size,params/docs=https://docs.portworx.com/scheduler/kubernetes/dynamic-provisioning.html,params/fs=Filesystem to be laid out: none|xfs|ext4,params/io_profile=IO Profile can be used to override the I/O algorithm Portworx uses for the volumes: db|sequential|random|cms,params/journal=Flag to indicate if you want to use journal device for the volume's metadata. This will use the journal device that you used when installing Portworx. It is recommended to use a journal device to absorb PX metadata writes,params/priority_io=IO Priority: low|medium|high,params/repl=Replication factor for the volume: 1|2|3,params/secure=Flag to create an encrypted volume: true|false,params/shared=Flag to create a globally shared namespace volume which can be used by multiple pods: true|false,params/sticky=Flag to create sticky volumes that cannot be deleted until the flag is disabled
Provisioner:           pxd.portworx.com
Parameters:            io_profile=db_remote,repl=3
AllowVolumeExpansion:  True
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>

Using a replication factor of 3 will result in Portworx maintaing a copy in each Availability Domain.

Kubernetes StatefulSet

Using the 23cFree_statefulset_PX.yaml file we can spin-up a Containerised Oracle 23c with a single kubectl apply command.

% kubectl apply -f 23cFree_statefulset_PX.yaml
statefulset.apps/oracle23cfree created
service/oracle23c unchanged

% kubectl get pods
NAME              READY   STATUS              RESTARTS   AGE
oracle23cfree-0   0/1     ContainerCreating   0          68s

Kubernetes Persistent Volumes

The StatefulSet has created 3 Persistent Volume claim using the Portworx storage class.

% kubectl get pvc
NAME                             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
ora-data232-oracle23cfree-0      Bound    pvc-efc53824-7fdb-4d97-9597-de8ccebdc4de   12Gi       RWO            px-csi-db      3h34m
ora-setup232-oracle23cfree-0     Bound    pvc-cecdc505-f63b-4b0b-897c-2d5c65e59be8   1Gi        RWO            px-csi-db      3h34m
ora-startup232-oracle23cfree-0   Bound    pvc-f467073a-b740-4cba-94a4-0aa92dac8b4d   1Gi        RWO            px-csi-db      3h34m

And if we shell into the database container we can see our 3 persistent volumes mounted under /opt/oracle/ as defined in the yaml file.

%  kubectl exec -it  pods/oracle23cfree-0 -- /bin/bash
bash-4.4$ df -h
Filesystem                      Size  Used Avail Use% Mounted on
overlay                          36G   30G  5.7G  84% /
tmpfs                            64M     0   64M   0% /dev
tmpfs                           7.7G     0  7.7G   0% /sys/fs/cgroup
tmpfs                           7.7G  4.4M  7.7G   1% /etc/hostname
tmpfs                            10G     0   10G   0% /dev/shm
/dev/mapper/ocivolume-root       36G   30G  5.7G  84% /etc/hosts
/dev/pxd/pxd257934708544297324   12G  3.8G  7.4G  34% /opt/oracle/oradata
/dev/pxd/pxd862649276477447835  974M  8.0K  907M   1% /opt/oracle/scripts/setup
/dev/pxd/pxd66826032118495479   974M  8.0K  907M   1% /opt/oracle/scripts/startup
tmpfs                            16G   12K   16G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs                           7.7G     0  7.7G   0% /proc/acpi
tmpfs                           7.7G     0  7.7G   0% /proc/scsi
tmpfs                           7.7G     0  7.7G   0% /sys/firmware

Kubernetes Services

The Kubernetes manifest file has also created a service for the Oracle Database 23c Free Developer Release Listener.

% kubectl get svc -o wide
NAME        TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)                         AGE   SELECTOR
oracle23c   NodePort   10.96.163.97   <none>        1521:30893/TCP,5500:31387/TCP   21h   app=database,version=23.2.0.1

Kubernetes Logs

We can watch the database creation progress using kubectl logs pods/oracle23cfree-0, for example.

% kubectl logs pods/oracle23cfree-0
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database FREE.
Enter SYS user password:
**********
Enter SYSTEM user password:
**********
Enter PDBADMIN User Password:
***********
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
33% complete
36% complete
39% complete
43% complete
Completing Database Creation
47% complete
49% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/FREE.
Database Information:
Global Database Name:FREE
System Identifier(SID):FREE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.

Connect to Oracle Database using one of the connect strings:
     Pluggable database: oracle23cfree-0/FREEPDB1
     Multitenant container database: oracle23cfree-0

SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Tue Jun 27 20:12:32 2023
Version 23.2.0.0.0

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


Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0

SQL>
System altered.

SQL>
System altered.

SQL>
Pluggable database altered.

SQL> SQL>
Session altered.

SQL>
User created.

SQL>
Grant succeeded.

SQL>
Grant succeeded.

SQL>
Grant succeeded.

SQL>
User altered.

SQL> SQL> Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
The Oracle base remains unchanged with value /opt/oracle
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:

XDB initialized.
ALTER PLUGGABLE DATABASE FREEPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE FREEPDB1 SAVE STATE
2023-06-27T20:12:32.396051+00:00
ALTER SYSTEM SET control_files='/opt/oracle/oradata/FREE/control01.ctl' SCOPE=SPFILE;
2023-06-27T20:12:32.408442+00:00
ALTER SYSTEM SET local_listener='' SCOPE=BOTH;
ALTER PLUGGABLE DATABASE FREEPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE FREEPDB1 SAVE STATE
2023-06-27T20:22:03.856501+00:00
FREEPDB1(3):Resize operation completed for file# 13, fname /opt/oracle/oradata/FREE/FREEPDB1/sysaux01.dbf, old size 317440K, new size 337920K

Oracle Database 23c

Now, we have a running Oracle database in OKE, let’s connect and check the database edition, version, host name and instance name.

 % kubectl exec -it  pods/oracle23cfree-0 --  sqlplus system/Kube#2020@FREEPDB1

SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Wed Jun 28 17:30:48 2023
Version 23.2.0.0.0

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

Last Successful login time: Tue Jun 27 2023 20:09:52 +00:00

Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0

SQL> show con_name;

CON_NAME
------------------------------
FREEPDB1

SQL> SELECT instance_name,  host_name, status  FROM v$instance;

INSTANCE_NAME
----------------
HOST_NAME							 STATUS
---------------------------------------------------------------- ------------
FREE
oracle23cfree-0 						 OPEN

Summary

In this post I shared how to deploy Oracle Database 23c Free Developer Release edition on the OCI managed Oracle Container Engine for Kubernetes (OKE).

If you don’t have an OKE cluster but still want to take Oracle 23c out for a spin, check-out my blog Run Oracle Database 23c Free Developer release with Podman where I show how to get started on your Mac.

One thought on “Oracle Database 23c Free Developer Release on OKE with Portworx Essentials – Part 3

Add yours

Leave a Reply

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: