-----The growth of the database in the last seven days, this is only an estimate.
Select SUM (space_used_total)/1024/1024/1024 "Last 7 days DB increase-g"
From
Dba_hist_seg_stat S,
Dba_hist_seg_stat_obj O,
Dba_hist_snapshot SN
where
s.obj# = o.obj#
and
sn.snap_id = s.snap_id
and Begin_interval_time > Sysdate-8
ORDER BY
Begin_interval_time
/
The following additional two scripts are similar to the Web:
Scripts: View database History growth
View Database History growth
This is to calculate the history of the database by calculating the historical growth of all the table spaces in the database.
--does not contain undo and temp
With TMP as
(Select Rtime,
SUM (tablespace_usedsize_kb) tablespace_usedsize_kb,
SUM (tablespace_size_kb) tablespace_size_kb
From (select Rtime,
E.TABLESPACE_ID,
(e.tablespace_usedsize) * (f.block_size)/1024 tablespace_usedsize_kb,
(e.tablespace_size) * (f.block_size)/1024 tablespace_size_kb
From Dba_hist_tbspc_space_usage E,
Dba_tablespaces F,
V$tablespace g
where e.tablespace_id = g.ts#
and f.tablespace_name = G.name
and f.contents not in (' temporary ', ' UNDO '))
Group BY Rtime)
Select Tmp.rtime,
TABLESPACE_USEDSIZE_KB,
TABLESPACE_SIZE_KB,
(TABLESPACE_USEDSIZE_KB-
LAG (tablespace_usedsize_kb, 1, NULL) over (order by Tmp.rtime)) as diff_kb
From TMP,
(select Max (rtime) rtime
From TMP
Group BY substr (Rtime, 1) T2
where t2.rtime = Tmp.rtime;
--including undo and temp
With TMP as
(select min (rtime) Rtime,
SUM (tablespace_usedsize_kb) tablespace_usedsize_kb,
SUM (tablespace_size_kb) tablespace_size_kb
From (select Rtime,
E.TABLESPACE_ID,
(e.tablespace_usedsize) * (f.block_size)/1024 tablespace_usedsize_kb,
(e.tablespace_size) * (f.block_size)/1024 tablespace_size_kb
From Dba_hist_tbspc_space_usage E,
Dba_tablespaces F,
V$tablespace g
where e.tablespace_id = g.ts#
and f.tablespace_name = g.name)
Group BY Rtime)