ORA-14501: object is not partitioned


ORA-14501: object is not partitioned

alter table tap_test add partition tap_test0

  values  less than (TO_DATE(' 2014-08-16 00:00:00', 'YYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))  tablespace TESTDBS1;

提示ORA-14501: object is not partitioned对象未分区。

解决办法 :把tap_test表变成分区表:

1、新建新表tap_test为分区表

-- Create table
create table tap_test2
(
  INT_ID          INTEGER,
  VENDOR_ID       INTEGER,

SCAN_START_TIME     DATE,
  SINRUL_00       INTEGER,
  SINRUL_01       INTEGER,
  SINRUL_02       INTEGER
)
partition by range (SCAN_START_TIME)
(
  partition tap_test0 values less than (TO_DATE(' 2014-06-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    tablespace testdba1
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      next 1M
      minextents 1
      maxextents unlimited
    ),
  partition tap_test1 values less than (TO_DATE(' 2014-10-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    tablespace testdba2
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      next 1M
      minextents 1
      maxextents unlimited
    )
);

2、往新建插入数据

insert into tap_test2  select * from tap_test;

commit;

3、删掉旧表,重命名新表

drop table tap_test;--删除旧表;

rename tap_test2   to  tap_test;新表重命名。

4、查询是否分区表
SELECT * FROM USER_TAB_PARTITIONS WHERE TABLE_NAME = ‘TAP_TEST’ ;注意表名要大写。

 

你可能感兴趣的:(ORA-14501: object is not partitioned)