Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Space Left For a Database Managed Table Space 2

Status
Not open for further replies.

2742

Programmer
Apr 23, 2001
34
NZ
Hi Everyone
Does any one know the calculation to work out the amount of space left in a tablespace or the percentage used. I know you can find this out from the control centre but is there a way to calculate it your self?
 
We have been doing a lot of research on this! If anyone else has better info please let us know too! Here's a query we're using right now to determine what space is being used. We also have some unix scripts to look at tablespace full info, email me and I will pass you some info.
Thanks, Tony


select t.tabschema as "Schema Name", t.tabname as "Table Name", t.card as "Num Rows", sum(c.avgcollen) as "Avg Row Length",
sum(c.avgcollen) * t.card / 1000000 as "Space Used (MB)"
from syscat.columns c, syscat.tables t
where c.tabschema <> 'SYSCAT'
and c.tabschema <> 'SYSIBM'
and c.tabschema <> 'SYSSTAT'
and c.tabname=t.tabname
and c.tabschema=t.tabschema
group by c.tabschema, c.tabname, t.tabschema, t.tabname, t.card
order by t.tabschema, t.tabname;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top