就按范围分区好了
只要稍微变换一下思路即可
比如,为下面的3组月份,分别设立一个范围ID,也就是在表里加一个字段
partition_id,其中1表示1,4,7,10月份,2表示2,5,8,11,3表示3,6,9,12
能明白我的意思吗?
1,4,7,10
2,5,8,11
3,6,9,12create table test
(
 id number(10) primary key,
 partition_id number(5),
 month date
)
partition by range (partition_id)
(
 partition data_blastn1  values less than(2) tablespace tablespace1,
 partition data_blastn6  values less than(3) tablespace tablespace2,
 partition data_blastn7  values less than(4) tablespace tablespace3
)
/

解决方案 »

  1.   

    你的意思是说有这样的“别处导过来的”数据吗?,我觉得这根本不是什么困难的事
    你在新表加一个字段总可以吧?然后把下面的脚本,写一个小程序,该一改不就得了。。
    insert into new_table values(1,1月);
    insert into new_table values(2,2月);
    insert into new_table values(3,3月);
    insert into new_table values(4,4月);
    insert into new_table values(5,5月);
    insert into new_table values(6,6月);或许是这样得结构?用SQLLDR导入?
    1 分隔符 1月
    2 分隔符 2月
    3 分隔符 3月不明白,
      

  2.   

    也可以这样,就是不知道你的月份字段是什么类型的数据,我现在用了VARCHAR2
    create table test
    (
     id number(10) primary key,
     month varchar2(2)
    )
    partition by list (month)
    (
     partition month_group1 values ('1','4','7','10'),
     partition month_group2 values ('2','5','8','11'),
     partition month_group3 values ('3','6','9','12')
    )
      

  3.   

    刚才忘了说,别忘了建立分区局部索引,
    Create index test_index on test(month)
    local

    partition month_group1,
    partition month_group2,
    partition month_group3
    )
    /
      

  4.   

    如果你的month是一个日期字段,也可以这样
    create table test
    (
     id number(10) primary key,
     month date
    )
    partition by list (to_char(month,'MM'))
    (
     partition month_group1 values ('01','04','07','10'),
     partition month_group2 values ('02','05','08','11'),
     partition month_group3 values ('03','06','09','12')
    )
      

  5.   

    不好意思,刚才的to_char(month,'MM')好像不可以
    我测试了,
    只有这样是可以的,你自己再测试测试,我也没有用过date型的LIST,索引一定不要忘了
    晚安
    create table test
    (
     id number(10) primary key,
     month varchar2(2)
    )
    partition by list (month)
    (
     partition month_group1 values ('1','4','7','10'),
     partition month_group2 values ('2','5','8','11'),
     partition month_group3 values ('3','6','9','12')
    )
      

  6.   

    感谢ATGC兄受了这么多的“苦”,不过我昨天忘了说我的oracle是oracle8.1.7版的,对于list分区不支持,
    所以还是没有解决问题,月份的字段是CHAR(2),格式为‘MM’,怎么办啊?
      

  7.   

    感谢ATGC兄的帮忙,多了很多思路,不过我现在是把它做成了12个分区的,反正空间不够跟他们要就是了^_^