|
|||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||
|
Finding the index that enforces a primary key constraintOne of the most confounding issues with Oracle is the underlying indexes that are used to enforce a unique constraint. In Oracle9i, the index can be dropped and managed separately from the constraint, but we still need a script to quickly locate the index that used by the unique constraint.
As we may know, Oracle-created indexes have cryptic names such as SYSnnnn, and you have no clue about the use for the index.
The following query utilizes the internal Oracle tables to create a nice report that shows the owner, table name, the constraint name, the index name, and additional constraint information.
create or replace view
pk_index
u.name owner, sys.cdef$ cd,
sys.con$ c,
cd.type# = 2
cd.con# = c.con#
cd.obj# = t.obj#
cd.enabled = i.obj# c.owner# = u.user# ; http://www.rampant-books.com/book_2003_1_oracle9i_sga.htm
|
|
|||||||||||||||||||||||||||||||
|