Oracle 11G Interval Partitioning

Source: Internet
Author: User
Tags call shell

In the project database design process, because the data volume of the single table is very large, the table needs to be partitioned. Because the data in the table is a historical transaction, it is partitioned by month to improve the query and management.

Since we didn't know much about table partitioning before, in order to achieve the above features, we looked at a lot of information, the first direction was to automatically create partitions by month by crontab call shell scripts, or use Oracle's job call stored procedures to automatically create partitions. In the process of studying the two sets of scenarios, it is not possible to discover that oracle11g has an interval partition function, and for a range partition, you can automatically generate partitions by year, month, and days. The syntax is as follows:

[SQL]View Plaincopy
    1. creat TABLE TABLE1
    2. (
    3. TABLE_ID Number (8),
    4. Sub_date DATE,
    5. VALUE Number (8)
    6. )
    7. PARTITION by RANGE (sub_date)
    8. INTERVAL (Numtoyminterval (1,' MONTH '))
    9. (
    10. PARTITION P1 VALUES less THAN (to_date (' 2014-05-01 ',' yyyy-mm-dd ')
    11. );


Data before May 1, 2014 will be placed in the P1 partition, and data from May 1 will automatically create a partition as soon as data is available.

Oracle 11G interval partition

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.