database corruption error during post install

Document ID : KB000121475
Last Modified Date : 22/11/2018
Show Technical Document Details
Introduction:
during post-install on upgrade, the installation stopped with a corrupt db error in the post install log

Migration file dbsavefile.SSdb was not found or is not readable.
Backing up catalog and models to db_20181120,1.SSdb ERROR:
This application has been started using a Spectrum database which was not gracefully closed.
The application will now shut down to allow you to load and initialize a previously-saved good database.
SPC-DBS-20095: SSdbsave Error: Unable to open database.
** Error during backup to db_20181120,1.SSdb spadmin@xxxxxx
Background:
the SSdb, a Berkley sleepycat database has no way to check for or fix corruption.
It is quite a resilient database but an ungraceful shutdown can cause corruption.
So when the database is shut down ungracefully e.g. due to a power outage, RAM error etc, a flag is turned on that stop the SS from being restarted until a restore of a previous db is done.
That is normally when we see this error 

ERROR: This application has been started using a Spectrum database which was not gracefully closed. The application will now shut down to allow you to load and initialize a previously-saved good database. 

The next step in this situation would be to restore a previous db and restore but is very unusual an during upgrade. 
A possible cause would be that the install became corrupted somehow. We should always check the install file via the checksum data after download.
i.e. when downloading any new version there is also an MD5 checksum file than can be downloaded to verify if the file downloaded fully and correctly.
 
Instructions:
After confirming the install iamge checksum is correct and redownloading if necessary, if there is a virtual backup of the system, prior to upgrading, it should be used to restore and reinstall.
An alternative would be as follows

This is a way to recover from a catastrophe
 As par of a migration install, there is a backup made of the models and catalog before we migrate the catalog.
After we migrate the catalog, we save that off as legacy.SSdb.
So after a successful install these files exist:
db_,1.after.SSdb -> this is the catalog after the migration( which is why it has .after ),
the same file as legacy.SSdb db_,1.SSdb – this is models and catalog before migration.
So we have a copy of the models, and a pre-catalog and a post-catalog.
Models are not changed during the install, and are compatible across catalogs.
To get back to pristine state, we need to do these steps:

SSdbload -il legacy.SSdb ( this gives us back clean, migrated catalog ) SSdbload -m db_,1.SSdb ( this gives us back clean models )
To get the actual filename of the database saved, `grep “Backing up catalog and models to” <10.2 postinstall log>`.

e.g.
sh-4.4$ pwd
/c/win32app/Spectrum/Install-Tools/LOGS/10.3.0.0.341_20180925
sh-4.4$ grep -r "Backing up catalog and models" postinst.15.20
Backing up catalog and models to db_20180925,1.SSdb
Backing up catalog and models to db_20180925,1.after.SSdb
sh-4.4$