Monday, February 11, 2019

RANGE - Interval Partitioning In Oracle

Range Interval Partitioning In Oracle

Interval Partitioning has been introduced in oracle 11g.
With this method, we can automate the creation of range partition .
While creating the partitioned table, we just need to define one partition.
New partitions will be created automatically based on interval criteria when the data is inserted to the table. We don’t need to create the future partitions.

1. Lets create a monthly partitioned table ( with interval).





Here the date 2016-05-01 is known as TRANSIT POINT . Any data inserted beyond this transit point will led to creation of a new partition automatically.

INTERVAL clause used to calculate the range for new partitions when the values go beyond the existing transition point



2. Now check dba_tab_partitions




3. Lets insert some data and check the dba_tab_partitions:




We can see a new monthly partition has been created automatically .

Similarly

for weekly partition use the parameter – INTERVAL (numtodsinterval(7,’day’))
for yearly partition use the parameter – INTERVAL (NUMTOYMINTERVAL(1,’YEAR’))



Convert Existing Range partitioned table to interval partition:



Restriction of Interval Partitioning:

1. Cannot be created for Index organized table(IOT)

2. The partitioning column can be only one and it must be of type NUMBER or DATE

3. Cannot use the MAXVALUE clause

No comments:

Post a Comment