Divino Neto
Divino Neto

Reputation: 21

How to fix Firebird error Transactions count exceeded

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

How can we fix this error?

Upvotes: 0

Views: 6106

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 109084

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>
    

Upvotes: 10

Related Questions