I have around 15000 tables in my oracle database. I want to primarily fetch list of such tables which are not in use, considering they are not appearing in all_dependencies by using join between dba_tables and all_dependencies.
What would be the query?
I am not sure if that's what you want , tables that does not exists in all_dependencies
select t.table_name from all_tables t where t.table_name
not in (select referenced_name from all_dependencies d where t.table_name=d.referenced_name and d.REFERENCED_TYPE='TABLE')
Check this if it works for you.. SELECT * FROM dba_tables tb WHERE NOT EXISTS (SELECT 1 FROM all_dependencies dep WHERE TB.OWNER = DEP.OWNER AND TB.TABLE_NAME = DEP.REFERENCED_NAME AND DEP.REFERENCED_TYPE = 'TABLE');
The query becomes like:
SELECT t.table_name
FROM dba_tables t
WHERE t.table_name NOT IN (SELECT d.referenced_name
FROM dba_dependencies d
WHERE d.REFERENCED_TYPE = 'TABLE'
and d.referenced_name = t.table_name)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.