Subject Re: [firebird-support] Possible bug in RC8 -Finding out size of database through code from client
Author Helen Borrie
At 09:31 AM 14/01/2004 +0530, you wrote:
>Hi List,
>first let me explain what I am trying to do. I want to simplify
>administration. So I periodically want to check if the database file size
>is close 2GB in which case I want to automatically increase the number of
>files to two by doing a backup and restore.
>A single file database size can be found out by multiplying Page Size in
>KB with No: of Pages.
>But we couldn't find any algorithm that will return the database file size
>correctly for multi file databases.
>We are retrieving Page Size and No: of Pages of the database using the
>interbase component TIBDatabaseInfo.
>Our database configurations are -
> PAGE_SIZE = 8192 LENGTH = 1000000
>See the Table Below for databases created with page size = 8192 and length
>= 1000 . Only the single file database gives correct result.
>DBFiles PageSize[Bytes] FileLength NooFPages
>ActualFileSizes CalculatedSize

The figures you are collecting are the specifications. The algorithm you
are using will calculate the size at which a file is treated as
"full". This aint MSSQL server - the disk space isn't pre-allocated. When
the server needs more space, it will take more. Adding a file merely says
"Use up to this much space for this file." It really doesn't make sense to
limit the file size to 1000 pages.

If you want to know the actual size of a file, take the database off line
and look at what the OS reports. It's not good doing this while someone is
logged in because the OS won't update the sizes until the files are
actually closed (on Windows, at least).