Thursday, May 26, 2016

How to List All Tables and Describe Tables in Oracle DB

Connect to the database:

sqlplus username/password@database-name
To list all tables owned by the current user, type:

select tablespace_name, table_name from user_tables;
To list all tables in a database:

select tablespace_name, table_name from dba_tables;
To list all tables accessible to the current user, type:

select tablespace_name, table_name from all_tables;
You can find more info about views all_tables, user_tables, and dba_tables in Oracle Documentation. To describe a table, type:

desc <table_name>