DEV Community

oh_backup.sh - Oracle Home Backups for GI/RU

{ Abhilash Kumar Bhattaram : Follow on LinkedIn }

Oracle Home Backups - Why is it needed ?

  • As a part of pathcing Oracle DB / GI patches quarterly ( On Prem or OCI DB System or OCI EcaCS ) , a regular need to take a backup the Oracle Homes are needed as a best practice as mentioned in MOS Note : 565017.1

  • There needs to be a standard way these OH backups are taken so it is maintainable.

  • Repeatable use of OH backups using shell script capturing timestamp & IP of the nodes. If you are using multiple servers it becomes difficult to track which OH backup belongs to which server.

NOTE : Uncomment yne /u02 part of the script is you are using this for ExaCS

[root@oel8-lab01 ~]# nohup /u01/scripts/oh_backup.sh &
Enter fullscreen mode Exit fullscreen mode

Script reference

A easy to use script called oh_backup.sh
https://github.com/abhilash-8/ora-tools/blob/master/oh_backup.sh

[root@oel8-lab01 ~]# cat /u01/scripts/oh_backup.sh 
#-------------------------------------------------------------------------------------------------
#--Script Name   : oh_backup.sh
#--Description   : Script to take Oracle Home Backup with timestamp ( On Prem & OCI )
#--Args          : None
#--Author        : Abhilash Kumar Bhattaram
#--Email         : abhilash8@gmail.com                                           
#-------------------------------------------------------------------------------------------------
# Run as Root user (Doc ID 565017.1)
# Replace /u01 and /u02 as applicable in your relevant environments.
export NOW=$(date +"%Y_%m_%d_%H%M%S")
export ip=`hostname -i`
export host=`hostname`
df -h /u01
ls -l /u01

### Tar Backup For DB & GI Home in /u01
export bkp_dir=/nfs_backup/oh_backup
cd /u01
tar -pcvf ${bkp_dir}/u01appbkp_${host}_${ip}_${NOW}.tar app 

### Specific to ExaCS
### Tar Backup For DB Home in /u02 
# Uncomment this part as applicable 
# cd /u02
# tar -pcvf ${bkp_dir}/u01appbkp_${host}_${ip}_${NOW}.tar app 

Enter fullscreen mode Exit fullscreen mode

Top comments (0)