我把备份oracle以及上传备份服务器的脚本贴出来给你们做一下参考。
[root@master ~]-cat expDB_DailyBackup.sh
#---------------------------Set Parameter----------------------------------------
ENVFILE="/etc/profile"
EXITCODE=0
uDate=`date +'%Y%m%d'`
Week=`date +'%a'`
dbBackup=/home/app/backup/db_Daily
tarName=app_${uDate}_DB_DailyBk.tar.gz
#---------------------------Exit Program----------------------------------------
exit_handler()
{
exit $EXITCODE
}
#---------------------------Load the environment file----------------------------------------
if [ -r "$ENVFILE" ]
then
source $ENVFILE
else
EXITCODE=-1
exit_handler
fi
#---------------------------Backup Application To Directory----------------------------------------
cd $dbBackup
# Export Database To File
exp app_admin/app_admin file=app_${uDate}_DB_DailyBk.dmp
#---------------------------Send The File To Remote Host----------------------------------------
cd $dbBackup
tar -zcvf $tarName app_${uDate}_DB_DailyBk.dmp
# Rename Backup For Remote Host
cp $tarName app_${Week}_DB_DailyBk.tar.gz
lftp << EOF
open sftp://10.0.0.18:1022
user backup backup!@#
cd db_Daily
put app_${Week}_DB_DailyBk.tar.gz
exit
EOF
# Delete Rename Backup
rm -f app_${Week}_DB_DailyBk.tar.gz
rm -f app_${uDate}_DB_DailyBk.dmp
# Exit Shell Script
exit_handler
crontab设置定时任务,每天23:55分开始备份。
# app Daily Backup
55 23 * * * sh /home/app/bin/expDB_DailyBackup.sh
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。