#!/bin/bash
ORACLE_SID=ORCL;export ORACLE_SID
echo $ORACLE_SID
echo “Please Specify the kind of backup you want to take”
echo “1) COLD BACKUP”
echo “2) HOT BACKUP”
echo “3) EXPORT BACKUP”
echo “Enter your option”
read option
while [ $option -gt 3 ]||[ $option -le 0 ]
do
echo “Please Enter the correct option”
read option
done
case $option in
1|2) echo “You are taking rman backup of DB”
rman target sys/sys @/oracle/product/11g/rman_backup_$option.txt;exit;;
3) echo “You are taking export backup of DB”
exp system/sys file=/oracle/exp_dat.dmp log=/oracle/exp_dat.log full=y;
exit;;
esac
exit
The above script can call anyone of the following rman script depending upon the user who wants take cold or hot backup
The content of rman_backup_1.txt
run {
shutdown immediate;
startup mount;
allocate channel dup1 device type disk;
allocate channel dup2 device type disk;
backup format ‘/oracle/%U’ database;
release channel dup1;
release channel dup2;
alter database open;
}
The content of rman_backup_2.txt
run {
allocate channel dup1 device type disk;
allocate channel dup2 device type disk;
backup format ‘/oracle/%U’ database;
backup format ‘/oracle/arch_%U’ archivelog all;
backup format ‘/oracle/ctl_%U’ current controlfile;
release channel dup1;
release channel dup2;
}
Thank you
Osama mustafa
Hi Mustafa,Your articles are awesome. You are doing an excellent job.I would like to take daily backupseveryady and full backups during weekends.Could you please provide script to take those backups?Then I will see and palce that script in Crontab to automate backup jobs.Thanks,Tobi.
LikeLike
You can use the above scripts and configure them on crontab depend on what you want,
LikeLike