Friday 7 June 2013

SQL to find Historical Growth Of Oracle Database

SQL to find Historical Growth Of Oracle Database
set echo off
set pagesize 9999
set lines 9999
col Month for a10
col year for a8
clear breaks
break on year nodup skip 1

select
to_char(creation_time,'RRRR') Year
,to_char(creation_time,'MM') Month
,sum(bytes) / 1024/1024 "Size in MB"
from v$datafile
group by to_char(creation_time,'RRRR')
,to_char(creation_time,'MM')
order by 1,2;

=====================
SQL> set echo off
SQL> set pagesize 9999
SQL> set lines 9999
SQL> col Month for a10
SQL> col year for a8
SQL> clear breaks
breaks cleared
SQL> break on year nodup skip 1
SQL>
SQL> select
2 to_char(creation_time,'RRRR') Year
3 ,to_char(creation_time,'MM') Month
4 ,sum(bytes) / 1024/1024 "Size in MB"
5 from v$datafile
6 group by to_char(creation_time,'RRRR')
7 ,to_char(creation_time,'MM')
8 order by 1,2;

YEAR MONTH Size in MB
-------- ---------- ----------
2000 04 15849

2001 10 1024
11 710

2002 01 2047
04 2047
05 1000
08 2047

2003 02 2000
03 50
04 2000
08 2000
11 4000

2004 07 10000
10 2100

2005 02 6000
03 8000
07 6750

2006 02 32
08 4000

2007 06 600
07 22770

2008 07 2042

2009 01 206500
11 2000

2010 04 500
08 200

2011 08 9000

2013 03 8000


28 rows selected.

SQL>

No comments:

Post a Comment