以下为在一个项目中写的解决代码(数据库为oracle9i,在执行下面的代码时,系统需要停掉):
-- =====其他信息mt表======
create table t_other_mt_new
partition by list(send_request_status)
(
partition part_no values (0),
partition part_send_suc values (1),
partition part_send_fail values (2),
partition part_sending values (3),
partition part_rcv_fail values (4),
partition part_rcv_succ values (5),
partition part_expt_stop values (8)
)
as select *
from t_other_mt;
drop table t_other_mt;
alter table t_other_mt_new rename to t_other_mt;
alter table t_other_mt enable row movement;
-- 给表添加约束
alter table t_other_mt
add constraint pk_other_mt primary key (mt_pk);
-- 给该表添加索引
create index i_other_mt_push_pk
on t_other_mt(push_pk desc)
tablespace kts_index local
;
create bitmap index i_other_mt_sendrequeststatus
on t_other_mt(send_request_status)
tablespace kts_index local
;
create bitmap index i_other_mt_sync_status
on t_other_mt(sync_status)
tablespace kts_index local
;
-- =====其他信息mt表======
create table t_other_mt_new
partition by list(send_request_status)
(
partition part_no values (0),
partition part_send_suc values (1),
partition part_send_fail values (2),
partition part_sending values (3),
partition part_rcv_fail values (4),
partition part_rcv_succ values (5),
partition part_expt_stop values (8)
)
as select *
from t_other_mt;
drop table t_other_mt;
alter table t_other_mt_new rename to t_other_mt;
alter table t_other_mt enable row movement;
-- 给表添加约束
alter table t_other_mt
add constraint pk_other_mt primary key (mt_pk);
-- 给该表添加索引
create index i_other_mt_push_pk
on t_other_mt(push_pk desc)
tablespace kts_index local
;
create bitmap index i_other_mt_sendrequeststatus
on t_other_mt(send_request_status)
tablespace kts_index local
;
create bitmap index i_other_mt_sync_status
on t_other_mt(sync_status)
tablespace kts_index local
;