create table t1 as select sysdate dt,all_objects.* from all_objects;
create table t2 as select add_months(sysdate,-24) dt, all_objects.* from all_objects;
create table t( dt, OWNER, OBJECT_NAME, SUBOBJECT_NAME,
OBJECT_ID, DATA_OBJECT_ID, OBJECT_TYPE, CREATED,
LAST_DDL_TIME, TIMESTAMP, STATUS, TEMPORARY,
GENERATED, SECONDARY )
partition by range(dt) (
partition part2003 values less than ( to_date( '01-jan-2006',
'dd-mon-yyyy') ),
partition part2004 values less than ( to_date( '01-jan-2007',
'dd-mon-yyyy') ),
partition part2005 values less than ( to_date( '01-jan-2008',
'dd-mon-yyyy') )
)
as
select sysdate dt, all_objects.* from all_objects where 1=0;
alter table t
exchange partition part2003
with table t2 ;
create table t2 as select add_months(sysdate,-24) dt, all_objects.* from all_objects;
create table t( dt, OWNER, OBJECT_NAME, SUBOBJECT_NAME,
OBJECT_ID, DATA_OBJECT_ID, OBJECT_TYPE, CREATED,
LAST_DDL_TIME, TIMESTAMP, STATUS, TEMPORARY,
GENERATED, SECONDARY )
partition by range(dt) (
partition part2003 values less than ( to_date( '01-jan-2006',
'dd-mon-yyyy') ),
partition part2004 values less than ( to_date( '01-jan-2007',
'dd-mon-yyyy') ),
partition part2005 values less than ( to_date( '01-jan-2008',
'dd-mon-yyyy') )
)
as
select sysdate dt, all_objects.* from all_objects where 1=0;
alter table t
exchange partition part2003
with table t2 ;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-392/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7199859/viewspace-392/