You are currently reviewing an older revision of this page.
When updating the database cache, exception occurs,
Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: Haestad.SQLite.SQLiteException: 11: database disk image is malformed
Error is generated after compacting database and opening model,
“11: database disk image is malformed”
This error or exception will occur when the database is corrupted in some way. When updating or compacting a database, the step "Purging elements marked as deleted…" is skipped. This step is skipped when compacting the database while the model is opened and when compacting with the model closed and selecting "Purge records to save space". The deleted elements are not updating or getting purged in the database which results in eventual corruption of database.
To resolve this notification the following options can be adopted;
Option 1: Restoring the model from backup
The first step would be to try to restore the model from the backup file.
For example, if this crash or error occurred while working on WaterGEMS, then try to locate the .WTG.SQLITE.BAK or .WTG.BAK files to restore the model from.
The steps to recover models from backup files can be found here.
If the model is successfully restored, check if you get the error or crash by going to File > Database Utilities > Update Database Cache. If the error or crash persists, then please contact Technical Support for resolution.
Option 2: Export sub-model and import it into new workspace
With this option you can simply export the entire model as a sub-model and importing it in a new workspace.
1. Select all elements in the model (Home > Drawing > Select > Select All) or manually select all elements.
2. Go to File > Export > Submodels
3. Save the .sqlite file in a separate location. Close the model.
4. Go to File > Import > Database. Browse to the location of the newly saved database file (.sqlite) and open it.
5. The exception will no longer occur.
Note: With this option there might be some minor loss of data though. It is better to save a backup of the model for future reference.
If the above options do not work, please contact Technical Support to repair your database. Repairing the database involves checking the integrity of the database (.SQLITE file) and re-indexing which should fix this problem.
If you are comfortable with doing so, you can try repairing the database yourself. Be sure to make a backup of the model’s .SQLITE file first. This is the model’s database file and is in the same folder where the model is stored, with the same base file name. Using an application that can open SQLITE files, try re-indexing all tables in the SQLITE file. As an example, the application called SQLITE Exprert has an option to check the integrity of the database and an option to re-index.
Can I restore a backup file of my model project or software component?