0

I have a Firebird application which gives the Firebird error Transactions count exceeded.

How can we fix this error?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Divino Neto
  • 21
  • 1
  • 3
  • 1
    See [Firebird Transaction Count Exceeded](https://stackoverflow.com/questions/22984231/firebird-transaction-count-exceeded) – Mark Rotteveel May 21 '19 at 13:45
  • u would need a backup-restore cycle according to your application documentation (it might be important which tool and which user/password is used to recreate database from a backup). However something is strange with the database. We about 5 years ago saw a client coming to us still running Interbase 5.6 - that was released in middle of 1990-s. The database was running for about 20 years and still did not overflowed the counter – Arioch 'The May 21 '19 at 14:16

1 Answers1

6

The full error message of this error is "Implementation Limit Exceeded - Transactions count exceeded. Perform a backup and restore to make the database operable again". And as that error suggests, you need to backup and then restore your database.

In Firebird 2.5 and lower, the maximum number of transactions is (near) 231 - 1, for Firebird 3 and higher it is 248. Once this limit is reached, the database is for all intents and purposes read-only.

To reset the transaction count, you need to backup the database using gbak, and restore it using the proper database owner user (or possibly SYSDBA). To do this you need to perform the following steps:

  • Mark database explicitly read-only with gfix using SYSDBA or the database owner user:

    gfix -user <user> -password <password> -mode read_only <databasename>
    

    This is necessary because gbak needs to start a transaction, and in read_write mode that is not possible anymore (in read_only mode, transactions will 'reuse' the last committed transaction for read-only operations).

  • Backup your database with gbak using SYSDBA or the database owner user:

    gbak -user <user> -password <password> -backup <databasename> <backupfilename>
    
  • Rename your existing database file <databasename> to something else for safekeeping. You can delete it after you have verified the restore went fine and the new database is usable.

  • Restore the database with the appropriate user that should be the database owner:

    gbak -user <user> -password <password> -create <backupfilename> <databasename>
    
  • Mark database as writable again with gfix using SYSDBA or the database owner user:

    gfix -user <user> -password <password> -mode read_write <databasename>
    
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197