— 查看分区值
select TO_DAYS(‘2017-12-01’);

— MAXVALUE分区重建分区
ALTER TABLE tt_tableName
 REORGANIZE PARTITION p_catch_all INTO(
  PARTITION p201612 VALUES LESS THAN (TO_DAYS(‘2016-12-01’)),
  PARTITION p201701 VALUES LESS THAN (TO_DAYS(‘2017-01-01’)),
  PARTITION p201702 VALUES LESS THAN (TO_DAYS(‘2017-02-01’)),
  PARTITION p201703 VALUES LESS THAN (TO_DAYS(‘2017-03-01’)),
  PARTITION p201704 VALUES LESS THAN (TO_DAYS(‘2017-04-01’)),
  PARTITION p201705 VALUES LESS THAN (TO_DAYS(‘2017-05-01’)),
  PARTITION p201706 VALUES LESS THAN (TO_DAYS(‘2017-06-01’)),
  PARTITION p201707 VALUES LESS THAN (TO_DAYS(‘2017-07-01’)),
  PARTITION p201708 VALUES LESS THAN (TO_DAYS(‘2017-08-01’)),
  PARTITION p201709 VALUES LESS THAN (TO_DAYS(‘2017-09-01’)),
  PARTITION p201710 VALUES LESS THAN (TO_DAYS(‘2017-10-01’)),
  PARTITION p201711 VALUES LESS THAN (TO_DAYS(‘2017-11-01’)),
  PARTITION p201712 VALUES LESS THAN (TO_DAYS(‘2017-12-01’)),
 PARTITION p_catch_all VALUES LESS THAN MAXVALUE
 );

— 没有增加MAXVALUE分区的语句
ALTER TABLE tt_warehouse_order_rebate ADD PARTITION (PARTITION p201701 VALUES LESS THAN (TO_DAYS(‘2017-01-01’)));

ALTER TABLE tt_warehouse_order_rebate ADD PARTITION (PARTITION p_catch_all VALUES LESS THAN MAXVALUE);

–删除分区
alter table tr drop partition p2;

MYSQL的客户端sqlyog版本12-可以还原会话

MYSQL的客户端sqlyog版本-12 可以还原客户端回话,恢复上次的脚本。 以下链接版本为64位操作系统。 链接: https://pan.baidu.com/s/1smTgPxb 密码: z9mc ...

阅读全文

数据库流水号生成解决方案

1.表结构 Field Type Comment tm_sequence_id bigint(20) NOT NULL 主键id seq_name varchar(30) NULL 序列名称 current_value bigint(20) unsi...

阅读全文

MySql存储过程—游标(Cursor)

1、游标的作用及属性 游标的作用就是用于对查询数据库所返回的记录进行遍历,以便进行相应的操作;游标有下面这些属性:   a、游标是只读的,也就是不能...

阅读全文

欢迎留言