Why does the backup file size change even if database is not in use?


If you run regular backup, you may notice that both database file and backup file size change after each backup, even though there isn't any application using the database. Reason for this is the backup itself. When backup is initiated via Services API or directly with GBAK it starts a snapshot transaction in order to read the data. Each transaction is recorded in header of database file (in transaction inventory), so the database file will change. Additionally, if you run gbak without -g option, it runs the garbage collection that also changes the database.

If you wish to prevent these changes, use gfix to set database to read-only mode like this:

gfix -mode read_only database.fdb


Beside the backup process, the database file can change during idle time if you use SuperServer and garbage collection thread kicks in. This would also change the database even if no regular user is using it.

A similar issue applies to nbackup tool which uses a system table called RDB$BACKUP_HISTORY where it keeps log of created backups. Writing to this table changes the database. nbackup also starts transactions to run ALTER DATABASE BEGIN and END BACKUP statements.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous