Oracle 19c on Kubernetes Data Protection with Portworx PX-Backup

Introduction

If you thinking about, or already running an Oracle database within a container, you may have thought ‘how I am I going to backup and secure my database and environment ?’

In this post I will share how we can use Portworx PX-Backup to easily backup an Oracle database to a Pure Storage FlashBlade s3 Object Store and restore the environment and data.

PX-Backup Installation

Let’s start by visiting central.portworx.com and selecting ‘PX-Backup’ to generate a specification.

The spec generator wizard walks you through the Kubernetes installation, so we just need to complete the defined steps.

Step 1.

Using the helm add command add the repository pointing to the repository path, then update the repo with helm repo update command

[root@master-1 ~]# helm repo add portworx http://charts.portworx.io/ && helm repo update
"portworx" has been added to your repositories
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "portworx" chart repository
Update Complete. ⎈Happy Helming!⎈

Step 2.

Install using the set command.

[root@master-1 PX-Backup]# helm install px-backup portworx/px-backup --namespace px-backup --create-namespace --version 1.2.3 --set persistentStorage.enabled=true,persistentStorage.storageClassName="portworx-sc"
NAME: px-backup
LAST DEPLOYED: Tue May 25 14:07:32 2021
NAMESPACE: px-backup
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Your Release is named: "px-backup"
PX-Backup deployed in the namespace: px-backup

Monitor PX-Backup Install

Wait for px-backup status to change from “Running” a “Completed” state, this will take a few minutes.

[root@master-1 ~]# kubectl get po --namespace px-backup -ljob-name=pxcentral-post-install-hook  -o wide | awk '{print $1, $3}' | grep -iv error
NAME STATUS
pxcentral-post-install-hook-6cs2n Completed

PX-Backup Configuration

Before we logon to the PX-Backup UI we need to capture the Kubeconfig details with.

[root@master-1 ~]# kubectl config view --flatten --minify

Access the UI and paste all he details above in the ‘Add Kubernetes Cluster‘ Kubeconfig dialogue box.

K8s Cluster Details

Cloud Settings

From the main dashboard click on Settings and select Cloud Settings.

Click on Add within the Cloud Accounts and provide required details.

Here I have provided my FlashBlade AWS s3 Object Store credentials

Add Cloud Account

In the bottom panel click Add to setup Backup Locations.

Here I have selected my Cloud Account and provided my s3 bucket name and FlashBlade endpoint.

Add Backup Location

Kubernetes Backup

Select the cluster and the Oracle Namespace, here we can see all the resources which were created from Oracle database 19c on Kubernetes with Portworx storage blog post.

The PX-Backup will backup the Kubenetes environment, not just the data, protecting:

  • ConfigMaps
  • Persistent Volumes
  • Services
  • Secrets

Create Backup

Click Create, as I selected Now, the backup will start immediately.

Now wait for the Cloud icon to go green.

Backup completion

If we want to see the number of objects, size and data reduction of the backup visit the FlashBlade UI.

FlashBlade Object Store

PX-Backup Restore

Before we delete our Sales Order Entry schema, I will perform a quick check on the number of rows in my database.

[root@master-1 bin]# ./sbutil -soe -u soe -p soe -cs //localhost:32755/ORCLPDB1 -tables
Order Entry Schemas Tables
------------------------------------------------------------------------------
|Table Name           |      Rows| Blocks|    Size| Compressed?| Partitioned?|
------------------------------------------------------------------------------
|ORDER_ITEMS          | 7,206,893| 62,560|   3.9GB|    Disabled|           No|
|ORDERS               | 1,429,790| 20,992|   1.3GB|    Disabled|           No|
|ADDRESSES            | 1,500,000| 18,104|   1.1GB|    Disabled|           No|
|CUSTOMERS            | 1,000,000| 17,608|   1.1GB|    Disabled|           No|
|CARD_DETAILS         | 1,500,000| 10,672| 677.9MB|    Disabled|           No|
|LOGON                | 2,382,984|  8,074|  64.0MB|    Disabled|           No|
|INVENTORIES          |   899,228|  2,640|  20.6MB|    Disabled|           No|
|PRODUCT_DESCRIPTIONS |     1,000|     35|   320KB|    Disabled|           No|
|PRODUCT_INFORMATION  |     1,000|     28|   256KB|    Disabled|           No|
|ORDERENTRY_METADATA  |         0|      0|    64KB|    Disabled|           No|
|WAREHOUSES           |     1,000|      5|    64KB|    Disabled|           No|
------------------------------------------------------------------------------
                       Total Space           8.1GB

