Get list of all tables in Oracle?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
In Oracle Database, querying the list of tables is a fundamental task for database administration and development. Understanding how to retrieve this list can help in managing the database schema, performing migrations, or simply auditing the current database structure for optimization.
Overview of Oracle Data Dictionary Views
Oracle uses data dictionary views to maintain information about the schema objects. These views are essential for querying metadata about various aspects of the Oracle Database. For listing tables, Oracle provides several useful views:
USER_TABLES: Lists all tables owned by the current user.ALL_TABLES: Lists all tables accessible to the current user, including those owned and those for which the user has been granted specific rights.DBA_TABLES: Lists all tables in the database, including system tables and tables belonging to different schemas. This view is typically accessible only to users with administrative privileges.
Retrieving List of Tables
Here's how you can query these views:
Using USER_TABLES
To see all tables that the current user owns:
This query will return the names of all tables that the current user schema owns.
Using ALL_TABLES
If you need to view all tables that you have access to, not limited to those you own:
This query provides a list of tables along with the owners of the tables, which is useful when accessing a broader list of tables beyond your own schema.
Using DBA_TABLES
For users with DBA privileges who need to audit or manage all database tables:
This will list every table available in the database across all schemas, providing a comprehensive overview.
Additional Views and Commands
Aside from these views, Oracle also provides other metadata-oriented views which could be helpful depending on your specific needs:
USER_TAB_COLUMNS: Useful for identifying columns within the user's tables, including data types and other attributes.ALL_TAB_COLUMNS: LikeUSER_TAB_COLUMNS, but shows columns of all tables accessible to the user, not just those owned.DBA_TAB_COLUMNS: Provides column information across all tables in the database for users with administrative rights.
Practical Examples
Example 1: Finding tables related to a specific project
Suppose you have several tables related to a certain project, prefixed with PRJ_:
Example 2: Tables with specific column name
If you are looking for tables that have a column named EMPLOYEE_ID:
Summary Table
Here is a summarization of the views discussed:
| View | Scope | Typical Usage |
USER_TABLES | Tables owned by the user | Discovering tables in your schema |
ALL_TABLES | Tables accessible to the user | Exploring accessible tables, including shared |
DBA_TABLES | All tables in the database | Full database audits, admin tasks |
Conclusion
Understanding and using the Oracle data dictionary views efficiently can significantly simplify the day-to-day tasks of database administration and schema management. Whether you are auditing, optimizing, or just exploring the database schema, these tools provide extensive capabilities to interact with the metadata effectively.

