Search This Blog

Tuesday, 29 November 2016

Oracle database ​size in MB/GB query​ with creation date.

Query to find SID used & free space in it.

col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024,2 ) || ' GB' "Database Size"
, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024,2) || ' GB' "Used space"
, round(free.p / 1024 / 1024 / 1024,2) || ' GB' "Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p

Query to find database size in MB/GB with creation date.

select
  a.owner,b.created, ROUND(sum(bytes)/1024/1024,2) as size_in_MB, ROUND(sum(bytes)/1024/1024/1024,2) as size_in_GB
  from
  dba_segments  a inner join dba_users  b
  on a.owner=b.username
group by
 a.owner,b.created;





No comments:

Post a Comment