To check the size of a table in Oracle, you can use the following query. This query retrieves the size of a table in bytes:

SELECT segment_name "Table Name",
       segment_type "Segment Type",
       tablespace_name "Tablespace",
       bytes/1024/1024 "Size (MB)"
FROM user_segments
WHERE segment_type = 'TABLE' AND segment_name = 'YOUR_TABLE_NAME';

Replace ‘YOUR_TABLE_NAME’ with the name of the table you want to check.

Here’s a live example using the HR schema in Oracle, assuming you have access to this schema:

SELECT segment_name "Table Name",
       segment_type "Segment Type",
       tablespace_name "Tablespace",
       bytes/1024/1024 "Size (MB)"
FROM user_segments
WHERE segment_type = 'TABLE' AND segment_name = 'EMPLOYEES';

This query will show you the size of the “EMPLOYEES” table in the HR schema in megabytes.

Keep in mind that the exact columns and tables used may vary depending on your Oracle version and the specific schema you are working with.

Categories: Oracle

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *