As you're on 12c, you can have multiple indexes on the same column list. Provided only one is visible. So there's another way you could do this:
- Create the unique as invisible
- Switch the PK over
- Remove the non-unique index
For example:
create table t (
x int
);
alter table t add constraint pk primary key (x) using index (
create index i on t(x)
);
create unique index ui on t(x) invisible online;
alter table t modify primary key using index ui;
alter index i invisible;
alter index ui visible;
drop index i;
You can read more about this on Richard Foote's blog:
https://richardfoote.wordpress.com/category/modify-primary-key-using-index/ I'm not sure why you get the error. Is resource_id the only column in the primary key?