How do I alter my existing table to create a range partition in Oracle

后端 未结 2 1694
滥情空心
滥情空心 2021-01-02 09:58

I have existing table which has 10 years of data (I have taken dump).

I would like to Range partition the existing table on one date key column within the table.

2条回答
  •  北海茫月
    2021-01-02 10:38

    Beacuse your table non-partitioned you have two options:

    1. Export data, drop table, create new patitioned table, import data.
    2. Use split then exchange partition method. https://oracle-base.com/articles/misc/partitioning-an-existing-table-using-exchange-partition

    Also, if you want new partition per month read about SET INTERVAL. For example:

    CREATE TABLE tst
       (col_date DATE)
     PARTITION BY RANGE (col_date) INTERVAL (NUMTOYMINTERVAL(1, 'MONTH'))
    (PARTITION col_date_min VALUES LESS THAN (TO_DATE('2010-01-01', 'YYYY-MM-DD')));
    

提交回复
热议问题