Sunday, June 16, 2024

OCI – Oracle Base Database Service – Creating Custom Backups

Programming LanguageOCI - Oracle Base Database Service - Creating Custom Backups


This blog is specific to how RMAN backups are handled by Oracle Cloud Infrastructure and how custom backups are initiated. Oracle cloud databases have two kinds of Database services as below.

  1. DB System
  2. ExaCS

Lets discuss some common charecterstics of each of the above

RMAN Backups for OCI

Both the class of databases work on RMAN backups , but with different tooling which will be explained in later part of the blog . However it is impotant to understand that the cloud storage for these would be located internally in OCI Internal Object storage buckets. It is important to note that these are not the Oracle Cloud Object storage buckets that an OCI Adminstrator can create , they are “special” Object storage are in Oracle Cloud for RMAN Backups

OCI Backup Configurations

The following factores need to be considered before scheduling backups

  1. The Backups schedules and retentions canbe customized , but the default is 30 days
  2. Backups can be scheduled for standby databases as well
  3. Scheduling automatic Backups include archivelog backups every 30 mins and the incremental backups on weekends , hese include all components like dbfiles , control files , archivelog backups , wallets , etc.. Basically everything that you expect to run in an RMAN backup will work here.

The Official Documentation Link for OCI Database Backups is here

OCI DB System – Custom Backups CLI Reference

My personal preference to trigger manual backups is via dbcli , which is an internal tool for managing DB system which can help create custom backups. This needs tobe run as the root user of the system.

dbcli create-backup 
  -in <db_name> 
  -i <db_id> 
  [-bt {Regular-L0|Regular-L1|Longterm|ArchiveLog}] 
  [-c {Database|TdeWallet}] 
  [-k <n>] 
  [-t <tag>] 
  [-h] [-j]
Enter fullscreen mode

Exit fullscreen mode

The official link for dbli command reference is here

OCI ExaCS – Custom Backups CLI Reference

My personal preference to trigger manual backups is via dbaascli , which is an internal tool for managing ExaCS which can help create custom backups. This needs tobe run as the root user of the system.

# /var/opt/oracle/bkup_api/bkup_api bkup_start --dbname=dbname
Enter fullscreen mode

Exit fullscreen mode

The official link for dbaascli command reference is here

Tooling for DB System and ExaCS – Things to Know

As seen above it is important to understand the difference in tooling for ExaCS and DB System. OCI until date has not provided any supported methods to restore across these systems. i.e. we can’t restore a DB System Backup into an ExaCS or vice versa , we might see that in future. But we could move the data via Data Pump which is more like moving schemas/tables but not the entire database with it’s parameters.

The storage retention policy for OCI Databases as per documentation is below. A Customer is free to choose from the below. It is understood that more teh retention the relevant Object Storage charges would apply

Bronze (14 days)
Silver (35 days) (default)
Gold (65 days)
Platinum (95 days)
Custom (User defined protection policy)
Enter fullscreen mode

Exit fullscreen mode

Custom Schedules – Workaround

I had a customer requirement to take a full backup of the database on every third week Tuesday for a compliance requirement. Such schedules are not available in Oracle Cloud Infrastructire but I had a easy workaround using crontab schedules to handle them

# Cron Backup to run on third Tuesday 
00 23 15-22 * *  [ $(date +'\%w') -eq 2 ] && /home/oracle/backup_script.sh >> /backup/dbname_backuplog_$(date +'%Y-%m-%d-%HH:%M:%S').log 2>&1
Enter fullscreen mode

Exit fullscreen mode

NOTE : The backup_script.sh is a wrapper script used for dbcli and dbaascli , such workarounds are very convenient to use for customized backup. There would be no change in the way backups are handled and stored with a custom backup. They continue to use the same Object storage mechanism as used for the Oracle Cloud Automatic Backups. The working and scheduling of Oracle Cloud automatic backups is documented here

Check out our other content

Check out other tags:

Most Popular Articles