Skip to content
Advertisement

How to know the size of a table with a photo in Oracle

I have a table that I fill in the post method, I send a photo, and describe the event, I want to know the size of this table (MB) with the help of a selector, Someone can help me with this ??

SQL> CREATE TABLE image
  2  (
  3     Neme        VARCHAR2 (10),
  4     EVENT_ID    VARCHAR2 (10),
  5     MYFILE      BLOB
  6  );

Advertisement

Answer

In oracle, to find out the size of your table, you can do this:

select segment_name
       , segment_type 
       , SUM(bytes/1024/1024) MB
from dba_segments
where segment_type='TABLE' and segment_name='IMAGE'
GROUP BY segment_name
         , segment_type;

And here is a DEMO if you use a user_segments instead of dba_segments as a_horse_with_no_name suggested.

And if you would like to check your BLOB column size try this:

SELECT SUM(DBMS_LOB.GetLength("MYFIL")/1024/1024) AS SizeMB
FROM IMAGE;
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement