Run this query and see..This query will consider the sysdate -7 days and
makes the avg growth per day calculations for the tablespaces.
SELECT b.tsname tablespace_name
, MAX(b.used_size_mb) cur_used_size_mb
, round(AVG(inc_used_size_mb),2)avg_increas_mb
FROM (
SELECT a.days, a.tsname, used_size_mb
, used_size_mb - LAG (used_size_mb,1) OVER ( PARTITION BY a.tsname ORDER BY a.tsname,a.days) inc_used_size_mb
FROM (
SELECT TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY') days
,ts.tsname
,MAX(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) used_size_mb
FROM DBA_HIST_TBSPC_SPACE_USAGE tsu, DBA_HIST_TABLESPACE_STAT ts
,DBA_HIST_SNAPSHOT sp, DBA_TABLESPACES dt
WHERE tsu.tablespace_id= ts.ts# AND tsu.snap_id = sp.snap_id
AND ts.tsname = dt.tablespace_name AND sp.begin_interval_time > sysdate-7
GROUP BY TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY'), ts.tsname
ORDER BY ts.tsname, days
) A
) b GROUP BY b.tsname ORDER BY b.tsname
/
Sample output:
TABLESPACE_NAME CUR_USED_SIZE_MB AVG_INCREAS_MB
------------------------------ ---------------- --------------
GWMONITOR 19.44 0
MEDIADMIN 74.56 0
MYVRNUSER 4.06 0
NPIDATA 5954.5 0
NSIDATA 35847.67 27.43
NSIDATA01 422923.03 266.93
NSIDATA03 .06 0
QUARTZ 42.75 0
SMRDATA 10418.44 0
SYSAUX 14261.13 8.49
SYSTEM 10651.25 18.29
UNDOTBS1 1109.88 -67.29
UNDOTBS2 1383.88 -35.14
USERS 67.63 0
VPX 8399.31 1.65
SELECT b.tsname tablespace_name
, MAX(b.used_size_mb) cur_used_size_mb
, round(AVG(inc_used_size_mb),2)avg_increas_mb
FROM (
SELECT a.days, a.tsname, used_size_mb
, used_size_mb - LAG (used_size_mb,1) OVER ( PARTITION BY a.tsname ORDER BY a.tsname,a.days) inc_used_size_mb
FROM (
SELECT TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY') days
,ts.tsname
,MAX(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) used_size_mb
FROM DBA_HIST_TBSPC_SPACE_USAGE tsu, DBA_HIST_TABLESPACE_STAT ts
,DBA_HIST_SNAPSHOT sp, DBA_TABLESPACES dt
WHERE tsu.tablespace_id= ts.ts# AND tsu.snap_id = sp.snap_id
AND ts.tsname = dt.tablespace_name AND sp.begin_interval_time > sysdate-7
GROUP BY TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY'), ts.tsname
ORDER BY ts.tsname, days
) A
) b GROUP BY b.tsname ORDER BY b.tsname
/
Sample output:
TABLESPACE_NAME CUR_USED_SIZE_MB AVG_INCREAS_MB
------------------------------ ---------------- --------------
GWMONITOR 19.44 0
MEDIADMIN 74.56 0
MYVRNUSER 4.06 0
NPIDATA 5954.5 0
NSIDATA 35847.67 27.43
NSIDATA01 422923.03 266.93
NSIDATA03 .06 0
QUARTZ 42.75 0
SMRDATA 10418.44 0
SYSAUX 14261.13 8.49
SYSTEM 10651.25 18.29
UNDOTBS1 1109.88 -67.29
UNDOTBS2 1383.88 -35.14
USERS 67.63 0
VPX 8399.31 1.65
No comments:
Post a Comment