Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: No automatic indexes
> Actually I believe using 10gR2 it is possible to have a PK without an
> index, but the PK has to be in a disabled state.
See a hair? Split it....
If you have a disabled constraint, then do you really have the constraint? Rather, I would state that what you have is the *definition* of the constraint, but the constraint will not truly exist until you enable it.
> I do not have a
> system to test with right now but you can disable the PK on R2 and the
> index by default is no longer is dropped but rather is kept. You
> should then be able to perform a drop index. However, the PK
> constraint still exists so technically you have a table with a PK
> without an index to enforce it. If you enable the PK without first
> creating the index to support Oracle will create the index for you as
> it did in the past.
>
> If you have a 10gR2 system you can test this. Ours has to be rebuilt
> since we were dumb enought to follow an Oracle support recomendation to
> fix an upgrade problem. Their fix not only uninstalled R2 but it took
> R1 with it.
>
> Brian if you or Daniel has the time and interest to test this I would
> appreciate your posting the results to the thread (even if I turn out
> to be wrong).
I'll bite on the test...Oracle 10.2.0.2 running on Red Hat Linux:
SQL> create table test (id number);
Table created.
SQL> alter table test add constraint test_pk primary key (id);
Table altered.
SQL> select index_name from user_indexes
2 where table_name='TEST';
INDEX_NAME
SQL> alter table test disable constraint test_pk;
Table altered.
SQL> drop index test_pk;
drop index test_pk
*
ERROR at line 1:
ORA-01418: specified index does not exist
SQL> select index_name from user_indexes
2 where table_name='TEST';
no rows selected
SQL> select constraint_name from user_constraints;
CONSTRAINT_NAME
Enabling the constraint should rebuild the index:
SQL> alter table test enable constraint test_pk;
Table altered.
SQL> select index_name from user_indexes
2 where table_name='TEST';
INDEX_NAME
It might all be semantics and I just might be picking a bone...
Cheers,
Brian
-- =================================================================== Brian Peasland oracle_dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - UnknownReceived on Thu Jun 15 2006 - 09:48:27 CDT