If you want to know how much space the database uses on the server's disk system, you can issue the following query:
SELECT SUM(bytes) AS bytes FROM dba_data_files;However, the datafiles could be a little empty, mostly empty or somewhere in between. So many people look at the amount of space occupied by the tables and indexes in the database. Any object that allocates space in the database is called a segment, so a different query is used:
SELECT SUM(bytes) AS bytes FROM dba_segments;Just like datafiles, the segments could be mostly empty. In this case, you will have to use the DBMS_SPACE package segment by segment to see how much of the segment's allocated space is actually used.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.