db2定时任务备份脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了db2定时任务备份脚本相关的知识,希望对你有一定的参考价值。
[[email protected] ~]$ crontab -l
30 02 * * * /bin/sh /home/db2inst1/backup/backup.sh
[[email protected] ~]$ cat /home/db2inst1/backup/backup.sh
#!/bin/bash
bakdir=/home/db2inst1/backup
time1=`date +"%Y-%m-%d %H:%M:%S"`
cd $bakdir
echo $time1 >> $bakdir/backup.log
/home/db2inst1/sqllib/bin/db2 backup db devdb104 online
if [ $? -eq 0 ];then
time2=`date +"%Y-%m-%d %H:%M:%S"`
echo "the database backup is successfully completed at $time2" >> $bakdir/backup.log
else
echo "the database backup is failed" >> $bakdir/backup.log
fi
/bin/find /home/db2inst1/backup/ -type f -iname "devdb104.0.db2inst1.NODE0000.CATN0000*" -mtime +1 -exec rm -rf {} \;
本文出自 “arvin_0213” 博客,请务必保留此出处http://arvin0213.blog.51cto.com/2455782/1929593
以上是关于db2定时任务备份脚本的主要内容,如果未能解决你的问题,请参考以下文章