蓝色翱翔

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

环境:Oracle 11.2.0.3 需求:生产一张表由于前期设计不当,没有主键。现需要添加主键,数据量很大,想并行建立。

 

1.直接添加,提示ora-3001:未实施的功能;只能单线程建立主键

SQL> alter table add constraint pk_t primary key (object_id) using index online parallel 2;

alter table add constraint pk_t primary key (object_id) using index online parallel 2
ORA-03001: 未实施的功能
 
SQL> alter table add constraint pk_t primary key (object_id) using index online;
Table altered
SQL> alter table drop primary key;
Table altered
 
2.先开并发创建唯一索引,再改成主键
SQL> create /* +parallel(8) +/ unique index pk_t on t(object_id) online;
Index created
SQL> alter table add constraint pk_t primary key (object_id);
Table altered
 
 
posted on 2019-04-14 16:41  蓝色翱翔  阅读(1643)  评论(0编辑  收藏  举报