linux oracle 自动备份脚本 保存一周
2014-12-05 17:24
381 查看
1、备份脚本:
2、添加到任务调度crontab -u oracle -e
* 3 * * * /home/bakup/bakup.sh
即每天凌晨3点进行备份
如需每天备份多次,可设置不同时间段备份:
例如:* 3,13,18 * * * /home/bakup/bakup.sh,即每天3点、13点、18点进行备份。
说明:文件备份目录,用户oracle必须有更改权限,否则无法备份。
#!/bin/sh export ORACLE_BASE=/home/oracle export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 export ORACLE_SID=orcl export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export DATA_DIR=/home/bakup/data export LOGS_DIR=/home/bakup/logs export DELTIME=`date -d "7 days ago" +%Y%m%d` export BAKUPTIME=`date +%Y%m%d%H%M%S` mkdir -p $DATA_DIR mkdir -p $LOGS_DIR echo "Starting bakup..." echo "Bakup file path $DATA_DIR/$BAKUPTIME.dmp" exp shop/lyisABC0987@orcl file=$DATA_DIR/$BAKUPTIME.dmp log=$LOGS_DIR/$BAKUPTIME.log echo "Delete the file bakup before 7 days..." rm -rf $DATA_DIR/$DELTIME*.dmp rm -rf $LOGS_DIR/$DELTIME*.log echo "Delete the file bakup successfully. " echo "Bakup completed."
2、添加到任务调度crontab -u oracle -e
* 3 * * * /home/bakup/bakup.sh
即每天凌晨3点进行备份
如需每天备份多次,可设置不同时间段备份:
例如:* 3,13,18 * * * /home/bakup/bakup.sh,即每天3点、13点、18点进行备份。
说明:文件备份目录,用户oracle必须有更改权限,否则无法备份。
相关文章推荐
- Oracle自动备份脚本(Linux)
- ORACLE自动备份并且自动FTP到备份机的SHELL脚本(http://doc.linuxpk.com/456.html)
- Linux下Oracle自动备份脚本
- Linux下 Oracle自动备份脚本及其运行设置
- linux oracle自动备份 脚本
- linux oracle自动备份脚本
- linux如何开启oracle自动备份的脚本
- linux oracle自动备份脚本
- Linux Oracle DB 自动备份shell脚本
- linux 下的 oracle 自动备份脚本
- Linux下Oracle自动备份脚本
- ORACLE自动备份并且自动FTP到备份机的SHELL脚本(http://doc.linuxpk.com/456.html)
- linux下Oracle自动备份数据库脚本(归档模式)
- linux下oracle自动备份脚本
- linux oracle自动备份脚本
- LINUX下Oracle库备份脚本
- linux下mysql自动备份脚本代码
- Linux 下通过脚本实现远程自动备份
- 在linux下用脚本自动备份domino和WebSphere Portal
- Linux下Oracle文件的自动备份与ftp自动上传