Total Pageviews

Monday, May 9, 2011

How to Search a Desired Table Name and Column Name in all the databases in ORACLE?





These are the Queries to find the table name  and ColumnName in all the databases on ORACLE :

/**Search a Columnname **/
SELECT OWNER AS DBName ,TABLE_NAME as TableName, COLUMN_NAME as ColumnName,
Count(*) As TotalCount from all_tab_cols
Where column_name like UPPER('%@ColumnName%')
Group by OWNER,TABLE_NAME,COLUMN_NAME



/** Search a Tablename **/

SELECT OWNER AS DBName ,TABLE_NAME as TableName ,Count(*) As TotalCount FROM ALL_ALL_TABLES
WHERE TABLE_NAME LIKE UPPER('%@Tablename%')
Group by OWNER,TABLE_NAME

Please change the required names according to your business Demands then run the query to get desired Results.


No comments:

Post a Comment