cancel
Showing results for 
Search instead for 
Did you mean: 

Database Size from sap table

Former Member
0 Kudos

Hi All,

I am preparing one ABAP program for my MIS report. for that program i required database size from DB02

I am looking the database size from any of the table, but i could not get it.

can any one help me to find the database size from any table with data?

or

How to get the database size from any table with data?

Thanks in advance,

Regards,

Sundar.c

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

1. Gather statistic on the interested tables or database entire (dbms_stats package, in example)

2. select table_name ,num_rows,avg_row_len,

round(num_rows*avg_row_len/1024/1024,3) tsize,blocks,round(blocks/256,3) upper_size

from dba_tables

tsize - usefull size (data only)

upper_size - table size in blocks (in this case - 4 Kb)

fidel_vales
Employee
Employee
0 Kudos

Hi,

the solution from Alexey will give you the size based on the statistics, so it is as good as the statistcs.

Some times it is not possible or convenient to gather the stats to get this information.

Also, keep in mind that the default block size in SAP is 8K

If you want to know the exact table size right now, then you have to check user_segments, from an ABAP program you should use:

SELECT SUM(bytes)/1024/1024 MB

FROM user_segments

WHERE segment_type = 'TABLE'

AND segment_name = <table name>

Of course, I'm not considering tables with Blog segments