Subject Re: Truncating transaction logs in Firebird in v2.01 - v2.03
Author Adam
--- In, Niben M Singh <niben_s@...>
> Hello All -
> I have tried this on Firebird Database v2.01 and v2.03.
> I created new Firebird database with page size 4KB and transferred
data using ODBC. This database has about 400 tables and about 500MB
size right now. After I created the database I thought about
truncating transaction logs.

What are these 'transaction logs' you are talking about? Are they
tables within your database, or something you think Firebird has?

> I sweeped the database using GFIX command as -
> "C:\Program Files\Firebird\Firebird_2_0\bin\"gfix -user SYSDBA
-password masterkey db_name.fdb -sweep
> Then I backedup the database using GBAK with truncate log option as -
> gbak -v -t -user SYSDBA -password masterkey db_name.fdb db_name.fbk

Gbak does not have a 'truncate log' option. Firebird does not store
data in 'logs' like other DBMS, so you may be 'barking up the wrong tree'.

-v displays each action to stdout
-t stores the data in a format that is cross platform safe (even
between endian and alignment differences)

> I restored the database using GBAK again with the hope of truncating
logs as -
> gbak -v -c -p 4096 -user SYSDBA -password masterkey db_name.fbk
> It brought the size to ~480MB. But when I did this second time same
process on this newly backed up database the size went down to ~350MB.
> I am hoping this may be due to the reason that some of the
transaction were not committed when I created the Firebird file
initially. So, I am wondering if there is an easy way of committing
all the uncommitted transaction? Or, if there is a process to truncate
the transaction log properly?

Gbak takes a backup of the database in the exact state it was in the
moment gbak started. Again, it depends on what these transaction logs
you are talking about are. If they are your tables, and you purge them
but do not commit before running gbak, the data will still be in the
backup. But if the transaction was committed, the data will not be
stored in the backup file.