# Copyright(c) 2012 Swsport Co.,Ltd.
# All Rights Reserved
source ~/.bash_profile ---导入oracle用户配置文件
DAY=`date +%m_%d` ----设置日期格式为月_日
FILE_TARGET=expdp_$DAY.dmp ---设置dmp文件名格式
FILE_LOG=expdp_$DAY.log ----设置log文件名格式
export FILE_TARGET ---导入设置
export FILE_LOG ---导入设置
echo "Begin backup database by expdp at Time:"`date`
expdp system/xxxxx directory=DUMP_DIR1 dumpfile=$FILE_TARGET schemas=simpreal logfile=$FILE_LOG job_name=cases_export parallel=4 --并行度4
echo "Export mission over at Time:"`date`
echo "Delete 1 month ago Export File"
DAYDEL=`date -d "1 month ago" +%m_%d` --设置一月前的日期
FILE_DEL=expdp_$DAYDEL.dmp
LOG_DEL=expdp_$DAYDEL.log
rm -f $FILE_DEL $LOG_DEL --强制删除一个月前的DUMP和LOG
echo "ALL WORKS COMPLETE! GOOD LUCK!"