Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Thursday, 14 April 2016

How to know the Teradata Database size

SELECT A.*, MAX_PERM - CURRENT_PERM
FROM
(
SELECT
DATABASENAME,CAST(SUM(MAXPERM)/(1024*1024*1024) AS DECIMAL(7,2)) MAX_PERM,
CAST(SUM(CURRENTPERM)/(1024*1024*1024) AS DECIMAL(7,2)) CURRENT_PERM,
CAST(SUM(MAXSPOOL)/(1024*1024*1024) AS DECIMAL(7,2)) MAX_SPOOL,
CAST(SUM(CURRENTSPOOL)/(1024*1024*1024) AS DECIMAL(7,2)) CURRENT_SPOOL
FROM DBC.DISKSPACE
WHERE DATABASENAME LIKE '%YOUR_DB_NAME%'
GROUP BY DATABASENAME
)  AS A
;

Please provide your feedback in the comments section above. Please don't forget to follow.