In an Oracle 10g database I would like recreate a table (maintaining all of its data) as an index-organized. 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.