Wednesday, May 15, 2013

Drop and recreate partition


Drop partition

--Drop partition P1210
ALTER TABLE acc DROP PARTITION P1210;
--Rebuild global indexes
ALTER INDEX ACC_PK REBUILD;

Recreate dropped partition by splitting upper partition 

--Split upper partition of the dropped partition (P1211) into dropped partition(P1210) and upper partition(P1211)
ALTER TABLE acc SPLIT PARTITION P1211
AT (to_date('2012-11-01','yyyy-mm-dd'))
INTO (PARTITION P1210,PARTITION P1211);
--Rebuild  global indexes
ALTER INDEX ACC_PK REBUILD;
--Gather table statistics
exec dbms_stats.gather_table_stats('<schema_name>','ACC'');

No comments:

Post a Comment