How to estimate the historical growth of Oracle database and database objects

Source: Internet
Author: User
Tags oracle database

-----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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.