开发者

How can I recreate a table as index-organized?

In an Oracle 10g database I would like recreate a table (maintaining all of its data) as an index-organize开发者_运维问答d. What is the easiest way to do this?


RENAME EXISTING_TABLE TO OLD_HEAP_TABLE;

CREATE TABLE NEW_IOT_TABLE AS
 ([COLUMNS FROM EXISTING TABLE]
  CONSTRAINT NEW_IOT_TABLE_PK PRIMARY KEY ([PK_COLUMNS FROM EXISTING TABLE]
 )
 ORGANIZATION INDEX;


INSERT INTO NEW_IOT_TABLE
SELECT * FROM OLD_HEAP_TABLE;

COMMIT;

RENAME NEW_IOT_TABLE TO EXISTING_TABLE;

-- DROP OLD_HEAP_TABLE when you're sure it all worked.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