Below commands to find Database size in Oracle which includes Total DB size, Free size, used size of DB along with DB name & Hostname, etc.
set lines 999
set pages 999
col HOST_NAME for a20
SELECT SYSDATE DATED, A.HOST_NAME, A.INSTANCE_NAME, A.VERSION, C.TOTAL_ALLOCATED_GB, B.USED_GB, D.FREE_GB FROM V$INSTANCE A,
(SELECT SUM(BYTES)/1024/1024/1024 USED_GB FROM DBA_SEGMENTS) B,
(SELECT SUM(BYTES)/1024/1024/1024 TOTAL_ALLOCATED_GB FROM DBA_DATA_FILES) C,
(SELECT SUM(BYTES)/1024/1024/1024 FREE_GB FROM DBA_FREE_SPACE) D;
SQL command which fetch database size in MB. Click here to get a sample output of the Oracle client version.
set lines 999
set pages 999
col HOST_NAME for a20
SELECT SYSDATE DATED, A.HOST_NAME, A.INSTANCE_NAME, A.VERSION, C.TOTAL_ALLOCATED_MB, B.USED_MB, D.FREE_MB FROM V$INSTANCE A,
(SELECT SUM(BYTES)/1024/1024 USED_MB FROM DBA_SEGMENTS) B,
(SELECT SUM(BYTES)/1024/1024 TOTAL_ALLOCATED_MB FROM DBA_DATA_FILES) C,
(SELECT SUM(BYTES)/1024/1024 FREE_MB FROM DBA_FREE_SPACE) D;
We always encourage the technical person to visit section SCRIPTS to get more daily usage SQL commands.
Hope so you like this script!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the latest update. Click here to know more about our pursuit.