SQL Queries to get Constraints and Indexes from OIM Tables.


SELECT
    *
FROM
    ALL_CONS_COLUMNS A
    JOIN ALL_CONSTRAINTS C ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
WHERE
        C.TABLE_NAME = 'RSC'
    AND
        C.CONSTRAINT_TYPE = 'R';


--To get Table PK and indexes.
---------------------------------

SELECT
    USER_TABLES.TABLE_NAME,
    USER_INDEXES.INDEX_NAME
FROM
    USER_TABLES
    JOIN USER_INDEXES ON USER_INDEXES.TABLE_NAME = USER_TABLES.TABLE_NAME
WHERE
    USER_TABLES.TABLE_NAME = 'CERT_TASK_ACTION'
ORDER BY
    USER_TABLES.TABLE_NAME,
    USER_INDEXES.INDEX_NAME;

SELECT
    USER_TABLES.TABLE_NAME,
    USER_INDEXES.INDEX_NAME,
    USER_IND_COLUMNS.COLUMN_NAME
FROM
    USER_TABLES
    JOIN USER_INDEXES ON USER_INDEXES.TABLE_NAME = USER_TABLES.TABLE_NAME
    JOIN USER_IND_COLUMNS ON USER_INDEXES.INDEX_NAME = USER_IND_COLUMNS.INDEX_NAME
WHERE
    USER_TABLES.TABLE_NAME = 'CERT_TASK_ACTION'
ORDER BY
    USER_TABLES.TABLE_NAME,
    USER_INDEXES.INDEX_NAME;

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts