Error: The transaction has aborted.

Problem

"The transaction has aborted" error occurred on PostgreSQL 8.3.6.
 at System.Transactions.TransactionStateAborted.EndCommit(InternalTransaction tx)
 at System.Transactions.CommittableTransaction.Commit()
 at System.Transactions.TransactionScope.InternalDispose()
 at System.Transactions.TransactionScope.Dispose()
 at Foray.Adams.RecentlyAccessed.DeleteOldEntries()
 at Foray.Adams.RecentlyAccessed.AssetFoldersForGroup(Groups group)
 at Foray.Adams.DigitalWorkplace.AppController.LoadTree()
 at Foray.Adams.DigitalWorkplace.AppController.Initialize()
 at Foray.Adams.DigitalWorkplace.AppController.OnCreateMainForm()
 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

This is because the database became corrupt due to the backup (ex: tape) running while writes were being done to the database. The specific nature of the corruption is that writes didn't work, though reads did.

Solution

To prevent this from occurring in the future exclude the PostgreSQL\X.X\data directory from the backup.

To get the database fixed:

  1. In case of catastrophic failure in the below process (no good DB backup and can't get one) make a note of all configuration data. This is data that isn't stored in the repository. The following list is not complete:
    1. configuration
    2. asset_folder_access
    3. asset_access
    4. group_table
    5. privilege
    6. group_privilege
    7. custom_table_def
    8. custom_field_def
    9. custom_field_list_item
  2. Make sure you have a backup of the database (the file created by the backup script)
    1. A backup of the database created on the corrupt database may have missing data due to the corruption, so a previous backup is needed. If one is not available create one now and hope for the best. If it doesn't work you will have to re-enter all config settings and data
  3. Uninstall PostgreSQL
  4. Rename the data directory
  5. Re-install PostgreSQL
    1. Use the same postgres service account
  6. Set the postgres superuser password in PgAdmin III
  7. Create the foraydbadmin account
  8. Create the ForayAdams database
  9. Restore the data
    1. Create a copy of the backup file
    2. Rename the copy to have a .zip extension
    3. Unzip the file
    4. Move the unzipped file to the PostgreSQL\X.X\bin directory
    5. Restore the data: psql -U postgres -f <backup file name> ForayAdams
  10. If you can't restore or are missing data you will have to run Rebuild Adams Database.exe



© 2023 Foray, LLC - All Rights Reserved