Oracle RAC 11g R2自动备份
[root@rac1 ~]# df -k
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sda5 56675736 15020976 38729328 28% /
/dev/sda2 49594228 12816756 34217516 28% /opt
/dev/sda1 101086 27988 67879 30% /boot
tmpfs 16213112 7980064 8233048 50% /dev/shm
none 16213112 104 16213008 1% /var/lib/xenstored
[root@rac1 ~]# more /home/oracle/phy_backup/backup.sh
su - oracle -c '/home/oracle/phy_backup/exp.sh'
[root@rac1 ~]# more /home/oracle/phy_backup/exp.sh
#!/bin/sh
#. /home/oracle/.bash_profile
#define variable......
backup_date=`date +%Y%m%d_%H%M%S`
bak_home=/dev/sda5
backup_dest=/home/oracle/phy_backup/data
backup_log=/home/oracle/phy_backup/log
#RECIPT='xx@xx.com'
# Check local disk space..................................
USED=` df -k|grep $bak_home|awk '{print $5}'|awk -F% '{print $1}'`
echo $USED
#if [ $USED -gt 85 ]; then
#echo "Disk space is full\243\254please check it"|mail -s "exp full backup fai
led" $RECIPT
#exit 1
#fi
#starting exp backup.....
exp system/lgws123 full=y buffer=65536 file=$backup_dest/data_$backup_date.dmp
log=$backup_log/data_$backup_date.log
# delete expired backup ...
list=` find $backup_dest -type f -mtime +30`
echo $list
if [ -n "$list" ]; then
rm -f $list
fi
#if [ $? -ne 0 ]; then
#cat $backup_log/data_$backup_date.log|mail -s "exp full backup failed,please
check it" $RECIPT
#exit 1
#fi
#cat $backup_log/data_$backup_date.log|mail -s "$backup_date exp log " $RECIPT
[root@rac1 ~]# crontab -e
0 0 * * * /home/oracle/phy_backup/backup.sh
0 12 * * * /home/oracle/phy_backup/backup.sh