Get list of all tables in Oracle?
Going one step further, there is another view called cols (all_tab_columns) which can be used to ascertain which tables contain a given column name.
SELECT table_name, column_name FROM cols WHERE table_name LIKE 'EST%' AND column_name LIKE '%CALLREF%';
to find all tables having a name beginning with EST and columns containing CALLREF anywhere in their names.
This can help when working out what columns you want to join on, for example, depending on your table and column naming conventions.
SELECT owner, table_name FROM dba_tables
This is assuming that you have access to the
DBA_TABLES data dictionary view. If you do not have those privileges but need them, you can request that the DBA explicitly grants you privileges on that table, or, that the DBA grants you the
SELECT ANY DICTIONARY privilege or the
SELECT_CATALOG_ROLE role (either of which would allow you to query any data dictionary table). Of course, you may want to exclude certain schemas like
SYSTEM which have large numbers of Oracle tables that you probably don't care about.
Alternatively, if you do not have access to
DBA_TABLES, you can see all the tables that your account has access to through the
SELECT owner, table_name FROM all_tables
Although, that may be a subset of the tables available in the database (
ALL_TABLES shows you the information for all the tables that your user has been granted access to).
If you are only concerned with the tables that you own, not those that you have access to, you could use
SELECT table_name FROM user_tables
USER_TABLES only has information about the tables that you own, it does not have an
OWNER column – the owner, by definition, is you.
Oracle also has a number of legacy data dictionary views--
CAT for example-- that could be used. In general, I would not suggest using these legacy views unless you absolutely need to backport your scripts to Oracle 6. Oracle has not changed these views in a long time so they often have problems with newer types of objects. For example, the
CAT views both show information about tables that are in the user's recycle bin while the
[DBA|ALL|USER]_TABLES views all filter those out.
CAT also shows information about materialized view logs with a
TABLE_TYPE of "TABLE" which is unlikely to be what you really want.
DICT combines tables and synonyms and doesn't tell you who owns the object.
dba_tables didn't work.
This one did:
select table_name from all_tables