mysql 批量删除分区

alter table titles drop partition p01;

use zabbix;
mysql> source drop_par.sql

[oracle@oadb mysql]$ cat drop_par.sh 
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
date=`echo $1 | tr -d '-'`
date1=`echo $2 | tr -d '-'`
date2=`echo $1`
date_end=`get_date $2 +1 | tr -d '-'`
while :
    do
      date3=`get_date $date +1`
     var=`date -d "$date3" +%s`
     echo "alter table trends drop partition p$date;"
      date2=`get_date $date +1`
      date=`echo $date2 | tr -d '-'`
      #echo $date3
if [ "$date" = "$date_end" ]
       then
        exit
fi
done

posted @ 2016-03-30 09:40  czcb  阅读(641)  评论(0编辑  收藏  举报