Teradata Check Total Used Space, Total Maximum Space, Total Percent Used Space and Total Remaining Space

SELECT CAST(SUM(MaxPerm)/1024.00/1024.00/1024.00/1024.00 as DECIMAL (6,2)) as MaxPerm_TB, 

       CAST(SUM(CurrentPerm)/1024.00/1024.00/1024.00/1024.00 as DECIMAL (6,2)) Currentperm_TB, 

       CAST((SUM(MaxPerm)/1024.00/1024.00/1024.00/1024.00 -SUM(Currentperm)/1024.00/1024.00/1024.00/1024.00) as DECIMAL (6,2)) as Freeperm_TB,            

       CAST(((SUM (CurrentPerm (float)))/ NULLIFZERO (SUM(MaxPerm (float))) * 100.0) as DECIMAL (5,3)) as percent_used

       FROM DBC.DiskSpaceV;

 

MaxPerm_TB

Currentperm_TB

Freeperm_TB

percen_used

117.83

18.49

99.34

15.689


Check space in particular database 

SELECT DatabaseName,

       CAST(SUM(MaxPerm)/1024/1024/1024 as DECIMAL (6,0)) as MaxPerm_GB,

       CAST(SUM(CurrentPerm)/1024/1024/1024 as DECIMAL (6,0)) Currentperm_GB,

       CAST((SUM(MaxPerm)/1024/1024/1024 -SUM(Currentperm)/1024/1024/1024) as DECIMAL (6,0)) as Freeperm_GB,           

       CAST(((SUM (CurrentPerm (float)))/ NULLIFZERO (SUM(MaxPerm (float))) * 100.0) as DECIMAL (5,3)) as percent_used

       FROM DBC.DiskSpaceV

       where DatabaseName like '<DATABASE_NAME>'

       GROUP BY 1

       ORDER BY 4 DESC;

Comments