定期备份数据库数据

时间:2022-09-13 23:40:51

场景:整库备份,用exp方式,按周循环,备份文件存在oracle下的db_backup目录,周一备份到成dbbackup_1.dmp,周二:dbbackup_2.dmp,周三:dbbackup_3.dmp,周四:dbbackup_4.dmp,周五:dbbackup_5.dmp,周六:dbbackup_6.dmp,周日:dbbackup_7.dmp,并且循环覆盖,服务器上只存7个备份文件 

shell脚本:dbback.sh

 

#!/bin/sh

day
=`date +%w`
if [ ${day} == "0" ]; then
day
="7"
fi
bakfile
=/home/oracle/db_backup/dbbackup_${day}.dmp

exp userid
=system/manager file=${bakfile} full=yes