-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变量
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变量