首先创建四个表空间:

SQL> create tablespace ts01 logging datafile '/oracle/app/oradata/TEST/ts01.dbf' size 100m;
SQL> create tablespace ts02 logging datafile '/oracle/app/oradata/TEST/ts02.dbf' size 100m;
SQL> create tablespace ts03 logging datafile '/oracle/app/oradata/TEST/ts03.dbf' size 100m;
SQL> create tablespace ts04 logging datafile '/oracle/app/oradata/TEST/ts04.dbf' size 100m;

然后创建范围分区表:

SQL> create table test123 partition by range(object_id)
    (
    partition p1 values less than (10000) tablespace ts01,
    partition p2 values less than (20000) tablespace ts02,
    partition p3 values less than (50000) tablespace ts03,
    partition p4 values less than (maxvalue) tablespace ts04)
    as select * from dba_objects;

分区索引分为:全局分区 和 本地分区

创建全局分区表索引:

SQL> create index idx123 on test123(object_id)
    global partition by range(object_id)
    (
    partition idx_1 values less than(10000) tablespace ts01,
    partition idx_2 values less than(25000) tablespace ts02,
    partition idx_3 values less than(50000) tablespace ts03,
    partition idx_4 values less than(maxvalue) tablespace ts04);

创建本地分区表索引:

SQL> create index idx123 on test123(object_id) local;

分区索引的作用是 减少逻辑读的次数 , 减少I /O 压力  提高读取数据效率。