cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

How can I run a command to find the total database space and the remaining database space? The dbinfo command doesn't seem to have the information I am looking for.

View Entire Topic
Breck_Carter
Participant

You can do-it-yourself...

SELECT
CAST ( DB_PROPERTY ( 'PageSize'  ) AS INTEGER ) AS PageSize,
CAST ( DB_PROPERTY ( 'FileSize'  ) AS BIGINT ) AS FileSize,
CAST ( DB_PROPERTY ( 'FreePages' ) AS INTEGER ) AS FreePages,
CAST ( ( PageSize * FileSize ) / 1024.0 / 1024.0 AS DECIMAL ( 11, 1 ) ) AS FileMB,
CAST ( ( PageSize * FreePages ) / 1024.0 / 1024.0 AS DECIMAL ( 11, 1 ) )  AS FreeMB,
CAST ( ( ( FileSize - FreePages ) * 100.0 ) / FileSize AS DECIMAL ( 11, 1 ) )  AS UsedPercent;

   PageSize             FileSize   FreePages        FileMB        FreeMB   UsedPercent 
----------- -------------------- ----------- ------------- ------------- ------------- 
       4096              1650235      235264        6446.2         919.0          85.7 

or let Foxhound monitor the numbers...

alt text