linux exp 脚本

#!/bin/sh


export ORACLE_BASE=/u01
export ORACLE_HOME=$ORACLE_BASE/oracle
export ORACLE_SID=jisen
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
#define variable....
backup_date=`date +%Y%m%d`
bak_home=/u01
backup_dest=/backup/date
backup_log=/backup/log
RECIPT='[email protected]'


# Check local disk space..................................
USED=` df -k|grep $bak_home|awk '{print $5}'|awk -F% '{print $1}'`
if [ $USED -gt 85 ]; then
       echo "Disk space is full\243\254please check it"|mail -s "exp full backup failed"  $RECIPT
       exit 1
fi
#starting exp backup.....
exp system/ORAIDA 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 -mtime +7`
echo $list
rm -f $list
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

你可能感兴趣的:(oracle,linux)