zoukankan      html  css  js  c++  java
  • oracle交换分区方法以及注意事项

    1.查看该分区有无数据

    select /*+ parallel(a 16) */ count(1) from ZJ2_GRIDLEVSTA_cell_ALL_571 partition(SYS_P16805) a --where  a.p_day=to_date('20171231','yyyymmdd');

    2.如果分区表里有主键,自增列,删掉

    alter table zj2_gridlevsta_all_571 drop primary key;
    drop index PK_ZJ2_GRIDLEVSTA_ALL_571_OID;
    alter table ZJ2_GRIDLEVSTA_CELL_ALL_571 modify oid drop identity;
    

    3.创建表,保证索引,非空约束与分区表一致

    create table ZJ2_GRIDLEVSTA_cell_ALL_571_b as select * from ZJ2_GRIDLEVSTA_cell_ALL_571 where 1=2;
    alter table ZJ2_GRIDLEVSTA_CELL_ALL_571_b modify oid not null;
    create index b_ECI_INDEX on ZJ2_GRIDLEVSTA_CELL_ALL_571_b (ECI);
    

    4.分区表和非分区表 交换分区

    alter table ZJ2_GRIDLEVSTA_cell_ALL_571 exchange partition  SYS_P16805  with table ZJ2_GRIDLEVSTA_cell_ALL_571_b;

      

    注意:要交换的分区表中不能含有自增列,主键,否则可能无法交换分区

     select /*+ parallel(a 16) */ count(1) from 这种写法是可以多进程同时查看数据,效率要比普通查看效果快的多,但不可在程序中这样写,因为它会独占进程,多人同时查看的话会比普通方法还要慢。

  • 相关阅读:
    day35
    Audio Unit 基础
    Audio Unit 介绍
    音频PCM编码
    iOS libyuv
    FFmpeg AVPacket
    FFmpeg AVCodec
    FFmpeg编译iOS静态库
    iOS-Cocoapods更新不及时
    iOS-读取txt文件中文乱码
  • 原文地址:https://www.cnblogs.com/dushaojun/p/8319202.html
Copyright © 2011-2022 走看看