Database Status

From dbawiki
Revision as of 15:40, 10 November 2012 by Stuart (talk | contribs) (Created page with "==How big is the database?=== col "Database Size" format a20 col "Free space" format a20 col "Used space" format a20 select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How big is the database?=

col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"
,      round(sum(used.bytes) / 1024 / 1024 / 1024 ) - 
       round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"
,      round(free.p / 1024 / 1024 / 1024) || ' 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