Vishal desai’s Oracle Blog

October 15, 2012

Exadata Compute node System Backup using LVM Snapshots

Filed under: Backup & Recovery, Exadata — vishaldesai @ 3:48 pm

Below is the sample shell script to backup compute nodes (system only) on Exadata. It’s not very dynamic so change tar location, snap volume names etc as per your environment.

#!/bin/ksh

SHOW_USAGE() {
   echo "Usage: lvmsnap_backup.sh <computenode> "
   exit 1
}


computenode=$1
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

#Create snapshot
lvcreate -L2G -s -n root_snap /dev/VGExaDb/LVDbSys1
lvcreate -L10G -s -n u01_snap /dev/VGExaDb/LVDbOra1

#Mount Snap volumes
mkdir /mnt/snap
mkdir /mnt/snap/root
mkdir /mnt/snap/u01
mount /dev/VGExaDb/root_snap /mnt/snap/root
mount /dev/VGExaDb/u01_snap /mnt/snap/u01

#Backup Snapshots
cd /zfs/fhrestore01/restore01
tar -pjcvf /zfs/fhrestore01/restore01/${computenode}_system_backup_$(date +%m%d%y).tar.bz2 /mnt/snap/* /boot --exclude /zfs/fhrestore01/restore01/${computenode}_system_backup_$(date +%m%d%y).tar.bz2 >/zfs/fhrestore01/restore01/${computenode}_system_backup_$(date +%m%d%y).stdout 2> /zfs/fhrestore01/restore01/${computenode}_system_backup_$(date +%m%d%y).stderr



#Unmount and drop temporary partition
umount /mnt/snap/u01
rmdir  /mnt/snap/u01
umount /mnt/snap/root
rmdir  /mnt/snap/root
lvremove -f /dev/VGExaDb/root_snap
lvremove -f /dev/VGExaDb/u01_snap
rmdir /mnt/snap

Advertisements

Create a free website or blog at WordPress.com.