linux备份脚本
文件夹备份
[test@app-server ~]$ cat /home/test/uploadbak.sh #!/bin/bash file_dir=/upload uploadbak_dir=/opt/uploadbak bak_file=upload_`date +%Y%m%d%H%M` # tar everyday #echo "begining of tar" tar -zcf $uploadbak_dir/$bak_file.gz $file_dir # clear bak_file #echo "clearing file.log" #find $uploadbak_dir -mtime +30 -exec rm -rf {} \; #end
数据库备份
[oracle@data-rac1 ~]$ cat /home/oracle/expdp_sql/expdp.sh #!/bin/bash export ORACLE_SID=test1 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$GRID_HOME/bin expdp \'\/ as sysdba\' DIRECTORY=DMPDIR DUMPFILE=full_data-rac1_test$(date +%Y%m%d%H%M).dmp LOG=full_data-rac1_test$(date +%Y%m%d%H%M).log SCHEMAS=test,test1,test2,test3,test4 #定期删除dmp文件 cd /u02/oracle_DB find -mtime +7 -name "full_data-rac1_test*" -exec rm -f {} \; # That's all
相关推荐
linuxwcj 2020-10-21
彼岸随笔 2020-10-20
yutou0 2020-10-17
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
以梦为马不负韶华 2020-10-20
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20