我知道我无法通过在stackoverflow和其他站点上研究类似的问题来做到这一点。
但是,我需要这样做,并且我愿意采用解决方法。
我试图创建一个非唯一索引与online
和parallel
,然后删除旧唯一索引。但是,它没有说ORA-01408: such column list already indexed
。
如何将唯一索引转换为非唯一索引?
如果您不想在创建新索引之前删除旧索引,则可以通过使用附加的无用列创建新索引来作弊,例如:
假设一个表具有以下配置:
create table mytable (id number);
create unique index myunique on mytable (id);
Run Code Online (Sandbox Code Playgroud)
要将索引转换为非唯一索引:
create index temp on mytable (id, 1);
drop index myunique;
create index mynonunique on mytable (id);
drop index temp;
Run Code Online (Sandbox Code Playgroud)
在实践中,我不确定这样做的必要性-通常,我会在低活动时间段内删除并重新创建索引,最好关闭应用程序。