1、将如下代码添加到linux系统下oracle的安装目录:
#!/bin/sh
export ORACLE_BASE=/opt/ora9/product
export ORACLE_HOME=/opt/ora9/product/oracle
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_SID=NTDB
export ORACLE_OWNER=oracle
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/ora9/product/oracle/bin:$LD_LIBRARY_PATH
export PATH=/opt/ora9/product/oracle/bin:$PATH
export NLS_LANG=american_america.ZHS16GBK
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
a=$(date +"%Y%m%d")
b=$(date -d "3 days ago" +"%Y%m%d")
cd /
cd /opt/back_oracle
rm -rf $b.log
rm -rf $b.dmp
rm -rf $b.tar.gz
exp system/systemdba full=y file=/opt/back_oracle/$a.dmp log=/opt/back_oracle/$a.log
tar -czvf $a.tar.gz $a.dmp
rm -rf $a.dmp
2、调用了linux系统的计划任务crontab,采用crontab编制计划任务,再自动执行:
20 22 * * * /opt/ora9/product/oracle/bin/./backraid.sh,指定自动执行的时间就OK了。