Oracle database backup directly on Azure Cloud blob storage using RMAN


We were using the Oracle Database backup on a managed disk directly connected to the VM, then copy over to other storage, but to keep even a backup for a month is expensive on managed disk.

Azure Blob Storage is inexpensive and provides considerable speed for Oracle Database backups and recovery.  


This blog shows you how to use Blobfuse, and mount a Blob storage container on Linux machine and use it for RMAN backups.

What is Blobfuse?

Blobfuse is a virtual file system driver that can be used to access a block blob from your Linux machine by mounting it to a virtual directory.

To get the RMAN backup on Azure blob storage container we need three things:

1. Create a blob storage account in Azure portal
2. Install Blobfuse on Linux machine
3. Mount Azure blob storage as filesystem

1. Create a blob storage account in Azure portal


Go to Azure portal --> storage account --> click on Add to create a storage account. 

Here is the example of my storage account where I choose hot blob, 
standard performance and Locally-redundant storage (LRS) redundancy. You can Choose as per the requirement.




2. Install Blobfuse on Linux machine


Go to the Azure VM where you installed oracle database and add the RPM repository of blobfuse specific to your OS distribution and install blobfuse.


  
  [oracle@dev-ordb-01 ~]$ sudo rpm -Uvh https://packages.microsoft.com/rhel/7.8/prod/blobfuse-1.4.1-RHEL-7.8-x86_64.rpm
Retrieving https://packages.microsoft.com/rhel/7.8/prod/blobfuse-1.4.1-RHEL-7.8-x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:blobfuse-1.4.1-1.el7             ################################# [ 50%]
Cleaning up / removing...
   2:blobfuse-1.3.6-1.el7             ################################# [100%]
[oracle@atz-retail-pos-dev-ordb-01 ~]$

[oracle@dev-ordb-01 ~]$ sudo yum install blobfuse

  
  

3. Prepare for mounting 


Create this temporary directory and ensure that Oracle account has access to it. This temporary path is required for blobfuse to open file contents.


  
  [oracle@dev-ordb-01 ~]$ sudo mkdir /mnt/resource/blobfusetmp -p

  [oracle@dev-ordb-01 ~]$ sudo chown oracle -R /mnt/resource/blobfusetmp

  

Create a blobfuse configuration file with below content:


[oracle@dev-ordb-01 mnt]# cat /home/oracle/fuse_connection.cfg
accountName manojdevstg
accountKey O8HgfgFGDumn2sGRT000dkfdkfdlfdhfn7HqmCnh2kuFJIEk/JpQdfffvFg
containerName test
[oracle@dev-ordb-01 mnt]#
 
 

account name is Azure storage account name which I created in step1.

account key we can find out by going to Azure portal storage account --> click access key like below





container name is the container we created in Azure storage account like I created a test container.





save the file and restrict access

    
[oracle@dev-ordb-01 ~]# chmod 600 fuse_connection.cfg
create a directory that will be used for mounting Azure Blob storage container

    
mkdir ~/mycontainer
Now mount the Blob storage container as I specified in the configuration file using below command.


      [oracle@dev-ordb-01 blobfusetmp]$ sudo blobfuse ~/mycontainer
      --tmp-path=/mnt/resource/blobfusetmp 
      --config-file=/home/oracle/fuse_connection.cfg -o attr_timeout=240 -o
      entry_timeout=240 -o negative_timeout=120 -o allow_other
      
    

Now you can see the blobfuse mount point


      [root@dev-ordb-01 blobfusetmp]# df -h | grep blob
      
      blobfuse         74G   21G 
       50G  29% /home/oracle/mycontainer
        
      

Now we are ready for RMAN backup to Blob storage container.

Connect to Oracle database and run backup:


      rman target /
         RMAN  configure channel device type disk format;
         '/home/oracle/mycontainer/test/ora_df%t_s%s_s%p';
     

After backup complete, we can see backup file in Azure portal storage account container test:









Analyze Invoices with Oracle Analytics and AI Document Understanding

OCI Document Understanding is an AI service that enables developers to extract text, tables, and other key data from document files through...