####
Calculate DiskSpace of a Database in GBs:

*SELECT DATABASENAME, *

*SUM(MAXPERM)/1024/1024/1024 Max_available_Space_GBs,*

*SUM(CURRENTPERM)/1024/1024/1024 Consumed_Space_GBs,*

*(SUM(CURRENTPERM))/(SUM(MAXPERM))*100 Percent_Utilised*

*FROM DBC.DISKSPACE*

*WHERE DATABASENAME IN('DB_NAME') *

*GROUP BY 1;*

####
Calculate DiskSpace of a Database in MBs:

**SELECT DatabaseName ,SUM(CurrentPerm)/1024/1024 AS USEDSPACE_IN_MB ,**

**SUM(MaxPerm)/1024/1024 AS MAXSPACE_IN_MB ,**

**SUM(CurrentPerm)/ NULLIFZERO (SUM(MaxPerm)) *100 (FORMAT 'zz9.99%') AS Percentage_Used ,**

**MAXSPACE_IN_MB- USEDSPACE_IN_MB AS REMAININGSPACE_IN_MB **

**FROM DBC.DiskSpace **

**WHERE DatabaseName = 'DB_NAME' **

**GROUP BY DatabaseName;**

####
Calculate TableSize per Database per Table in MBs:

**Sel databasename, tablename, sum(peakperm)/1024/1024 as peakperm, sum(currentperm)/1024/1024 as currentperm **

**from dbc.tablesize**

**where databasename ='dbc'**

**group by 1,2**

####
Calculate Tablesize per Database per Table per VPROC in MBs:

*Sel databasename, tablename, vproc, sum(peakperm)/1024/1024 as peakperm, sum(currentperm)/1024/1024 as currentperm *

*from dbc.tablesize*

*group by 1,2,3*

## No comments:

## Post a Comment