要害是要在脚本中加入Oracle的环境变量和在备份文件名中加入$DATE变量-bash-2.05b$ more /opt/oracle/prodUCt/movedata/movedata1.sh
ORACLE_HOME=/opt/oracle/product/9.0.2
eXPort ORACLE_HOME
. /opt/oracle/product/.bash_profile
export DATE=$(date +%Y%m%d) #调用Linux日期函数,实现文件按日期命名天天一个备份
/opt/oracle/product/9.0.2/bin/exp goldring/123456@szdb file=/data/OracleDB_Backup/goldring.dmp log=/data/OracleDB_Back
up/loggoldring.dmp consistent=yes
/opt/oracle/product/9.0.2/bin/exp jltgame/123456@szdb file=/data/OracleDB_Backup/jltgame$DATE.dmp log=/data/OracleDB_Ba
ckup/logjltgame.dmp consistent=yes
/opt/oracle/product/9.0.2/bin/exp userid=oraclebackup/"abcd456&*("@szdb owner=moonprincess file=/data/OracleDB_Backup/moon
princess.dmp log=/data/OracleDB_Backup/logmoonprincess.dmp consistent=yes
#FTP -n 10.0.0.3 < /opt/oracle/product/movedata/ftpcommand
把以上脚本放到crontab中即可
注:oracle实现自动备份要害是要在备份脚本中加入oracle的环境变量和在备份文件名中加入$DATE变量