In previous versions, move table could not be online, and move would lead to rowid changes to invalidate the corresponding index. ALTER TABLE move online in 12c will not block new transactions and will automatically maintain the validity of the index.
--Create an experiment table
Sql> CREATE TABLE Andy_move (ID int,name varchar2 (10));
Table created.
--Inserting data
Sql>
Begin
For I in 1.. The Loop
INSERT into andy_move values (i, ' andyi ');
End Loop;
Commit
End
/
PL/SQL procedure successfully completed.
--Create an index
Sql> CREATE index idx_andy_id on andy_move (ID);
Index created.
--View index status
Sql>
Col index_name for A25
Select Table_name,index_name,status,blevel,leaf_blocks,orphaned_entries from user_indexes where index_name = ' IDX_ Andy_id ';
table_name index_name STATUS blevel leaf_blocks ORP
------------------------- ------------------------- -------- ---------- ----------- ---
Andy_move idx_andy_id VALID 0 0 NO
--Move online non-partitioned table with online parameters
Sql> ALTER TABLE andy_move move online;
Table altered.
--View index status
Sql>
Col index_name for A25
Select Table_name,index_name,status,blevel,leaf_blocks,orphaned_entries from user_indexes where index_name = ' IDX_ Andy_id ';
table_name index_name STATUS blevel leaf_blocks ORP
------------------------- ------------------------- -------- ---------- ----------- ---
Andy_move idx_andy_id VALID 0 0 NO
--Move online partition table error
Sql> ALTER TABLE P_andy move online;
ALTER TABLE P_andy move online
*
ERROR at line 1:
Ora-14808:table does not support ONLINE MOVE table
--Move non-partitioned table, without online parameters
Delete from Andy_move where id>10 and id<20;
Sql> ALTER TABLE andy_move move;
Table altered.
--View index status
Sql>
Col index_name for A25
Select Table_name,index_name,status,blevel,leaf_blocks,orphaned_entries from user_indexes where index_name = ' IDX_ Andy_id ';
table_name index_name STATUS blevel leaf_blocks ORP
------------------------- ------------------------- -------- ---------- ----------- ---
Andy_move idx_andy_id unusable 0 1 NO
New features of Oracle 12C move (non-partitioned tables) Table online