cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Find remaining database space

Former Member
3,251

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

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

Former Member
0 Likes

How do I address the command exactly within the OSX (10.13) terminal ?

./dbinfo -u /Applications/SQLAnywhere17/System/demo.db

Whats wrong with that?

thx for your help, guys!

chris_keating
Product and Topic Expert
Product and Topic Expert
0 Likes

Are you using dbinfo -u.

That output is very detailed about number of pages - used and free, usage percentages by table for table and index pages.

Here is an example dbinfo -u output. If it is not sufficient for your needs, can you describe what other information is needed:

SQL Anywhere Information Utility Version 17.0.8.4003
Database  : c:\\sa\\sa17\\samples\\demo.db
Log file  : c:\\sa\\sa17\\samples\\demo.log
Free pages: 565275
Page size : 4096

     Table   Table            Index           Percent  Name
      id     Pages    %used   Pages    %used  of File
     -----  --------  -----  --------  -----  -------  ----
         1        11  ( 84)        10  ( 44)      0    ISYSTAB
...
      3008         1  (  3)         2  (  9)      0    Departments
            ========         ========
Total:           355 table +      496 index + 565275 free + 0 bit map + 162 other = 566288 pages