101 Series of Oracle in Google Cloud – Part IV: Setup an NFS Mount from a GCP Filestore for RMAN Backups

Staying with the GCP 101 series, I will now explain how you set up an NFS mount from a GCP Filestore for RMAN backups.

I want to keep on mentioning that first you should check with Oracle and your licensing rep on what is supported and licensed before doing any of this work.

I have previously built 2 VMs that I am using for these exercises and the steps are in my post 101 SERIES OF ORACLE IN GOOGLE CLOUD – PART I : BUILDING ASM AND DATABASE.

In this case, I will only use rene-ace-test-inst1.

rene@renes-imac ~ % gcloud compute instances list | grep inst1
rene-ace-test-inst1 us-central1-c           n1-standard-8           ***.***.0.2   ***.***.***.134   RUNNING

I have enabled the file.googleapis.com by following the instructions in Enable the Google Drive API. As of Apr 2021, GCP Filestore offers three performance tiers which are listed below

img1

Once I enabled the API, I created a 1TB Filestore Instance as I didn’t need anymore for this test.

rene@renes-imac ~ % gcloud filestore instances create ra-rman-nfs \
 --zone=us-central1-c \
 --tier=STANDARD \
 --file-share=name="rman_vol1",capacity=1TB \
 --network=name="network-oracle-instances"

Waiting for [operation-1618854768503-5c056ff6b6b44-18fbf4ba-9aefba3a] to finish...done.

rene@renes-imac ~ % gcloud filestore instances list
INSTANCE_NAME ZONE TIER CAPACITY_GB FILE_SHARE_NAME IP_ADDRESS STATE CREATE_TIME
ra-rman-nfs us-central1-c STANDARD 1024 rman_vol1 ***.***.***.130 READY 2021-04-19T17:52:49

I now logged on to my rene-ace-test-inst1 and made sure that the nfs-utils package was installed.

[root@rene-ace-test-inst1 ~]# yum install -y nfs-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: bay.uchicago.edu
 * epel: mirror.steadfastnet.com
 * extras: mirror.genesisadaptive.com
 * updates: ftp.osuosl.org
Package 1:nfs-utils-1.3.0-0.68.el7.x86_64 already installed and latest version
Nothing to do

Once I had installed the nfs-utils package, as root, I mounted the GCP NFS Filestore to rene-ace-test-inst1 and made sure that it was present in fstab.

[root@rene-ace-test-inst1 ~]# mkdir /mnt/rman_vol1
[root@rene-ace-test-inst1 ~]# mount 10.34.107.130:/rman_vol1 /mnt/rman_vol1
[root@rene-ace-test-inst1 ~]# chown oracle:oinstall /mnt/rman_vol1
[root@rene-ace-test-inst1 ~]# echo "10.34.107.130:/rman_vol1 /mnt/rman_vol1 nfs defaults 0 0" >> /etc/fstab

After the NFS was mounted, I only had to create the directory where the backup was going to be held, configure it in RMAN and launch the backup.

[oracle@rene-ace-test-inst1 ~]$ mkdir -p /mnt/rman_vol1/backup
[oracle@rene-ace-test-inst1 ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Apr 19 19:03:35 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DBTEST (DBID=1462306895)
RMAN> configure channel device type disk format '/mnt/rman_vol1/backup/%d_%I_%s_%p.%T.bckp' ;
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/mnt/rman_vol1/backup/%d_%I_%s_%p.%T.bckp';
new RMAN configuration parameters are successfully stored
RMAN> backup database plus archivelog;
Starting backup at 19-APR-21 
current log archived
allocated channel: ORA_DISK_1 
... 
channel ORA_DISK_1: finished piece 1 at 19-APR-21 
piece handle=/mnt/rman_vol1/backup/DBTEST_1462306895_3_1.20210419.bckp tag=TAG20210419T190941 comment=NONE 
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 
Finished backup at 19-APR-21

Should a more persistent backup is needed with a higher SLA , the NFS mount could be synched to GCP Cloud Storage. The description of the GCP storage classes can be found here. This process needs to be done from the node that has the NFS mount, but first I need to make sure that I am logged in to G Cloud so that I can create the bucket.

[oracle@rene-ace-test-inst1 ~]$ gcloud init --console-only
Welcome! This command will take you through the configuration of G Cloud.
...
You must log in to continue. Would you like to log in (Y/n)? y
...
Go to the following link in your browser:
     https://accounts.google.com/o/oauth2/auth*****&access_type=offline
Enter verification code: 4/**********4Xp8IRDM
You are logged in as: [rene.antunez@*****.com].
Pick cloud project to use: 
   [1] eclipsys
   [2] Create a new project
Please enter numeric choice or text value (must exactly match list item):   1
Your current project has been set to: [eclipsys].
...

Now that I have logged on, I will proceed to create the bucket. I needed to make sure that the location parameter is set without specifying which zone, or else I received a 404 error.

[oracle@rene-ace-test-inst1 ~]$ gsutil mb -p eclipsys -c NEARLINE -l us-central1-c -b on gs://rman-bucket
Creating gs://rman-bucket/...
BadRequestException: 400 Invalid Value
[oracle@rene-ace-test-inst1 ~]$ gsutil mb -p eclipsys -c NEARLINE -l us-central1 -b on gs://rman-bucket
Creating gs://rman-bucket/...

To finish this process, I just do an rsync from my NFS to the GCP Bucket.

[oracle@rene-ace-test-inst1 ~]$ gsutil rsync gs://rman-bucket /mnt/rman_vol1

Building synchronization state...
Starting synchronization...

Once the rsync is complete, I can verify with the du and ls command of gsutil that the files exist in the bucket. 

[oracle@rene-ace-test-inst1 ~]$ gsutil du -s gs://rman-bucket
1503237784         gs://rman-bucket

[oracle@rene-ace-test-inst1 ~]$ for VARIABLE in $(gsutil ls | grep rman)
> do
> echo $(gsutil du $VARIABLE | grep -v /$ | wc -l) $VARIABLE
> done
3 gs://rman-bucket/

[oracle@rene-ace-test-inst1 ~]$ ls /mnt/rman_vol1/backup/ | wc -l
3

I hope this blog post helps you understand a little bit better how you can set up an NFS mount in GCP.

Share on:
Come work with the Best