How to Leverage OSS Storage Gateway for RMAN Backups

December 18, 2019 | 6 minute read
Text Size 100%:

Introduction

One of the primary use case of Object Storage Service (OSS) Storage Gateway is Data Transfer between On-premises applications and Oracle Cloud Infrastructure (OCI).  Apart from this, OSS Storage Gateway is a highly usable solution for Backups, Archival and Disaster Recovery. Storage Gateway is the evolution of the Storage Software Appliance which was available with Oracle Cloud Infrastructure Classic (OCI-C) and on OCI its enhanced with file-to-object transparency and improved scale and performance.

This blog talks about how OSS Storage Gateway can be used along with RMAN backups to store the backups on OSS instead of tape drives.

Main Article

RMAN has the capability to read/write database backups directly to local or remote region OSS destinations from Bare Metal or Virtual Machine DB system database. Please refer the following documentation link for Backing Up a Database to Object Storage Using RMAN. 

On OCI, one of the prerequisite for using OSS as backup destination is DBaaS node's Virtual Cloud network (VCN) must be configured with access to Object Storage. If Public Subnets are configured for the DBaaS nodes, accessing the object storage is pretty straight forward and no additional network configurations are required.

In case the DBaaS nodes are configured with Private network, to enable access to Objects Storage additional network configurations are required. 

  • For Object Storage access in the same region as the DBaaS system: Oracle recommends using a service gateway. For more information, see Service Gateway for the VCN.
     
  • For Object Storage access in a different region than the DBaaS system: Use an NAT gateway or Use Storage Gateway.  Please follow the link to configure NAT gateway for initiating connections to the internet from private subnet.

In this Blog, we will see how to use Storage Gateway to execute RMAN backups to OSS Remote Destinations from DBaaS Nodes configured with Private Subnets. 

To demonstrate the usage of Storage Gateway along with RMAN, following cloud components are configured on OCI.

1. Create & Configure a VCN with Public and Private Subnet.
2. Create & Configure a DBaaS VM  with Private Subnet.
3. Create & Configure a Compute Instance with Public Subnet
4. Create OSS Bucket in Local and Remote Regions.

1. Create & Configure a VCN with Public and Private Subnet.

a) Create Virtual Cloud Network:

Property Name Property Value
Name SG_VCN01
Create in Compartment <compartment_name>
CIDR Block 10.1.0.0/16
DNS Resolution Do not select the Use DNS Hostnames in this VCN check box
DNS Label SGVCN01
DNS Domain Name SGVCN01.oraclevcn.com

 

b) Create 1 Private Subnet & 1 Public Subnet under the VCN created in Step 1.a

 Property Name Property Value: Private Subnet Property Value: Public Subnet
Name DB_Private_Subnet SG_Public_Subnet
Subnet Type Availability Domain Specific Availability Domain Specific
Availability Domain AD-3 AD-3
CIDR Block 10.1.20.0/28 10.1.10.0/28
Route Table  Default Route Table for SG_VCN01 Default Route Table for SG_VCN01
Subnet Access Private Subnet Public Subnet
DNS Resolution Do not select the Use DNS Hostnames in this VCN check box  Do not select the Use DNS Hostnames in this VCN check box
DNS LABEL  dbprivatesubnet sgpublicsubnet
DNS DOMAIN NAME dbprivatesubnet.sgvcn01.oraclevcn.com sgpublicsubnet.sgvcn01.oraclevcn.com
DHCP Options Default DHCP Options for SG_VCN01 Default DHCP Options for SG_VCN01
Security List Default Security List for SG_VCN01 Default Security List for SG_VCN01

 

2. Create & Configure a DBaaS VM with Private Subnet.

a) Create a DBaaS instance

Property Name Property Value
Select a Compartment <compartment_name>
Name your DB System SG_RMAN_DB
Select an Availability Domain AD-3
Select a shape type Virtual Machine
Select a shape VM.Standard1.2
Configure the DB System: Total Node Count 1
Configure the DB System: Oracle Database software edition Enterprise Edition
Choose Storage Management Software Oracle Grid Infrastructure
Configure storage (GB) 256
Total Storage  (GB) 712
Add Public SSH Keys <ssh keys>
Choose a License Type <License_Type>
Specify the network information  
Virtual cloud network in <compartment_name> SG_VCN01
Client Subnet in <compartment_name> DB_Private_VPN
Hostname prefix SGRMANDB
Host domain name dbprivatesubnet.sgvcn01.oraclevcn.com
Host and domain url SGRMANDB.dbprivatesubnet.sgvcn01.oraclevcn.com
Database name DB1216
Database Version 18.0.0.0
PDB Name <optional>
Username Sys
Password <password>
Confirm Password <password>
Select workload type On-Line Transaction Procession (OLTP)

 

3. Create & Configure a Compute Instance with Public Subnet

 

Property Name Property Value
Name Your Instance SG_HOST
Choose an operating system or image source Oracle-Linux-7.7-2019.11.12-0
Availability Domain AD-3
Instance Type Virtual Machine
Instance Shape VM.Standard2.4
Configure Networking   
Virtual cloud network compartment  <compartment_name>
Virtual cloud network SG_VCN01
Subnet compartment <compartment_name>
Subnet SG_Public_Subet
Assign a public IP address Yes
Boot Volume  Default boot volume size: 46.6 GB
Add SSH key <ssh keys>

 

