Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display Oracle schema size with SQL query?

I have a Oracle schema with 70+ tables. I want to create simple page which can display the HDD space occupied by the tables. How I can get this value with SQL query?

P.S And how I can get the Oracle architecture version?

like image 497
Peter Penzov Avatar asked Mar 12 '12 16:03

Peter Penzov


People also ask

How do I know the size of my schema?

select OWNER,sum(bytes)/1024/1024/1000 “SIZE_IN_GB” from dba_segments group by owner order by owner; Share via: Facebook.

How do I find the size of an Oracle database?

The size of the database is the space the files physically consume on disk. You can find this with: select sum(bytes)/1024/1024 size_in_mb from dba_data_files; But not all this space is necessarily allocated.

How do you view the schema of a table in Oracle?

For a list of tables in the current schema, use the Show Tables command. For a list of views in the current schema, use the Show Views command. For a list of available schemas, use the Show Schemas command. If the table or view is in a particular schema, qualify it with the schema name.


1 Answers

You probably want

SELECT sum(bytes)   FROM dba_segments  WHERE owner = <<owner of schema>> 

If you are logged in as the schema owner, you can also

SELECT SUM(bytes)   FROM user_segments 

That will give you the space allocated to the objects owned by the user in whatever tablespaces they are in. There may be empty space allocated to the tables that is counted as allocated by these queries.

like image 95
Justin Cave Avatar answered Sep 20 '22 18:09

Justin Cave