OCI – File storage snapshot management

OCI file storage snapshots are not managed automatically by OCI like block volumes backups are when using policy-managed backups.

Which means that you have to create and delete the snapshots by yourself.

On this blog post I will share a shell script to accomplish this task using oci cli.

Here is an example to create daily snapshots: fssnap.sh

# !/bin/bash
export CLI=/home/oracle/ocicli
export FSSOCID=<file storage ocid>
export TSTAMP=`date +%Y%m%d`
export ENV=prod

# create snap
$CLI/oci fs snapshot create --file-system-id=$FSSOCID --name=$ENV.$TSTAMP

You can get the file storage ocid at OCI console:

Create a user and group and assign the below policy to the group:

Allow group StorageAdmins to manage file-family in compartment PROD

Schedule this shell script to run on a regular internal that fits your needs.

But in my case I had to keep a limited amount of backups based on same information such as: environment (prod or dev) and customer retention policy (bronze, silver or gold).

So I wrote another simple shell to accomplish this: fscleanup.sh

!/bin/bash
export CI=/home/oracle/ocicli
export FSSOCID=<file storage ocid>
export TSTAMP=`date +%Y%m%d`
export KEEP=42

# dump backups to tempfile
$CI/oci fs snapshot list --file-system-id=$FSSOCID | grep '"id"' | awk '{print $2}' | sed 's/"//g' | sed 's/,//g' > /tmp/fss.bkp

#count
CT=`cat /tmp/fss.bkp | wc -l`

#remove backups older then $KEEP
if [ "$CT" -gt $KEEP ]; then
    DIFF=$(expr $CT - $KEEP)
    for id in `tail -$DIFF /tmp/fss.bkp`
    do
       $CI/oci fs snapshot delete --force --snapshot-id $id
    done
else
    echo "less then KEEP: $KEEP"
fi

Please check OCI doc about managing snapshots for more info.

Let’s wait for the OCI native and automated way for doing this but until then this is the workaround.

Oracle dNFS

Nesse post vou demonstrar como configurar o Oracle dNFS para acessar um NFS e subir seus bancos.

Sobre o meu ambiente:

HW: Cisco UCS

Sistema Operacional: Oracle Linux 6.9

Oracle: 12.1.0.2.170418

NAS: Netapp

Conectividade: 10G

Vamos ao que interessa 🙂

Pare o banco, ative o dNFS e inicie a instance novamente.

Ativando o dNFS:

$ cd $ORACLE_HOME/rdbms/lib

$ make -f ins_rdbms.mk dnfs_on

Procure no alert pela string: Oracle instance running with ODM: Oracle Direct NFS ODM Library Version 3.0.

Crie o(s) diretório(s) como ponto de montagem para o NFS:

Ex: mkdir –p /mnt/sha1

Configure o fstab e monte o NFS

ex: 172.24.4.14:/TI_PROT_DEV_01  /mnt/sha1  nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0

Traduzindo:

<NFS IP>:<device> <mount point> nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0

Para montar o NFS: mount /mnt/sha1

Pronto! Agora é só criar as tablespaces no NFS.

 

Links que recomendo a leitura para aprofundar o assunto:

Best Practices: How to Configure DNFS in Oracle Database (Doc ID 2246245.1)

Clone your dNFS Production Database for Testing (Doc ID 1210656.1)

DNFS Performance Monitoring (Doc ID 1556066.1)

How to configure DNFS to use multiple IPs (Doc ID 1552831.1)

https://bdrouvot.wordpress.com/2017/09/30/systemtap-and-oracle-rdbms-io-and-network-traffic/

https://kb.netapp.com/support/s/article/best-practices-to-configure-a-dnfs-client?language=en_US

https://martincarstenbach.wordpress.com/2014/07/09/setting-up-direct-nfs-on-oracle-12c/

https://docs.oracle.com/database/121/LADBI/post_inst_task.htm#LADBI5390