Once the Compute instance is provisioned successfully, Attach a Block Volume created with the following configurations:

Property Name Property Value
Name SGDisk01
Create in Compartment <compartment_name>
Availability Domain AD-3
Size in GB  600GB
Compartment for Backup Policies <compartment_name>
Backup Policy  Bronze
Virtual cloud network compartment  <compartment_name>
Volume Performance Balanced
Encryption Encrypt using Oracle-managed keys

 

4. Create OSS Bucket in Local and Remote Regions.

Name Region Storage Tier Visibility
rman_local_bucket Ashburn Standard Private
rman_remote_bucket Pheonix Standard Private


4. Install & Configure Storage Gateway with Public Subnet

Follow the steps mentioned below to configure and install Storage Gateway. For this Demo, I used the Compute instance created on OCI (Step 3) to install Storage Gateway and created two Filesystems pointing to Buckets on Local and Remote Object Storage Service.

Note: For this Demo, create the file systems for Both Local and Remote Object Storage.

And once the Storage Gateway is created mount the file systems on the DBaaS instances following the steps available in the link pasted below:

Note: For this Demo, Mount the file systems for Both Local and Remote Object Storage. 

  • RMAN_LOCAL_BUCKET is configured to used the Object storage on Ashburn Region. Storage Gateway Host and DBaaS instances are provisioned on Ashburn region.
     
  • RMAN_REMOTE_BUCKET is configured to used the Object storage on Phoenix Region

Once the steps mentioned in the sections are executed, on the DBaaS instance two NFS mount points will be available and these two NFS mount points are actually pointed to two OSS buckets created on the Local and Remote Region respectively.

[opc@sgrmandb ~]$ sudo mount -t nfs -o vers=4,port=32770 10.1.20.3:/RMAN_REMOTE_BUCKET /RMAN_REMOTE_BUCKET

[opc@sgrmandb ~]$ sudo mount -t nfs -o vers=4,port=32770 10.1.20.3:/RMAN_LOCAL_BUCKET /RMAN_LOCAL_BUCKET

[opc@sgrmandb ~]$ df -h

10.1.20.3:/RMAN_REMOTE_BUCKET        8.0E     0  8.0E   0% /RMAN_REMOTE_BUCKET

10.1.20.3:/RMAN_LOCAL_BUCKET         8.0E     0  8.0E   0% /RMAN_LOCAL_BUCKET

[opc@sgrmandb ~]$

Now RMAN backups can use this Storage Gateway file systems mounted as NFS Mounts on the DBaaS nodes as DEVICE TYPE DISK. This option provides much more flexibility than using the OSS Buckets as DEVICE TYPE SBT when configuring the OSS Buckets for RMAN. 

Utilizing some of the RMAN advanced backup features like Backup Duplexing, RMAN backup sets can be copied over to Local and Remote Region OSS buckets mounted via Storage Gateway simultaneously without executing the RMAN Backups multiple times.

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/RMAN_LOCAL_BUCKET/%U','/RMAN_REMOTE_BUCKET/%U';

RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;

RMAN> LIST BACKUP SUMMARY;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
10      B  A  A DISK        17-DEC-19       1       2       NO         TAG20191217T205822
11      B  F  A DISK        17-DEC-19       1       2       NO         TAG20191217T205858
12      B  F  A DISK        17-DEC-19       1       2       NO         TAG20191217T205858
13      B  F  A DISK        17-DEC-19       1       2       NO         TAG20191217T205858
14      B  A  A DISK        17-DEC-19       1       2       NO         TAG20191217T210024
15      B  F  A DISK        17-DEC-19       1       1       NO         TAG20191217T210027

RMAN> LIST BACKUP TAG='TAG20191217T205822';


List of Backup Sets
===================


BS Key  Size
------- ----------
10      673.67M

  List of Archived Logs in backup set 10
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    1       1936382    16-DEC-19 1984521    16-DEC-19
  1    2       1984521    16-DEC-19 2146502    17-DEC-19

  Backup Set Copy #1 of backup set 10
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:10     17-DEC-19       NO         TAG20191217T205822

    List of Backup Pieces for backup set 10 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    13      1   AVAILABLE   /RMAN_LOCAL_BUCKET/0aujm83e_1_1

  Backup Set Copy #2 of backup set 10
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:10     17-DEC-19       NO         TAG20191217T205822

    List of Backup Pieces for backup set 10 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    14      1   AVAILABLE   /RMAN_REMOTE_BUCKET/0aujm83e_1_2

RMAN>

Conclusion

This blog talks about one of the many scenarios where OCI object storage can be utilized to achieve Disaster recovery along with OCI PaaS and SaaS offerings. Depending upon the organizations policies & requirement OCI OSS Object storage, Block Storage or File Storage can be used to achieve the Disaster Recovery guidelines using Oracle RMAN. 

 

 

Anand Raghavan


Previous Post

2019 Network Blog Summary

Tal Altman | 2 min read

Next Post


Install Aqua Security on Oracle Cloud Infrastructure Container Engine for Kubernetes

Derek Kam | 4 min read