Disaster strikes!!!

To simulate a disaster I will drop my soe tablespace.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> drop tablespace soe including contents;

Tablespace dropped.

And all my Sale Order Entry data.

[root@master-1 bin]# ./sbutil -soe -u soe -p soe -cs //localhost:32755/ORCLPDB1 -tables
Order Entry Schemas Tables
----------------------------------------------------------------------
|Table Name     |   Rows|    Blocks|  Size| Compressed?| Partitioned?|
----------------------------------------------------------------------
                Total Space              0b

Time to test our backup with a restore

Restore Backup

Wait for the Restore job status to go green.

Kubernetes-cluster restore

Using kubectl we can see we now have a new statefulset, running pod and the associated persistent volume claims.

[root@master-1 Oracle-on-Kubernetes]# kubectl get statefulset
NAME        READY   AGE
oracle19c   1/1     2m14s

[root@master-1 Oracle-on-Kubernetes]# kubectl get pods
NAME          READY   STATUS    RESTARTS   AGE
oracle19c-0   1/1     Running   0          3m10s

[root@master-1 Oracle-on-Kubernetes]# kubectl get pvc
NAME                      STATUS VOLUME                               CAPACIT ACCESS  STORAGECLASS   AGE
ora-data193-oracle19c-0    Bound pvc-068206ed-9997-4549-b5d9-53788feb8771 50Gi   RWO  px-ora-sc      2m48s
ora-setup193-oracle19c-0   Bound pvc-a8ffc36a-82d7-4b95-8dbb-89b4612ee407  1Gi   RWO  px-ora-sc      2m48s
ora-startup193-oracle19c-0 Bound pvc-3e4d930f-b47d-45ca-99c2-b89609e15565  1Gi   RWO  px-ora-sc      2m48s

Add most importantly all our data back.

[root@master-1 bin]# ./sbutil -soe -u soe -p soe -cs //localhost:32755/ORCLPDB1 -tables
Order Entry Schemas Tables
------------------------------------------------------------------------------
|Table Name           |      Rows| Blocks|    Size| Compressed?| Partitioned?|
------------------------------------------------------------------------------
|ORDER_ITEMS          | 7,206,893| 62,560|   3.9GB|    Disabled|           No|
|ORDERS               | 1,429,790| 20,992|   1.3GB|    Disabled|           No|
|ADDRESSES            | 1,500,000| 18,104|   1.1GB|    Disabled|           No|
|CUSTOMERS            | 1,000,000| 17,608|   1.1GB|    Disabled|           No|
|CARD_DETAILS         | 1,500,000| 10,672| 677.9MB|    Disabled|           No|
|LOGON                | 2,382,984|  8,074|  64.0MB|    Disabled|           No|
|INVENTORIES          |   899,228|  2,640|  20.6MB|    Disabled|           No|
|PRODUCT_DESCRIPTIONS |     1,000|     35|   320KB|    Disabled|           No|
|PRODUCT_INFORMATION  |     1,000|     28|   256KB|    Disabled|           No|
|ORDERENTRY_METADATA  |         0|      0|    64KB|    Disabled|           No|
|WAREHOUSES           |     1,000|      5|    64KB|    Disabled|           No|
------------------------------------------------------------------------------
                       Total Space           8.1GB

Summary

In this post I have shared how to install and set-up PX-Backup, perform a backup of an Oracle 19c database to a Flashblade AWS/s3 compliant Object store and perform a restore.

If you found this post interesting you may want to check-out some of my other Kubernetes themed posts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: