1.编写导出数据所需script
vi expdp_auto_backup.sh
#!/bin/sh
#create date:2008/05/30
#function:using data pump backup databae
export ORACLE_SID=dbtest
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=.:$ORACLE_HOME/bin:$PATH:.
action_time=`date +%Y_%m_%d`
echo action time:$action_time
filename=expdp_dbtest_$action_time.dmp
logname=expdp_dbtest_$action_time.log
expdp system/sysoak content=all schemas=swr directory=dump dumpfile=$filename logfile=$logname
cd /u09/orabackup/dbtest/dump/dumpfile/ #directory :dump OS location
tar -czvf expdp_dbtest_$action_time.tar.gz $filename $logname
rm $filename
rm $logname
2. 添加到例行性任务crontab
crontab -e
#function: backup
25 20 * * * /home/oracle/expdp_auto_backup.sh > /home/oracle/log/export.log 2>&1
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7419833/viewspace-324490/ ,如需转载,请注明出处,否则将追究法律责任。