{
  "date": "2017-11-02T17:13:29",
  "slug": "quick-history-on-database-growth",
  "link": "https://www.dbi-services.com/blog/quick-history-on-database-growth/",
  "title": {
    "rendered": "Quick history on database growth"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nAWR collects segment statistics, and this can be used to quickly understand an abnormal database growth. Here is a script I use to get, from the AWR history, the segments that have grown by more than 1% of the database size, in one hour.<br />\n<!--more--><br />\nFirst I must mention that this uses only the part of AWR which is not subject to additional option. This even works in Standard Edition:</p>\n<pre><code>NAME                                 TYPE        VALUE\n------------------------------------ ----------- ------------------------------\ncontrol_management_pack_access       string      NONE</code></pre>\n<p>So here is the query, easy to modify with different threshold:</p>\n<pre><code>set echo on pagesize 1000\nset sqlformat ansiconsole\nselect * from (\nselect \n round(sum(SPACE_ALLOCATED_DELTA)/1024/1024/1024) GBYTE_ALLOCATED\n ,trunc(max(end_interval_time),'hh24') snap_time\n ,round(sum(SPACE_ALLOCATED_DELTA)/1024/1024/1024*24*(cast(max(end_interval_time) as date)-cast(min(begin_interval_time) as date))) \"GB/hour\"\n ,owner,object_name,subobject_name,object_type\n from DBA_HIST_SEG_STAT join DBA_HIST_SEG_STAT_OBJ using (dbid,ts#,obj#,dataobj#) join dba_hist_snapshot using(dbid,snap_id)\n group by trunc(end_interval_time,'hh24'),owner,object_name,subobject_name,object_type\n) where \"GB/hour\" &gt; (select sum(bytes)/1024/1024/1024/1e2 \"one percent of database size\" from dba_data_files)\norder by snap_time\n;</code></pre>\n<p>and the sample output, showing only the snapshots and segments where more than 1% of the database size has been allocated within one hour:</p>\n<pre><code>\n GBYTE_ALLOCATED  SNAP_TIME               GB/hour  OWNER     OBJECT_NAME                 SUBOBJECT_NAME   OBJECT_TYPE\n ---------------  ---------               -------  -----     -----------                 --------------   -----------\n                4 25-OCT-2017 19:00:00           4 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                9 25-OCT-2017 20:00:00           9 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                9 25-OCT-2017 21:00:00           9 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                3 25-OCT-2017 22:00:00           3 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                5 26-OCT-2017 00:00:00           5 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                6 26-OCT-2017 01:00:00           6 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                7 26-OCT-2017 02:00:00           7 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                7 26-OCT-2017 03:00:00           7 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                7 26-OCT-2017 04:00:00           7 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                5 26-OCT-2017 05:00:00           5 BIGDATA   SYS_LOB0000047762C00006$$                    LOB\n                2 26-OCT-2017 06:00:00           2 BIGDATA   SYS_LOB0000047719C00008$$                    LOB\n                2 26-OCT-2017 06:00:00           2 BIGDATA   SYS_LOB0000047710C00006$$                    LOB\n</code></pre>\n<p>With this, it is easier to ask to the application owners if this growth is normal or not.</p>\n",
    "protected": false
  }
}
