zoukankan      html  css  js  c++  java
  • mysql 清理分区表

    mysql> alter table trends truncate partition p20150810;
    Query OK, 0 rows affected (0.37 sec)
    
    
    mysql>  select count(*) from trends partition(p20150810);
    +----------+
    | count(*) |
    +----------+
    |        0 |
    +----------+
    1 row in set (0.31 sec)
    
    
    
    
    oadb01:/home/oracle/mysql> cat t1.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 truncate partition p$date;"
          date2=`get_date $date +1`
          date=`echo $date2 | tr -d '-'`
          #echo $date3
    if [ "$date" = "$date_end" ]
           then
            exit
    fi
    done
    

  • 相关阅读:
    053-146
    053-659
    053-658
    053-657
    053-656
    053-654
    053-655
    053-652
    053-651
    053-650
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351354.html
Copyright © 2011-2022 走看看