zoukankan      html  css  js  c++  java
  • oracle分区

    createTABLE TABLE1

    (

    TABLE_ID NUMBER(8),

    SUB_DATE DATE,

    VALUENUMBER(8)

     

    )

    PARTITIONBYRANGE(SUB_DATE)

    INTERVAL(NUMTOYMINTERVAL(1'MONTH'))

    (

    PARTITION P1 VALUESLESSTHAN(TO_DATE('2014-05-01','YYYY-MM-DD'))

    );



    201451日前的数据会放入p1分区,51日后的数据每月只要有数据,就会自动创建一个分区。

    INTERVAL (numtodsinterval(1,'DAY'))按天分区


    ------------------------------------打卡记录表分区

    createtable TB_GJ_CARDRECORD

    (

    c_oid_cardrecord NUMBER(19) notnull,

    c_empid NUMBERnotnull,

    c_kqdatetime DATE,

    c_kqtime VARCHAR2(64),

    c_datatypeid NUMBER,

    c_oprtid NUMBER,

    c_iskoukuan VARCHAR2(64),

    c_remark VARCHAR2(512),

    c_resultmark VARCHAR2(512),

    c_ismodified VARCHAR2(64),

    c_devid NUMBER,

    c_hardwarerecordid NUMBER,

    c_recid NUMBER

    )

    partitionbyrange (C_KQDATETIME)

    INTERVAL(NUMTOYMINTERVAL(1'MONTH'))

    (

    PARTITION P1 VALUESLESSTHAN(TO_DATE('2014-05-01','YYYY-MM-DD'))

    tablespace IC_MIDEA

    pctfree10

    initrans1

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    )

    );

    -- Add comments to the table

    commentontable TB_GJ_CARDRECORD

    is'打卡明细表';

    -- Add comments to the columns

    commentoncolumn TB_GJ_CARDRECORD.c_oid_cardrecord

    is'记录号

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_empid

    is'人员ID

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_kqdatetime

    is'考勤日期

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_kqtime

    is'考勤时间 ';

    commentoncolumn TB_GJ_CARDRECORD.c_datatypeid

    is'数据类型1:正常刷卡(缺省)2:手工签卡

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_oprtid

    is'操作员

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_iskoukuan

    is'是否扣款

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_remark

    is'备注

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_resultmark

    is'结果标记

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_ismodified

    is'是否修改

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_devid

    is'设备ID

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_hardwarerecordid

    is'卡机记录ID

    ';

    commentoncolumn TB_GJ_CARDRECORD.c_recid

    is'原记录ID

    ';

    -- Create/Recreate primary, unique and foreign key constraints

    altertable TB_GJ_CARDRECORD

    addconstraint PK_TB_GJ_CARDRECORD_OID primarykey (C_OID_CARDRECORD)

    usingindex

    tablespace IC_MIDEA

    pctfree10

    initrans2

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    );

    -- Create/Recreate indexes

    createindex PK_C_EMPID on TB_GJ_CARDRECORD (C_EMPID)

    tablespace IC_MIDEA

    pctfree10

    initrans2

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    );

    createindex PK_C_KQDATETIME on TB_GJ_CARDRECORD (C_KQDATETIME)

    tablespace IC_MIDEA

    pctfree10

    initrans2

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    );

    createindex PK_C_KQTIME on TB_GJ_CARDRECORD (C_KQTIME)

    tablespace IC_MIDEA

    pctfree10

    initrans2

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    );

    createindex PK_EMPID_KQDATETIME on TB_GJ_CARDRECORD (C_EMPID, C_KQDATETIME)

    tablespace IC_MIDEA

    pctfree10

    initrans2

    maxtrans255

    storage

    (

    initial64K

    next1M

    minextents1

    maxextentsunlimited

    );




    删除分区表中的分区

    alter table tablename  drop partition partname;


    alter table tb_gj_cardrecord drop partition SYS_P81;

  • 相关阅读:
    vue项目搭建步骤
    文件的操作总结
    WPF 使用皮肤影响按钮自定义
    WPF中:未找到可以 register Name“XXX”的 NameScope
    WPF Label或者其他控件(以Content显示内容的)单个下划线不显示的问题。
    wpf 中GridControl后面总是多一空白列
    WPF设置控件层次问题(最顶层,最底层)
    WPF中设置TreeView的高度随着窗口改变
    C# 检测文件是否被其他进程占用
    XML文件的操作
  • 原文地址:https://www.cnblogs.com/it38/p/5010640.html
Copyright © 2011-2022 走看看