Subject Re: Database file inflates...
Author Adam
--- In firebird-support@yahoogroups.com, "muk_pr" <mukt1000@...> wrote:
>
> Hi all,
>
> I use Firebird 2 [single file] in my app. This app mostly works with
> blob data and use triggers other than the trivial database jobs. At
> application exit, all the data in all tables are cleared. My problem
> is that the database file somehow got bigger and bigger [7mb] as the
> time goes despite all data being removed by the application exit.
>
> For a solution, first I tried a database sweep via IBOConsole but that
> didn't do the trick. Then I tried to make a backup for the database
> with IBOConsole as recommended but then the created backup database
> file is an invalid database file.
>
> SoI wanna ask:
> 1. what is going on with the inflation?

This is normal and should be expected.

http://www.fbtalk.net/ViewTopic.aspx?id=131
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_expert6

> 2. why does the sweep not work?

It does, it just does not do what you thought it did.

> 3. what am I doing wrong to get a corrupted backup?

It is not clear from the post whether you understand a backup. A
backup is *not* a file copy of the database. It is more like a set of
instructions to rebuild a database file.

You should stick with a naming convention, something like:

fdb -> Database file
fbk -> Backup file

fdb files are alignment and endian sensitive. You can't just go and
copy them from an x86 box to a PPC box etc. fbk files allow you to
make transportable backups, which can be restored on whatever format
your box is. Another difference, the fdb file will contain every
index, where the fbk file only stores how the index should be
generated. The fdb contains old record versions for old transactions,
the fbk does not.

You must restore the fbk file to get a working fdb file.

Given that you don't seem to care about your data once your
application exits, I would take a different approach. Deleting all
records is expensive. Instead I would programatically delete the
database file at the file system level and restore a new one. This
would be a lot faster both in the time it takes to delete-restore is a
lot quicker than the time it takes to delete all the records and the
time it takes to then garbage collect the mess.

gbak -b -m will give you a backup file with no data in it.

Adam