Displays the tables, columns, indexes, and other objects that belong to a specific Oracle schema.
Query the ALL_TABLES
or USER_TABLES
data dictionary views. ALL_TABLES
shows objects you have privileges on, while USER_TABLES
shows objects you own.
SELECT table_name
FROM all_tables
WHERE owner = 'ECOMMERCE';
Use ALL_TAB_COLUMNS
or DESC
. For more details including data types and nullable flags, prefer the view.
SELECT column_name, data_type, nullable
FROM all_tab_columns
WHERE owner = 'ECOMMERCE'
AND table_name = 'PRODUCTS';
Yes. Combine ALL_INDEXES
, ALL_CONSTRAINTS
, and ALL_CONS_COLUMNS
to assemble full structural metadata.
SELECT i.index_name, c.constraint_type, col.column_name
FROM all_indexes i
JOIN all_constraints c
ON i.owner = c.owner AND i.index_name = c.index_name
JOIN all_cons_columns col
ON c.owner = col.owner AND c.constraint_name = col.constraint_name
WHERE i.table_owner = 'ECOMMERCE'
AND i.table_name = 'ORDERS';
Use ALL_DEPENDENCIES
to trace which PL/SQL packages, views, or triggers rely on specific tables.
Create a script that unions multiple dictionary views, or leverage Oracle’s DBMS_METADATA.GET_DDL
to extract the DDL for each object.
SELECT DBMS_METADATA.GET_DDL('TABLE', table_name, owner) AS ddl
FROM all_tables
WHERE owner = 'ECOMMERCE';
OWNER
to avoid cross-schema noise.SELECT_CATALOG_ROLE
to read system views safely.SELECT * FROM dba_tables
require special rights?Yes. You need the DBA role or explicit SELECT on those DBA_ views.
ALL_ views show objects you can access while DBA_ views show everything in the database. Use DBA_ only if you are a DBA.
Yes. Use DBMS_METADATA.GET_DDL
or the expdp
utility with the SCHEMAS
parameter.