Wednesday, January 6, 2010

Reporting Growth of Tables

Growth of a segment over time.
This uses data from the Automatic Workload Repository
History of data will only go back based on the retention of the AWR.


select c.owner Owner
, c.segment_name "Segment Name"
, to_char(end_interval_time, 'MM/DD/YY') GrthDate
, sum(space_used_delta) / 1024 / 1024 "Spc used(MB)"
, avg(c.bytes) / 1024 / 1024 "Tot Object Size(MB)"
, round(sum(space_used_delta) / sum(c.bytes) * 100, 2) "Percentage Growth"
from dba_hist_snapshot sn, dba_hist_seg_stat a, dba_objects b, dba_segments c
where trunc(end_interval_time) = trunc(sysdate)-7
and sn.snap_id = a.snap_id
and b.object_id = a.obj#
and b.owner = c.owner
and b.object_name = c.segment_name
group by c.owner, c.segment_name,to_char(end_interval_time, 'MM/DD/YY')
order by to_date(GrthDate, 'MM/DD/YY'),Owner,c.segment_name



******************************************
keywords: table segment growth
******************************************
rdbms version: 10g
******************************************

No comments: