Use a Google Compute Engine Disk for RMAN backups

Quick Tip

When you are testing your Oracle databases in your virtual machines on Google Cloud Platform, you may need to do several RMAN backups in order to be able to restore data when needed.
If your backup is important and you want to preserve it for long time you can send it to your Cloud Storage Bucket.

But when your backup is for short term, for example for duplicating an instance or when you need to keep free space in your recovery area but you want to preserve past days archive logs for your testings, you will need an alternative.

A quick solution is to store those RMAN backups into an independent disk that you can plug and unplug whenever you want to backup or restore your tablespaces, archive logs or the whole database.

Attach your Backups Disk to your Database VM Instance

On Google Cloud Platform - Compute Engine - VM Instances - your instance

  • Edit
    • + Attach existing disk
      • Disk: oraclerman
      • Mode: Read/write
      • Deletion rule: Keep disk

Inside your virtual machine:

[oracle@patoracle ~]$ sudo lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
├─sda1   8:1    0  200M  0 part /boot/efi
└─sda2   8:2    0 19.8G  0 part /
sdb      8:16   0  100G  0 disk

[oracle@patoracle ~]$ sudo mount -o discard,defaults /dev/sdb /rman

[oracle@patoracle ~]$ cd /rman

[oracle@patoracle rman]$ ls
controlfile  lost+found  respaldo

Now you have the disk available with your backups to restore them or you can do more backups of your objects to this destination, for example RMAN> restore controlfile from "/rman/controlfile/c-1820073908-2020...

New RMAN Disk

If this is the first time you want a disk for RMAN backups, you have to create a blank disk before attaching:

On Google Cloud Platform -> Compute Engine -> Disks -> Create Disk

  • Name: oraclerman
  • Type: Standard persistent disk
  • Source type: Blank Disk
  • Size: 100 GB

And also you have to format the disk, create mounting directory and assign permissions, before mounting:

[oracle@patoracle ~]$ sudo lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
├─sda1   8:1    0  200M  0 part /boot/efi
└─sda2   8:2    0 19.8G  0 part /
sdb      8:16   0  100G  0 disk

[oracle@patoracle ~]$ sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb

mke2fs 1.42.9 (28-Dec-2013)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y

Writing superblocks and filesystem accounting information: done

[oracle@patoracle ~]$ sudo mkdir /rman

[oracle@patoracle ~]$ sudo chown oracle:oinstall /rman