Help recovering a corrupted Zotero database
Hello. I use Zotero daily. Last week I cleared my local app data and now my Zotero database is corrupted. I am seeing “database disk image is malformed.” I need guidance to restore my library.
What happens
1. Zotero creates a new empty zotero.sqlite
2. Attempts to open my old zotero.sqlite show the error above
What I tried
1. Closed Zotero, renamed backups to zotero.sqlite, and restarted
2. Ran the SQLite CLI recovery
sqlite3 "zotero.sqlite" ".recover" > dump.sql
ren "zotero.sqlite" "zotero.sqlite.old"
sqlite3 "zotero.sqlite" < dump.sql
3. Repeated with numbered .bak files
4. Integrity check still fails for core tables such as items and itemData
What I need
1. Steps or tools to salvage rows from items, itemData, creators, itemCreators, collections, and collectionItems
2. Advice on options for relinking attachments in storage to recovered items
3. Recommendations for reliable scripts or utilities that can skip corrupt pages and rebuild a valid database
Thank you for any concrete recovery steps.
What happens
1. Zotero creates a new empty zotero.sqlite
2. Attempts to open my old zotero.sqlite show the error above
What I tried
1. Closed Zotero, renamed backups to zotero.sqlite, and restarted
2. Ran the SQLite CLI recovery
sqlite3 "zotero.sqlite" ".recover" > dump.sql
ren "zotero.sqlite" "zotero.sqlite.old"
sqlite3 "zotero.sqlite" < dump.sql
3. Repeated with numbered .bak files
4. Integrity check still fails for core tables such as items and itemData
What I need
1. Steps or tools to salvage rows from items, itemData, creators, itemCreators, collections, and collectionItems
2. Advice on options for relinking attachments in storage to recovered items
3. Recommendations for reliable scripts or utilities that can skip corrupt pages and rebuild a valid database
Thank you for any concrete recovery steps.
If you haven't been using Zotero syncing, your only option would be to restore from a backup of your database from before it was corrupted — either one of the automatic backups Zotero makes or a backup you made yourself.
https://www.zotero.org/support/zotero_data#restoring_your_zotero_data_from_a_backup