-
[oracle@yhbd08 scripts]$ crontab -l |tail -3
-
#每天expdp备份数据库,Add by fjzcau 2015-12-22
-
10 15 * * * /yohodata/fjzcau/scripts/yhbd08_orcl_expdp.sh > /dev/null 2>&1
-
#---------------------------------------------------------------------------#
-
# Scripts : /yohodata/fjzcau/scripts/yhbd08_orcl_expdp.sh
-
# Author : fangjz/
-
# Date : 2015/12/22
-
# Purpose : Expdp Oracle data
-
# Notes : This script can be run in crontab or in other shell script.
-
# Parameters :
-
#---------------------------------------------------------------------------#
-
-
# Oracle Env
-
if [ -f /home/oracle/.bash_profile ]
-
then
-
. /home/oracle/.bash_profile
-
fi
-
-
bakdate=`date '+%Y%m%d%H'`
-
cd /yohodata/expdp_orcl
-
-
i_pre="`hostname`_orcl"
-
-
log=${i_pre}_${bakdate}.log
-
-
file1=${i_pre}_${bakdate}_expdp_01.dmp
-
file2=${i_pre}_${bakdate}_expdp_02.dmp
-
file3=${i_pre}_${bakdate}_expdp_03.dmp
-
file4=${i_pre}_${bakdate}_expdp_04.dmp
-
-
expdp system/Yoho_bi123 directory=expdp_orcl parallel=4 full=y \
-
dumpfile=$file1,$file2,$file3,$file4 logfile=$log
-
-
#version=10
-
-
nohup gzip $file1 &
-
nohup gzip $file2 &
-
nohup gzip $file3 &
-
nohup gzip $file4 &
-
-
sleep 5
-
-
now_time=`date +"%Y%m%d %H:%M:%S"`
-
echo "-->$now_time gzip ${i_pre} start ..." >> $log
-
-
i_cnt=0
-
while [ 1 = 1 ]
-
do
-
i_gzip_count=`ps -ef | grep gzip | grep -v grep | grep ${i_pre}_${bakdate}_expdp |wc -l`
-
-
if [ ${i_gzip_count} -eq 0 ]
-
then
-
now_time=`date +"%Y%m%d %H:%M:%S"`
-
echo "-->$now_time gzip ${i_pre} ok!" >> $log
-
break
-
fi
-
i_cnt=`expr $i_cnt + 1`
-
echo " ${i_cnt}:${i_gzip_count} gzip process running,sleep 60 seconds..." >> $log
-
sleep 60
-
done
-
-
now_time=`date +"%Y%m%d %H:%M:%S"`
-
echo "-->$now_time gzip ${i_pre} end ." >> $log
-
-
#ftp -i -n 123.57.245.98 <<!
-
#user u1 u1
-
#bin
-
#put $file1.gz
-
#put $log
-
#put $0
-
#by
-
#!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22661144/viewspace-1876876/
,如需转载,请注明出处,否则将追究法律责任。