oracle 定时备份脚本
#!/bin/sh export ORACLE_BASE=/data/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0 export ORCLE_SID=orcl export LD_LIBRARY_PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 # rq=$(date +%Y%m%d%H%M) /data/app/oracle/product/11.2.0/bin/exp yo_online/yo_online123@orcl owner=yo_online rows=y indexes=n compress=y file=/data/orabak/oracleBack_$rq.dmp log=/data/orabak/oracleBack_$rq.log # chmod 755 /data/orabak/oracleBack_$rq.dmp chmod 755 /data/orabak/oracleBack_$rq.log # oradatabak=oracleBack_$rq.tar.gz dmpbak=oracleBack_$rq.dmp logbak=oracleBack_$rq.log days=3 tar -zcvPf /data/orabak/$oradatabak /data/orabak/oracleBack_$rq.dmp /data/orabak/oracleBack_$rq.log find "/data/orabak" -type f -name "*.dmp" -mtime +$days -exec rm {} \; find "/data/orabak" -type f -name "*.log" -mtime +$days -exec rm {} \; find "/data/orabak" -type f -name "*.tar.gz" -mtime +$days -exec rm -rf {} \;
一定要赋予root权限
原文链接:https://www.f2er.com/oracle/212456.html