linux平台的oracle11201借用expdp定时备份数据库
备份脚本如下:
#!/bin/bash export ORACLE_BASE=/data/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=orcl export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH source ~/.bash_profile cd /disk01/db_back rm -f `date +%w`.dmp rm -f `date +%w`.log expdp \'sys/xxxxxx@orcl as sysdba\' directory=ora_back dumpfile=`date +%w`.dmp logfile=`date +%w`.log schemas=xxx,xxx123 |
crontab任务如下:
[oracle@ryanoracle scripts]$ crontab -l
* 4 * * 1,4 sh /home/oracle/scripts/expdp.sh ----即 每周1 、周4 凌晨4点执行备份脚本