Oracle 11g CREATE TABLE partitions on a monthly basis through interval partitioning ____oracle

Source: Internet
Author: User
Tags call shell

In the project database design process, because of the large amount of data in the single table, we need to partition the table. Because the data in the table is a historical transaction, it is divided by month to improve the query and management.

Because of the lack of understanding of the table partition before, in order to achieve the above function to check a lot of data, the first direction is through the crontab call Shell script automatically create partitions on a monthly basis, or use the Oracle job call stored procedures to automatically create partitions. In the study of the above two sets of scenarios, there is no intention to find oracle11g partition function, for use range partition can be year, month, days automatically generate partitions. The syntax is as follows:

creat TABLE TABLE1
(
   table_id Number (8),
   sub_date DATE,
   VALUE number (8)

)
PARTITION by RANGE ( sub_date)
INTERVAL (numtoyminterval (1, ' MONTH '))
(PARTITION
  P1 VALUES less THAN (' 2014-05-01 ', ' Yyyy-mm-dd '))
;


Data prior to May 1, 2014 is placed in the P1 partition, and the data for the month after May 1 will automatically create a partition whenever there is data.

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.