Create Table ad_play_log_tmp
(
Ad_play_log_id number (10) Not null,
Play_date date,
Add_time date
)
Partition by range (play_date)
(Partition ad_play_log201101
Values less than (to_date ('2017-01-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201102
Values less than (to_date ('2017-02-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201103
Values less than (to_date ('2017-03-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201104
Values less than (to_date ('2017-04-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201105
Values less than (to_date ('2017-05-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201106
Values less than (to_date ('2017-06-01 ', 'yyyy-mm-dd '))
Tablespace iimobadp,
Partition ad_play_log201107
Values less than (to_date ('2017-07-01 ', 'yyyy-mm-dd '))
Tablespace iimobadp,
Partition ad_play_log201108
Values less than (to_date ('2017-08-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201109
Values less than (to_date ('2017-09-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201110
Values less than (to_date ('2017-10-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201111
Values less than (to_date ('2017-11-01 ', 'yyyy-mm-dd '))
Tablespace T1,
Partition ad_play_log201112
Values less than (to_date ('2017-12-01 ', 'yyyy-mm-dd '))
Tablespace T1 );
Insert into ad_play_log_tmp select * From ad_play_log;
Drop table ad_play_log;
Rename ad_play_log_tmp to ad_play_log;
-- Last executed
Alter table ad_play_log
Add constraint pk_ad_play_log primary key (ad_play_log_id );