首页 > 数据库 > Oracle > 正文

调用linux日期函数,实现每天自动生成一个oracle备份

2024-08-29 13:43:38
字体:
来源:转载
供稿:网友

  要害是要在脚本中加入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变量

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表