Practical summary of partitions

1. Add partitions to the table

alter table table_name add 

    partition KE01 values  ('201912')   

    --You can also write partition KE01values ​​less than ('201912')

    --The difference is that your partition field has a time range and a value

    tablespace TS_DTL

    pctfree 10

    initrans 30

    maxtrans 255

    storage

    (

        initial 4M

        minextents 1

        maxextents unlimited

    );

2. Delete the partition

Delete all data and partitions delete all
ALTER TABLE table name DROP  PARTITION  partition name;
clear data only delete data
ALTER TABLE table name  TRUNCATE  PARTITION  partition name;

3. Specify the partition query

select * from table name partition (partition name);

4. Query which partitions a table has

select * from DBA_TAB_PARTITIONS T WHERE T.TABLE_OWNER='Table owner' AND T.TABLE_NAME='Table name';

Guess you like

Origin blog.csdn.net/ClearLoveQ/article/details/103512848