Wednesday, November 7, 2012

[RDBMS] Show all tables from a database

This may be a basic SQL query but is a quick note to myself and it could be useful for other people. To list all the tables on your Oracle database, first you need to have access to DBA_TABLES view. If you don't have those privileges ask your DBA to grant you SELECT ANY DICTIONARY privilege or SELECT_CATALOG_TABLE role.

The query to see all tables is the following:
SELECT OWNER, TABLE_NAME FROM ALL_TABLES;

The query to see your tables is the following:
SELECT TABLE_NAME FROM USER_TABLES;

Problem solved!