Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Muralidhar.

Asked: November 24, 2025 - 3:14 pm UTC

Last updated: December 01, 2025 - 1:31 am UTC

Version: 19.28.0.0.0

You Asked

I need to report the database sizing to our management.

Following are the questions:

1) Total space allocated and used for each Database instance (We have 14 each for 3 applications)
2) How is the growth pattern over the last few years. Year to Year change.

My answer is
1) Run the following query in each instance

SELECT 'ALLOCATED ', SUM(bytes) / 1024 / 1024 / 1024 AS "DB_SIZE-GB" FROM dba_data_files
UNION
SELECT 'USED ', SUM(bytes)/1024/1024/1024 from dba_segments;

2) Store this info in a user defined Table and insert a row with the date once a month, starting today.

So I can provide some growth pattern in a year or couple of years from now.

Can you help improve this in any way, since it is going to be sent to the Management.

and Connor said...

If you are licensed for AWR, then we already collect that data for you. For example

select sn.begin_interval_time, s.tsname, s.snap_id, s.contents, u.tablespace_size, u.tablespace_usedsize
from DBA_HIST_TBSPC_SPACE_USAGE u,
      dba_hist_tablespace_stat s,
      dba_hist_snapshot sn
where s.snap_id = u.snap_id
and s.dbid = u.dbid
and s.ts# = u.tablespace_id
and sn.snap_id = u.snap_id
and sn.dbid = u.dbid;


If you need longer durations, you could can bump your AWR retention settings, or maybe just use a query like the above to capture into a regular table as you've already described.

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.