Linux & windows 应用服务器&Oracle数据库服务器备份
Linux篇
tomcat启动加入开机启动项
vi /etc/rc.d/rc.local
service iptables stop
/usr/local/tomcat/bgyappserv01/bin/catalina.sh start
应用服务器重启:每天3点10分;
应用服务器备份:每周一4点10分
crontab -e
10 3 * * * reboot
10 4 * * 1 root run-parts /etc/cron.weekly
vi /etc/cron.weekly/jc6Backup
#!/bin/sh
mydate=`date +%Y%m%d`
tar czvf /root/tomcat/back/183tomcatJc6${mydate}.tar /usr/local/tomcat/bgyappserv01/webapps/jc6
find /root/tomcat/back/ -mtime +60 -name "*.*" -exec rm -rf {} \;
数据库服务器重启:每周六5点10分;
数据库服务器备份:每天3点5分
vi /etc/rc.d/rc.local
service iptables stop
crontab -e
5 3 * * * root run-parts /etc/cron.daily
10 5 * * 6 reboot
vi /etc/cron.daily/oracleBackup
#!/bin/sh
su - oracle
mydate=`date +%Y%m%d`
exp jc6/jc6@bgydb file=/home/oracle/backups/jc6jc6_184_${mydate}.dmp full=y log=/home/oracle/log/expLog${mydate}.txt
find /home/oracle/backups -mtime +30 -name "*.*" -exec rm -rf {} \;
find /home/oracle/log -mtime +30 -name "*.*" -exec rm -rf {} \;
chmod 777 /etc/cron.daily/oracleBackup
公文交换
vi /etc/cron.daily/oracleBackup
#!/bin/sh
su - oracle
mydate=`date +%Y%m%d`
exp edes/edes@edesdb file=/home/oracle/backups/edes_182_${mydate}.dmp full=y log=/home/oracle/log/expLog${mydate}.txt
find /home/oracle/backups -mtime +30 -name "*.*" -exec rm -rf {} \;
find /home/oracle/log -mtime +30 -name "*.*" -exec rm -rf {} \;
windows篇
应用服务器重启
每周六3点10分;start加入开机启动项
shutdown -r -c "weekly reboot"
tomcat备份
taskkill /f /im java.exe
set fname=%date:~0,4%%date:~5,2%%date:~8,2%
"E:\Program Files\WinRAR\WinRAR.exe" a -m5 E:\back\jc6\185WebappJc6%fname%.rar E:\tomcat\webapps\jc6
forfiles /p "e:\back\jc6" /s /m *.* /d -60 /c "cmd /c del @path"
e:
cd E:\tomcat\bin\
start startup.bat
pause
"E:\Program Files\WinRAR\WinRAR.exe" a -m5 E:\back\jc6\185WebappJc6%fname%.rar E:\tomcat\webapps\jc6
forfiles /p "e:\back\jc6" /s /m *.* /d -60 /c "cmd /c del @path"
e:
cd E:\tomcat\bin\
start startup.bat
pause
数据库备份备份
set mydate=%date:~0,4%%date:~5,2%%date:~8,2%
exp jc6/jc6@oadb file=e:\back\oracle\jc6jc6_AT_inside186_%mydate%.dmp full=y log=e:\log\expLog%mydate%
forfiles /p "e:\back\oracle" /s /m *.* /d -10 /c "cmd /c del @path"
forfiles /p "e:\log" /s /m *.* /d -10 /c "cmd /c del @path"
pause