Ask the Expert

Size of database in gigabytes

I'm new to Oracle. How do I find out the total size of a database in gigabytes?

    Requires Free Membership to View

The "size" of a database can mean different things to different people.

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.

This was first published in September 2006

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: