![]() |
#1 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
How to fix a (minor?) database error?
Kobo Libra H2O, firmware 4.24.15676
I only side-load books, either using Calibre or manually in the file explorer (for testing purposes), and never activate the wifi. I do not read CBR / CBZ format books. I am using the Kobo Utilities Calibre plugin to backup my database every time I connect to Calibre. Recently I started getting an error which prevents the backup: "Failed to backup the database". Spoiler:
I am still able to load books to the device and Calibre can read all the books already on it, and the plugin appears to continue to update the reading positions, which is why I think it must be a relatively minor error. But series information does not seem to be written. And I would prefer to have an up-to-date backup. The first time it happened I was in a hurry and everything but the backup seemed to work fine so I crossed my fingers it would resolve itself. It has not. ![]() After checking the forum I have tried: - Compact the database: Spoiler:
- check database: Spoiler:
I would really like to avoid losing my notes, reading position, and datestamps of loaded / read because that is my preferred sort order, so I have not logged out. Questions: 1. Can I fix the error(s) in the database somehow? (How?) 1a. What could have caused this error (how to avoid it in future)? I always safely eject the device before unplugging the usb. 2. If I cannot fix the database, I think I have to logout/login to recreate a new database (thus losing all my activity data): can I reimport the annotations, datestamps, reading positions / status (new, currently reading...) of the books on the device? I have added columns in Calibre for all the options available in the plugin and exported all of this information so at least in theory it is available. If yes, how? Thanks in advance for any help you can give me. I haven't had this Kobo for very long and am unfamiliar with the various tricks and secrets of using it. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
As the database errors are in only indexes, I am surprise the compress did not fix it. What you can do is use a SQLite database management tool to rebuild the indexes. If you run the following, it should fix it:
Code:
REINDEX content_bookid_index; REINDEX sqlite_autoindex_content_1; |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Thank you davidfor for this answer. I tried doing what you suggested (disclaimer: I have never worked with SQLite databases before). I installed SQLite tools (https://www.sqlite.org/download.html) and followed instructions on this page
https://www.sqlitetutorial.net/download-install-sqlite/ The first command seems to have worked, the second gave me an error message : Spoiler:
After running these commands I again launched Calibre but I get the same errors. When attempting to save the database at connection: Spoiler:
Check database: Spoiler:
Is there something obvious I've done wrong? |
![]() |
![]() |
![]() |
#4 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,033
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Copy the database file to your PC.
Fix it there. Maybe delete the offending row. Copy it back overwriting original. |
![]() |
![]() |
![]() |
#5 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Spoiler:
When I tried opening the database in a GUI editor (SQLite Expert Personal) to delete the row 103877, possibly because I have no idea what I am doing, it made it worse: Spoiler:
So I put back the original version from before I started tinkering with it and I am back to the original 1 error again. I am not sure what I'm doing wrong, maybe this is too complicated for my (lack of) skill. Plan B: if I logout/login (effectively deleting the database and creating a new one, if I've understood correctly), is there a way to import from Calibre to the Kobo my annotations, collections, reading positions / dates, and statuses? These are all saved in Calibre using the Kobo Utilities plugin. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,033
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
You need to rebuild the index(es) if you delete a row.
Collections can certainly be easily recreated from Calibre to the Kobo*. @Davidfor would know about the other things. I personally only care about annotations FROM the Kobo to PC via Kobo Utilities, which are saved in plain text files. You could note current % read for any open books. I did that for a couple of books the time I loaded an earlier backup of the database when it broke (rare). Obviously a backed up database has nothing about what you did since. The backup was renamed to the standard name on the kobo after the broken database was deleted. My backup names is <name of kobo, there are 3 here><date><version if more than one that day> [* That and series is why 2 of the 3 main reasons I use a kobo not a Kindle] |
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,515
Karma: 78910202
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
It's quite possible that if the index is damaged or the database lacks consistency that it will be impossible to delete a row.
Sent from my Pixel 4a using Tapatalk |
![]() |
![]() |
![]() |
#8 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
You should be able to find the book by running the SQL statement: Code:
SELECT ContentId, COUNT(*) FROM content GROUP BY ContentId HAVING COUNT(*) > 1 Code:
file:///mnt/onboard/Testing/Fussell, Paul/Great War and Modern Memory, The - Paul Fussell.kepub.epub Quote:
The annotations can be fetched using the Annotations plugin, but, they can't be restored. There isn't enough information stored to be able to do this. They are stored in the database and the table can be manually copied with a bit of work. |
||
![]() |
![]() |
![]() |
#9 | |||||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
Quote:
Quote:
I accidentally ran it once halfway through (only the first 2 lines) and that did give one result, so I deleted that book and all associated files with the same filename (some images, and annotations file...), but this did not fix the problem. Quote:
Today the problem is worse: Database check Spoiler:
I don't know why, and although I copied the database from yesterday with only the one error back to the device the new errors reappear each time after I eject / reconnect. At this point I am not sure it is possible for me given my lack of database skills to correct this problem. I have not managed to do any of the things suggested, the problem is getting worse, and I am getting pretty frustrated. I think it's probably best if I try to salvage as much as I can and just start fresh with a new database, much as it annoys me. This is my first experience with a device that uses a database, my previous devices (Sony and Cybook) did not work that way as far as I know, and although I have been mostly happy with the Kobo so far this is really putting a damper on my enthusiasm, I never had any problem even remotely like this with the others. |
|||||
![]() |
![]() |
![]() |
#10 | |||||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
Quote:
Quote:
For the "Recent" sort, if I populate the device again, I use the "Update metadata in the device library" to set the "Date Added" to one of the dates in the calibre library. If you are opening and then marking books as unread, it won't help. Quote:
|
|||||
![]() |
![]() |
![]() |
#11 | ||||||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
Quote:
![]() Quote:
Quote:
Quote:
![]() A last question about annotations: when I export them to a .txt file, they wind up at the root of the device storage. Are they linked to the original epub file at all? Or can I move them to a folder without causing any problems? I don't like the mess. ![]() |
||||||
![]() |
![]() |
![]() |
#12 | |||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
![]() |
#13 | |||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
However then I tried to import the exported table back to the database, just to check how it worked and I got that bleeding unique error again: Code:
Error while importing data: UNIQUE constraint failed: Bookmark.BookmarkID Quote:
Quote:
![]() |
|||
![]() |
![]() |
![]() |
#14 | |||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
![]() |
#15 | ||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
I think now I've got everything figured out that I want to do. Am I missing any steps?
Thank you again for all your help, I really appreciate it. Last edited by Mister L; 03-02-2022 at 01:07 PM. Reason: amending the list of steps to follow |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fix Kobo corrupt database | Chris Jones | Related Tools | 4 | 10-06-2014 12:19 AM |
Minor Fix For Calibre? | Marcs1102 | Library Management | 7 | 02-16-2014 11:30 PM |
How to manually fix a (probably) corrupted database? | Lucas Malor | Kobo Reader | 13 | 05-09-2013 08:01 PM |
minor date error | nello | Calibre | 1 | 01-02-2011 01:17 PM |
Minor bug fix release now available? | borisb | enTourage Archive | 6 | 05-24-2010 03:05 PM |