Oracle expdp 脚本


  1. [oracle@yhbd08 scripts]$ crontab -l |tail -3
  2. #每天expdp备份数据库,Add by fjzcau 2015-12-22
  3. 10 15 * * * /yohodata/fjzcau/scripts/yhbd08_orcl_expdp.sh > /dev/null 2>&1

  1. #---------------------------------------------------------------------------#
  2. # Scripts : /yohodata/fjzcau/scripts/yhbd08_orcl_expdp.sh
  3. # Author : fangjz/
  4. # Date : 2015/12/22
  5. # Purpose : Expdp Oracle data
  6. # Notes : This script can be run in crontab or in other shell script.
  7. # Parameters :
  8. #---------------------------------------------------------------------------#

  9. # Oracle Env
  10. if [ -f /home/oracle/.bash_profile ]
  11. then
  12.    . /home/oracle/.bash_profile
  13. fi

  14. bakdate=`date '+%Y%m%d%H'`
  15. cd /yohodata/expdp_orcl

  16. i_pre="`hostname`_orcl"

  17. log=${i_pre}_${bakdate}.log

  18. file1=${i_pre}_${bakdate}_expdp_01.dmp
  19. file2=${i_pre}_${bakdate}_expdp_02.dmp
  20. file3=${i_pre}_${bakdate}_expdp_03.dmp
  21. file4=${i_pre}_${bakdate}_expdp_04.dmp

  22. expdp system/Yoho_bi123 directory=expdp_orcl parallel=4 full=y \
  23. dumpfile=$file1,$file2,$file3,$file4 logfile=$log

  24. #version=10

  25. nohup gzip $file1 &
  26. nohup gzip $file2 &
  27. nohup gzip $file3 &
  28. nohup gzip $file4 &

  29. sleep 5

  30. now_time=`date +"%Y%m%d %H:%M:%S"`
  31. echo "-->$now_time gzip ${i_pre} start ..." >> $log

  32. i_cnt=0
  33. while [ 1 = 1 ]
  34. do
  35.   i_gzip_count=`ps -ef | grep gzip | grep -v grep | grep ${i_pre}_${bakdate}_expdp |wc -l`

  36.   if [ ${i_gzip_count} -eq 0 ]
  37.   then
  38.     now_time=`date +"%Y%m%d %H:%M:%S"`
  39.     echo "-->$now_time gzip ${i_pre} ok!" >> $log
  40.     break
  41.   fi
  42.   i_cnt=`expr $i_cnt + 1`
  43.   echo " ${i_cnt}:${i_gzip_count} gzip process running,sleep 60 seconds..." >> $log
  44.   sleep 60
  45. done

  46. now_time=`date +"%Y%m%d %H:%M:%S"`
  47. echo "-->$now_time gzip ${i_pre} end ." >> $log

  48. #ftp -i -n 123.57.245.98 <<!
  49. #user u1 u1
  50. #bin
  51. #put $file1.gz
  52. #put $log
  53. #put $0
  54. #by
  55. #!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22661144/viewspace-1876876/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22661144/viewspace-1876876/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值