Oracle_Partition_MaxValue

Hi,
We are planning to partition an Oracle table daily.
In order to populate data into the table we are planning to create 3 months of partitions.
~ 90 Partitions.
CREATE TABLE tbl_data_day
( one date )
PARTITION BY RANGE ( one )
PARTITION tx_one
VALUES LESS THAN ( TO_DATE('01-oct-2006','dd-mon-yyyy')),
PARTITION tx_two
VALUES LESS THAN ( TO_DATE('02-oct-2006','dd-mon-yyyy')),
PARTITION tx_three
VALUES LESS THAN ( TO_DATE('03-oct-2006','dd-mon-yyyy'))
Like this the table will hold probably 3 to 4 months of data. my Question is if I add a MAXVALUE parameter to it, how can I add new partitions to the table?
CREATE TABLE tbl_data_day
( one date )
PARTITION BY RANGE ( one )
PARTITION tx_one
VALUES LESS THAN ( TO_DATE('01-oct-2006','dd-mon-yyyy')),
PARTITION tx_two
VALUES LESS THAN ( TO_DATE('02-oct-2006','dd-mon-yyyy')),
PARTITION tx_three
VALUES LESS THAN ( TO_DATE('03-oct-2006','dd-mon-yyyy')),
PARTITION tx_max
VALUES LESS THAN (MAXVALUE))
Now let us say to this table I want to add a new partition 04-OCT-2006 ?
One way i can think of is to DROP the tx_max partition add the new partition for 04-oct-2006 and then add max value or completely eliminate MAXVALUE and let the program error out if it encounters an error.

Example for you:
1 CREATE TABLE tbl_data_day
2 ( one date )
3 PARTITION BY RANGE ( one )
4 (
5 PARTITION tx_one
6 VALUES LESS THAN ( TO_DATE('01-oct-2006','dd-mon-yyyy')),
7 PARTITION tx_two
8 VALUES LESS THAN ( TO_DATE('02-oct-2006','dd-mon-yyyy')),
9 PARTITION tx_three
10 VALUES LESS THAN ( TO_DATE('03-oct-2006','dd-mon-yyyy')),
11 PARTITION tx_max
12* VALUES LESS THAN (MAXVALUE))
[email protected]> /
Table created.
[email protected]> alter table tbl_data_day split partition tx_max at ( TO_DATE('04-oct-2006','dd-mon-yyyy'))
2 into (partition tx_four, partition tx_max) update global indexes;
Table altered.
[email protected]> select partition_name, high_value from dba_tab_partitions where table_name = 'TBL_DATA_DAY';
PARTITION_NAME HIGH_VALUE
TX_ONE TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
N')
TX_TWO TO_DATE(' 2006-10-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
N')
TX_THREE TO_DATE(' 2006-10-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
N')
TX_MAX MAXVALUE
TX_FOUR TO_DATE(' 2006-10-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
N')
The rest of the question both designs are proper in my opinion all depends on your requirments, would you like to allow your app to insert data with for example 4th october, before partition is created or no?
Please remember about index rebuild after partition split.
Best Regards
Krystian Zieja / mob

Similar Messages

Maybe you are looking for