您好,登录后才能下订单哦!
1.引用设置环境变量
2.记录执行时间和用户
3.删除旧备份
4.数据泵抽取备份
5.压缩备份
6.删除压缩前的文件
#!/bin/sh
. /etc/profile
source ~/.bash_profile
ORACLE_BASE=/data/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
PATH=/data/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/local/bin:/usr/ccs/bin:$PATH:/usr/sbin
export PATH
echo $PATH
date>>/data/u01/app/oracle/exp/zktime10backrun.log
whoami >>/data/u01/app/oracle/exp/zktime10backrun.log
find /data/u01/app/oracle/exp -mtime +5 -name "bak_expdp*.zip" |xargs rm -rf
dmpfile=bakexpdp$(date +%Y%m%d).dmp
logfile=bakexpdp$(date +%Y%m%d).log
zipfile=zktime10bakexpdp$(date +%Y%m%d).zip
expdp user/passwd@127.0.0.1/zktime directory=data_dir dumpfile=$dmpfile full=y log=$logfile;
zip "/data/u01/app/oracle/exp/$zipfile" "/data/u01/app/oracle/exp/$dmpfile" "/data/u01/app/oracle/exp/$logfile"
rm -rf /data/u01/app/oracle/exp/$dmpfile
rm -rf /data/u01/app/oracle/exp/$logfile
~
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。