Friday, April 5, 2019

How to get single tablespace size on oracle 18c ?

Solution :

Use below query to get singe tablespace usage on oracle 18c or 12.2

Query :

SELECT A.TABLESPACE_NAME,A.TOTAL_GB,B.FREE_GB, (A.TOTAL_GB-B.FREE_GB) USED_GB FROM 
(SELECT ROUND(SUM(BYTES/1024/1024/1024)) TOTAL_GB ,TABLESPACE_NAME FROM DBA_DATA_FILES GROUP BY TABLESPACE_NAME) A,
(SELECT ROUND(SUM(BYTES/1024/1024/1024)) FREE_GB, TABLESPACE_NAME FROM DBA_FREE_SPACE GROUP BY TABLESPACE_NAME) B 
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME and A.TABLESPACE_NAME ='TEST_DEV_DATA';

Output:
TABLESPACE_NAME                  TOTAL_GB    FREE_GB    USED_GB
------------------------------ ---------- ---------- ----------

TEST_DEV_DATA                          30          6         24



No comments:

Post a Comment

How can I restore Cassandra snapshots?