All Forums Database
14 Apr 2014
Daily Increase in Space for Database ?

Hi all,
As per the some of the requirements , we have to calculate the Daily increase in Volume (bytes) for a database (it includes some 100 + tables) for the past 30 days.
One way of doing it is calculating the daily growth per table i.e through some date/timestamp column and grouping it  and then summing for all the 100 tables .. I would be a very timeconsuming step.
I was just thinking that is there any quick way through dbc tables /views  or DBQL to get the Daily increase in volume of the past 30 days.

Raja_KT 1246 posts Joined 07/09
14 Apr 2014

Hi Nishant,
Maybe you need to tweak a little. The link  below can be a good pointer.
Put in a unix script may be.

Raja K Thaw
My wiki:
Street Children suffer not by their fault. We can help them if we want.

Adeel Chaudhry 773 posts Joined 04/08
15 Apr 2014

You can schedule the following SQL as an INSERT to a table:



,CAST(SUM(maxperm)/1024/1024/1024 AS DECIMAL(7,2)) max_perm

,CAST(SUM(currentperm)/1024/1024/1024 AS DECIMAL(7,2)) current_perm

,CAST(SUM(maxspool)/1024/1024/1024 AS DECIMAL(7,2)) max_spool

,CAST(SUM(currentspool)/1024/1024/1024 AS DECIMAL(7,2)) current_spool

,max_perm - current_perm AS free_perm

FROM dbc.diskspace WHERE databasename IN

(SELECT databasename FROM dbc.databases WHERE dbkind = 'D' )

GROUP BY databasename ORDER BY max_perm DESC;


And using that table you can find the daily changes over any span of days you choose.



-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.