简体   繁体   中英

Can we change the interval for a partition?

I have a table partitioned by range with an interval. Then I have a partition with this configuration:

PARTITION "SYS_P657531"  VALUES LESS THAN (18100000000)

There is an alter command in order to change the value for that partition?

Ex: change it into PARTITION "SYS_P657531" VALUES LESS THAN (17493458497)

I have Oracle 12c.

Thank you,

[is there] an alter command in order to change the value for that partition?

Not as such. Consider the problem of what should happen to the values in the current position which lie between 17493458497 and 1809999999. The database can't delete them but altering the high value of the partition would make them homeless.

The partition isn't full ..so there are not such values as you said

That doesn't change the situation. Oracle does not support the reduction (or raising) of the high value of a partition.

What we can do is split the existing partition into two:

alter table your_table split partition SYS_P657531 into
  (partition p_17493458497 values less than (17493458497),
   partition p_18100000000);

There are various options for splitting the different types of partitions. For instance with list of range partitions we might do this instead:

alter table your_table split partition SYS_P657531
    at (17493458497) into
      (partition p_17493458497,
        partition p_18100000000);

These two statements do the same thing; the first syntax is more flexible, as it allows us to split a partition into more than two new partitions in a single operation.

Find out more .


If you don't have any values above 17493458497 and/or don't want to store then you could drop the remainder partition p_18100000000 after the SPLIT operation. Alternatively, if as part of a related exercise you need to raise the ceiling of the remainder partition above 18100000000 then you would create a new partition with the required high value (assuming it doesn't already exist) and merge the two partitions.

alter table your_table merge partitions p_18100000000, p_whatever 
    into p_19000000000;

Find out more .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM