Wednesday, August 22, 2012


 Query to find the duplicate/redundant columns from all tables in a schema in Oracle DB


We can find the same columns appearing in multiple tables of a particular schema

 SELECT column_name,data_type,data_length,nullable,table_name
FROM dba_tab_columns
WHERE column_name IN
(
    SELECT column_name
    FROM dba_tab_columns
    GROUP BY
        column_name
    HAVING COUNT(1) > 1  -- more than one value
)
and owner = 'USER' -- enter the schema name
AND COLUMN_NAME LIKE '%TIME%'
ORDER BY column_name

No comments:

Post a Comment

Oracle Database & Applications R12.2 Log file locations

Many times, we forget the path for the log files since there are too many.  Below is the list of frequently used log files which can help us...