Oracle Exadata Cloud Service Long Term Database Backup Retention and Replicate Backups Across Regions

Oracle Cloud Infrastructure Solution to Retain Backups Forever and Cross-Region Archival of Oracle Database Backups in Customer Managed Bucket.

Shadab Mohammad
Oracle Developers

--

Introduction

Many of our customers require their Oracle database backups to be stored on Oracle Cloud Infrastructure (OCI) cross-region and for long-term retention due to various compliance requirements for the industry they operate in. The most frequent question I get from our Enterprise customers is: How can I archive my backups on OCI for seven years or ten years to meet our regulators requirement? In this article we will explore how you can do that on OCI Exadata Cloud Service

Currently the automated backups provided by default on Exadata Cloud Service (ExaCS) is limited to a maximum of 60 days and cross region backups are not supported. Both the Automatic backup and Manual backup are stored in an Oracle Managed Bucket which you do not have direct access to. So how do we do archival backups in your own bucket and then replicate those backups cross-region.

In this article we’ll show you how you can take an on-demand database backups from ExaCS to a customer managed bucket on Oracle Object Storage and replicate the backup data cross-region.

Solution

The Exadata Cloud Service provides capability to take archived backups which have retention of ‘keep-forever’ unlike the Auto backups which can be retained only for 60-days maximum. You can create these on-demand backups using either the OCI console or the dbaascli utility. We will use the dbaascli to create long term backups and then use the MV2BUCKET utility to upload them to a customer managed bucket and then replicate the bucket to another region.

The solution is implemented the below components

  1. MV2BUCKET utility which can be used to copy backups from Oracle managed bucket to your own bucket
  2. OCI-CLI command line utility to authenticate MV2BUCKET on the ExaCS VM node
  3. File Storage Service to stage the backups on the local ExaCS node
  4. Oracle Object Storage for backups to be stored in
  5. Finally a cross-region replication of the Object storage bucket in primary region to the destination region for storage of backups
  6. dbaascli utility for backing up the database on ExaCS
Exadata Database Service Long-Term Backup Retention and Cross Region Replication Architecture

Pre-Requisties

  1. You have a OCI user and required IAM permissions to perform all operations in the tenancy
  2. You have opc user SSH access to the ExaCS VM CLUSTER nodes

3. A database exists on the ExaCS VM Cluster. In this example we will use a database called ‘TestDB

Steps for Setting Up MV2Bucket, OCI-CLI and Cross-Region Replication for Oracle Object Storage

  1. Install and Configure MV2BUCKET on the ExaCS Nodes

Download and Install latest version of MV2BUCKET rpm file with root user on the Exadata Cloud Service Node from Oracle Support [1]: (OCI) mv2bucket — Oracle Managed Bucket Content Manager (Doc ID 2723911.1)

2. Create a OCI File storage system and mount it on the ExaCS DB node for Staging the Backup’s [2]

mkdir -p /shared_storesudo mount 10.10.1.120:/Prod-Apps-Shared /shared_store -o nolockmkdir -p /shared_store/db_backup/TestDB

3. Create a bucket in Primary Region and create a bucket in the Target region. Once both buckets are created, create a replication policy on the primary region bucket to replicate data to target region bucket [3]

Primary Region Bucket
Destination Region Bucket

4. Create an IAM policy for OSS Replication in your Compartment where ExaCS sits

Allow group <Group Name> to manage buckets in compartment <Compartment Name>Allow group <Group Name> to manage objects in compartment <Compartment Name>Allow service objectstorage-ap-sydney-1 to manage object-family in compartment <Compartment Name>

5. Create replication policy on your Primary region bucket to Destination region

6. Install oci-cli as root user on the Exadata Cloud Service node

-- Linuxbash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"-- Oracle Linuxsudo yum install python36-oci-cli

Configure API keys with your user and add your private key and config file in /root/.oci directory. You will need to create the .oci directory manually after installing oci-cli

Test if oci cli client is properly installed

$ oci compute instance list --compartment-id ocid1.compartment.oc1..aaaaaa*******a

Steps for Taking Backup with DBAASCLI and Copying to Customer Managed Bucket with MV2BUCKET

  1. Login to any one of the ExaCS DB Node and create a customize backup with retention of ‘keep-forever’
$ ssh opc@exacsnode1$ sudo -s$ dbaascli database backup --dbname TestDB --start --archival --tag TestDBLongTermBackup2022DBAAS CLI version 22.2.1.1.0
Executing command database backup --start --archival --tag TestDBLongTermBackup2022
DBaaS Backup API V1.5 @2022 Multi-Oracle home
-> Action : bkup_start
-> logfile: /var/opt/oracle/log/TestDB/bkup_api_log/bkup_api_4af4f585_20220618161130.837209.log
UUID 7fb45008eecd11eca48d02001700c06a for this backup
** process started with PID: 95722
** see log file for monitor progress
-------------------------------------

OR — Alternately you can create a long-term retention backup from OCI Console

2. Check the backup status using dbaascli commands

$ dbaascli database backup --dbname TestDB --status --uuid 7fb45008eecd11eca48d02001700c06aDBAAS CLI version 22.2.1.1.0
Executing command database backup --status --uuid 7fb45008eecd11eca48d02001700c06a
DBaaS Backup API V1.5 @2022 Multi-Oracle home
@ STARTING CHECK STATUS 7fb45008eecd11eca48d02001700c06a
[ REQUEST TICKET ]
[UUID -> 7fb45008eecd11eca48d02001700c06a
[DBNAME -> TestDB
[STATE -> success
[ACTION -> create-backup-keep-forever
[STARTED -> 2022-06-18 06:11:36 UTC
[ENDED -> 2022-06-18 06:15:44 UTC
[PID -> 95722
[TAG -> TestDBLongTermBackup2022
[PCT -> 100
$ dbaascli database backup --dbname TestDB --listDBAAS CLI version 22.2.1.1.0
Executing command database backup --list
DBaaS Backup API V1.5 @2022 Multi-Oracle home
-> Action : list
-> logfile: /var/opt/oracle/log/TestDB/bkup_api_log/bkup_api_40a9cc5e_20220618161647.574847.log
-> Listing all backups
Backup Tag Completion Date (UTC) Type keep
---------------------- ----------------------- ----------- --------
TAG20220618T155626 06/17/2022 20:00:39 full False
TestDBLongTermBackup2022 06/17/2022 20:15:44 keep-forever True
dbaascli execution completed

3. Run mv2bucket.bin with ‘root’ user and copy the backups from the database to staging area and then upload to the primary region bucket

-- Check content of Oracle managed bucket for the Database$ /opt/mv2bucket/mv2bucket.bin list --dbuniquename TestDB_wd5_syd|=============================================================================================================================================================|============|
|Oracle Managed Bucket content size | 2.67 GB|
|=============================================================================================================================================================|============|
-- Copy data from Oracle Managed Bucket to Staging Area in FSS and then upload to Customer Managed Bucket$ /opt/mv2bucket/mv2bucket.bin copy --dbuniquename TestDB_wd5_syd --bucketname Archival_LongTerm_Backup_Retention_Primary --stage /shared_store/db_backup/TestDB --parallel 5 --incrementalINFO: 2022-06-18 16:26:47: Im going to get '140' files missing on target 'Archival_LongTerm_Backup_Retention_Primary' and on stage '/shared_store/db_backup/TestDB'
INFO: 2022-06-18 16:26:47: Getting Oracle Managed Bucket incremental files size
INFO: 2022-06-18 16:26:47: Required stage area size for incremental is 2.67 GB
INFO: 2022-06-18 16:26:47: Available free space on stage area '/shared_store/db_backup/TestDB' is 8.00 EB
INFO: 2022-06-18 16:26:47: Getting '140' files from Oracle Managed Bucket, it will take time, please wait...
SUCCESS: 2022-06-18 16:27:01: Files downloaded from Oracle Managed Bucket successfully
INFO: 2022-06-18 16:27:01: Uploading files to own bucket, it will take time, please wait...
SUCCESS: 2022-06-18 16:27:39: Files Uploaded to 'Archival_LongTerm_Backup_Retention_Primary' successfully
-- Check the size of the Customer Managed Bucket$ /opt/mv2bucket/mv2bucket.bin size --bucketname Archival_LongTerm_Backup_Retention_Primary-------------------------------------------------
Bucket 'Archival_LongTerm_Backup_Retention_Primary' content
- Number of files : 140
- Total Files size: 2.67 GB
-------------------------------------------------
-- Check difference between Oracle Managed Bucket and Customer Managed Bucket$ /opt/mv2bucket/mv2bucket.bin diff --dbuniquename TestDB_wd5_syd --bucketname Archival_LongTerm_Backup_Retention_PrimaryINFO: 2022-06-18 16:32:30: Target Bucket 'Archival_LongTerm_Backup_Retention_Primary' existence check
INFO: 2022-06-18 16:32:31: Database 'TestDB_wd5_syd' existence check
INFO: 2022-06-18 16:32:32: Getting OPC file
INFO: 2022-06-18 16:32:33: Getting OPC file parameters
INFO: 2022-06-18 16:32:34: Checking Oracle Managed Bucket connectivity
INFO: 2022-06-18 16:32:35: Getting Oracle Managed Bucket informations, please wait...
INFO: 2022-06-18 16:32:35: Getting Oracle Managed Bucket files list
INFO: 2022-06-18 16:32:35: Getting target bucket 'Archival_LongTerm_Backup_Retention_Primary' files list
SUCCESS: 2022-06-18 16:32:36: Source and target bucket 'Archival_LongTerm_Backup_Retention_Primary' are having the same files.

Once the data comes in primary bucket, it is replicated to the Target region bucket automatically. Check the bucket in the destination region

4. Run another Sync to Local Storage

-- Sync to Local Storage $ /opt/mv2bucket/mv2bucket.bin get --dbuniquename TestDB_wd5_syd --bucketname Archival_LongTerm_Backup_Retention_Primary --stage /shared_store/db_backup/TestDB --incremental --parallel 5-- Upload to Object Storage Bucket$ /opt/mv2bucket/mv2bucket.bin get --dbuniquename TestDB_wd5_syd --bucketname Archival_LongTerm_Backup_Retention_Primary --stage /shared_store/db_backup/TestDB --incremental --parallel 5-- Final Check$ /opt/mv2bucket/mv2bucket.bin diff --dbuniquename TestDB_wd5_syd --bucketname Archival_LongTerm_Backup_Retention_PrimarySUCCESS: 2022-06-18 17:00:50: Source and target bucket 'Archival_LongTerm_Backup_Retention_Primary' are having the same files.

5. Get OPC and Wallet file info

$ /opt/mv2bucket/mv2bucket.bin opcinfo --dbuniquename TestDB_wd5_syd

We have thus successfully long term archive backups for ExaCS and copied it over to a customer managed bucket and replicated the backup data across region.

Ready to learn more? Please visit oracle.com/database for more information.

You can also visit our public Slack to discuss!

--

--

Shadab Mohammad
Oracle Developers

Cloud Solutions Architect@Oracle (The statements and opinions expressed here are my own & do not necessarily represent those of my employer)