Oracle tablespace created on a monthly basis

Source: Internet
Author: User
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 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.