How to add interval partitions to an existing table in Oracle

夙愿已清 提交于 2019-12-04 22:48:57

You cannot partition an existing non-partitioned table.

In general, you'll need to create a new partitioned table, move the data from the existing table to the new table (probably using a direct-path insert with parallel DML), drop the old table, and rename the new table to use the old name. You can do that manually. Or you could use the dbms_redefinition package to manage these steps-- that will likely be less efficient but it would allow you to do this without an outage window.

As discussed above, we cannot partition an existing non-partitioned table directly using an alter command (Oracle 11g and below).

1) Create new Table "RSST_TP_ORDERINVOICED_NETREV_F_TEMP" with partitions (with similar structure).

2) Insert whole data from RSST_TP_ORDERINVOICED_NETREV_F to RSST_TP_ORDERINVOICED_NETREV_F_TEMP

Use: INSERT /*+ append */ INTO RSST_TP_ORDERINVOICED_NETREV_F_TEMP AS SELECT * FROM RSST_TP_ORDERINVOICED_NETREV_F; or Bulk Collect

3) Take back up scripts for creating indexes,constraints,grants,triggers.

4) Drop table RSST_TP_ORDERINVOICED_NETREV_F.

5) Rename table RSST_TP_ORDERINVOICED_NETREV_F_TEMP to RSST_TP_ORDERINVOICED_NETREV_F.

6) Re-create all corresponding indexes,constraints(Primary key, Foreign),grants, triggers.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!