Get size of the database - oracle database script

Get size of the database - Oracle Database Script.

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 /