When executed, those SQL commands will ask you for a date (past time) and a schema name. For the table version, it will output the list of tables of the given schema. DBA rights are required (access to dba_segments table).
List of table sizes for a schema, compared between now and the given past date :
select ds.tablespace_name,
ds.owner,
ds.segment_name table_name,
trunc(sum(ods.bytes)/(1024*
trunc(sum(ds.bytes)/(1024*
from dba_segments ds
inner join dba_segments as of timestamp to_timestamp('&date','YYYY-MM-
on ods.owner=ds.owner
and ods.segment_type=ds.segment_
and ods.segment_name=ds.segment_
where ds.segment_type='TABLE'
and ds.owner=uper('&owner')
group by ds.tablespace_name, ds.owner, ds.segment_name
having sum(ds.bytes)/(1024*1024) > 5
order by current_size_Mo desc;
Schema size difference for the given owner between now and the given past date :
select ds.tablespace_name,
sum(os.bytes)/1024/1024 AS previous_total_size_Mo,
sum(ds.bytes)/1024/1024 AS current_total_size_Mo
from dba_segments ds
inner join dba_segments as of timestamp to_timestamp('&date','YYYY-MM-
on os.owner=ds.owner
and os.segment_type=ds.segment_
and os.segment_name=ds.Segment_
where ds.owner = upper('&owner')
group by ds.tablespace_name
No comments:
Post a Comment