189 8069 5689

db2定时任务、备份脚本

[db2inst1@db2 ~]$ crontab -l

创新互联建站是一家专业提供耀州企业网站建设,专注与成都网站制作、做网站、外贸营销网站建设H5技术、小程序制作等业务。10年已为耀州众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

30 02 * * *  /bin/sh  /home/db2inst1/backup/backup.sh

[db2inst1@db2 ~]$ 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 {} \; 


本文标题:db2定时任务、备份脚本
网站网址:http://cdxtjz.cn/article/pjdjgj.html

其他资讯