2

Within the Oracle documentation, the (DBA|ALL)_INDEXES view has

OWNER The owner of the index

INDEX_NAME The name of the index

TABLE_OWNER The owner of the indexed object

TABLE_NAME The name of the indexed object

My question is what uniquely identifies the index? Is it just OWNER and INDEX_NAME, or is it OWNER, INDEX_NAME, TABLE_OWNER and TABLE_NAME?

GMB
  • 216,147
  • 25
  • 84
  • 135
David Fletcher
  • 305
  • 1
  • 7

1 Answers1

3

An index is uniquely identifed by its INDEX_NAME and its OWNER (ie the schema it belongs to). Basically, each object in a schema must have a unique name. Two different tables cannot have an index of the same name, unless these indexes belong to two different schemas.

Consider this simple example:

create table mytable(id int, val int);
create index myindex on mytable(id);
-- ok

create table mytable2(id int);
create index myindex on mytable2(id);
-- ORA-00955: name is already used by an existing object
GMB
  • 216,147
  • 25
  • 84
  • 135