Thursday, November 6, 2014

Script: Oracle Database Growth per Month

Here you can find two scripts those are database growth per month and tablespace level database growth.

The below script lists the details of database growth per month:

select to_char(creation_time, 'MM-RRRR') "Month", sum(bytes)/1024/1024/1024 "Growth in GB"
from sys.v_$datafile
where to_char(creation_time,'RRRR')='2014'
group by to_char(creation_time, 'MM-RRRR')
order by  to_char(creation_time, 'MM-RRRR');

Sample output from the script:

Month                                                                       Growth in GB
------------------------------------------------------------      -----------------
05-2014                                                                       101.588867
06-2014                                                                       525.609375
07-2014                                                                             57.5
09-2014                                                                               10
10-2014                                                                       31.0976563
11-2014                                                                               52

Below script is useful for tablespace level database growth:

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 from the script:

TABLESPACE_NAME                CUR_USED_SIZE_MB AVG_INCREAS_MB
---------------------------------         ---------------------------   -------------------------
DW_AGG                                       8150.31                                 46.94
DW_DAC_REP_DATA                    858.31                                   3.29
DW_DIM_DATA                             7078.81                                 6
DW_DIM_INDX                              3229.69                                3.89
DW_DIM_STG                                1202.38                                -9.61
DW_FACT_DATA                          304706.94                            894.51
DW_FACT_INDX                           32227.81                             183.04
DW_FACT_STG                             5483.81                                120.7
DW_INFA_DOMAIN_DATA              1                                      0
DW_INFA_REP_DATA                 3617.88                                2.43
DW_OTHER                                  14314.88                              83.68
DW_OTHER_INDX                        203.81                                  .71
PRD_BIPLATFORM                      7493                                     64.57
PRD_MDS                                        13.44                                    0
SYSAUX                                       7097.75                                 -3.94
SYSTEM                                       2408.31                                10.43
UNDOTBS1                                 62488.13                               7074.66
UNDOTBS2                                 13088.38                              -866.43
UNDOTBS3                                  81902                                   10326
USERS                                          2015.13                                  -2.68

Hope this scripts will help you. :)

Best Regards,
Chowdari

22 comments:

  1. Hi Chowdari.

    The tablespace growth out put shown your blog is for last one month or year.

    Please confirm.

    Thanks - Pradeep

    ReplyDelete
    Replies
    1. Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download Now

      >>>>> Download Full

      Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download LINK

      >>>>> Download Now

      Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download Full

      >>>>> Download LINK Er

      Delete
  2. v$datafile re-sets every time you restart the database. SO the query is not for ideal case.

    ReplyDelete
  3. This is growth on database wise. I want to track the growth schema wise per month. I can get current size from user_segments but I Need for previous months as well.

    ReplyDelete
  4. Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download Now

    >>>>> Download Full

    Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download LINK

    >>>>> Download Now

    Chowdari'S Oracle Dba Blog / Weblog: Script: Oracle Database Growth Per Month >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete
  5. The consistent Oracle database growth per month is truly impressive. How Guard Business Such steady growth showcases the robustness and reliability of Oracle, making it a reliable choice for handling data-intensive tasks. A commendable feat.

    ReplyDelete

Some Most Popular Articles