cancel
Showing results for 
Search instead for 
Did you mean: 

Table Space - Very Urgent

Prabhu_7
Frequent Advisor

Table Space - Very Urgent


Task is to find out how much space is been occupied by our tables( 32 tables)

We have 7 table spaces and we access only two table spaces for our tables
and indexes.These TSs also been shared by other group.
Now we need to find out how much space is been occupied by our 32 tables and
related indexes.

How to find this out.??

Thanks
9 REPLIES
Massimo Bianchi
Honored Contributor

Re: Table Space - Very Urgent

hi,
you just query the dba_free_space:


select tablespace_name, sum(bytes)
from dba_free_space
gorup by tablespace_name;


This will reveal the free space in each tablespace.

Massimo
Massimo Bianchi
Honored Contributor

Re: Table Space - Very Urgent

select tablespace_name, sum(bytes)
from dba_data_files
order by tablespace_name;

will show you allocated space.

if you subtract this value from the value from previous post, you will get the used space.

Massimo
F. X. de Montgolfier
Valued Contributor

Re: Table Space - Very Urgent

Hi,

here is a oracle command to show tables size:

select a.owner "Owner", a.table_name "Name", round(b.bytes/1024) "Total Kb", round(a.blocks*4) "HWM Kb",
round(((a.blocks*a.avg_space)/1024)+(a.empty_blocks*4)) "Total Free Space Kb",
decode(a.blocks,0,'Vide',round(((a.blocks*(4-a.avg_space/1024))/(a.blocks*4))*100)) "Pct used HWM",
round((((b.bytes/1024)-(a.blocks*4))/(b.bytes/1024))*100) "HWM Pct"
from sys.dba_tables a, sys.dba_segments b
where a.table_name=b.segment_name
and b.segment_type='TABLE'
and a.owner not like 'SYS%'
order by 1,2;


Here is another one for tablespaces size:

select tablespace_name "Tablespace",round(min(bytes)/1024) "Min Free Kb",
round(max(bytes)/1024) "Max Free Kb",round (sum(bytes)/1024) "Total Free Kb",count(*) "Nb Free Segments"
from sys.dba_free_space
group by tablespace_name;

Hope this helps,

FiX
Steven E. Protter
Exalted Contributor

Re: Table Space - Very Urgent

Massimo, did you test that?

my sqlplus session says thsi.

ERROR at line 1:
ORA-00937: not a single-group function

logon as oracle

sqlplus internal

I would note that the next two sql statements after Massimo's report product good reports.

I would like to try Massimo's stuff out. Why the error?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jean-Luc Oudart
Honored Contributor

Re: Table Space - Very Urgent

Steven,

SQL should read :
select tablespace_name, sum(bytes)
from dba_data_files
GROUP by tablespace_name;

Are the tablespaces locally managed ?

JL

fiat lux
Massimo Bianchi
Honored Contributor

Re: Table Space - Very Urgent

Hi,
Jan-Luc, you are right, i used ""group by""
but when doing the cut&paste i did some garbage.


Here are correct ones:

SQL> select tablespace_name, sum(bytes) from dba_free_space
2 group by tablespace_name;

TABLESPACE_NAME SUM(BYTES)
------------------------------ ----------
CATATS 25812992
CATIP50 40755200
CATMA77 40755200
CATPITE 40755200
INDX 56614912
RBS 302587904
RCVCAT 40755200
SYSTEM 8994816
TEMP 4775936
USERS 52420608

10 rows selected.

SQL> select tablespace_name, sum(bytes) from dba_data_files
2 group by tablespace_name;

TABLESPACE_NAME SUM(BYTES)
------------------------------ ----------
CATATS 52428800
CATIP50 52428800
CATMA77 52428800
CATPITE 52428800
INDX 56623104
RBS 429916160
RCVCAT 52428800
SYSTEM 73400320
TEMP 5242880
USERS 52428800

10 rows selected.

Sorry :)
Massimo
Steven E. Protter
Exalted Contributor

Re: Table Space - Very Urgent

Much better Massimo,

Thanks.

I think his last post deserves a rabbit.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Yogeeraj_1
Honored Contributor

Re: Table Space - Very Urgent

hi,

For a more detailed one you may wish to use this one:

-- free.sql
-- usage @free
-- @free 1
-- This SQL Plus script lists freespace by tablespace

(attached)

for example on my system it shows: Max
Max pct
Tablespa KBytes Used Free Used Largest Kbytes Used
SYSTEM 201,728 200,960 768 99.6 704 33,554,416 .6

shows that my system tablespace is currently 201m and has 0.4% fre HOWEVER it can grow to 33gig and hence has only used 0.6% of its potential.

hope this helps!

regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: Table Space - Very Urgent

script attached!
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)