04-28-2024, 09:46 PM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2024
Device: none
|
DB Repair Failure
I had a drive go bad and had to switch to the backup, but one of my libraries on the backup is coming up corrupted. I clicked yes for Calibre to repair it but it gives me errors I don't understand. It won't open, even as a partial repair. I'm really hoping there's a fix for this. Help?
Code:
calibre, version 7.8.0 ERROR: Failed to repair library: Restoring database failed, click "Show details" to see details Traceback (most recent call last): File "calibre\db\restore.py", line 329, in replace_db PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'K:\\Lib\\AO3\\metadata.db' -> 'K:\\Lib\\AO3\\metadata_pre_restore.db' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "calibre\db\restore.py", line 160, in run File "calibre\db\restore.py", line 334, in replace_db PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'K:\\Lib\\AO3\\metadata.db' ------------- Failed to restore: tamedbanshee/if crazy equals genius (then I'm a (113793) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 86, in call_func_with_lock File "calibre\db\cache.py", line 2924, in restore_book File "calibre\db\cache.py", line 2145, in create_book_entry File "calibre\db\backend.py", line 1147, in execute File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id ------------- Failed to restore: tamedbanshee/crack of the whip (blood in the cu (113800) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 86, in call_func_with_lock File "calibre\db\cache.py", line 2924, in restore_book File "calibre\db\cache.py", line 2145, in create_book_entry File "calibre\db\backend.py", line 1147, in execute File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id ------------- Failed to restore: shirohebi/Hostile Land (131450) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 86, in call_func_with_lock File "calibre\db\cache.py", line 2924, in restore_book File "calibre\db\cache.py", line 2145, in create_book_entry File "calibre\db\backend.py", line 1147, in execute File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id ------------- Failed to restore: CatChan/Sakurama - I _ Childhood (133710) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 86, in call_func_with_lock File "calibre\db\cache.py", line 2924, in restore_book File "calibre\db\cache.py", line 2145, in create_book_entry File "calibre\db\backend.py", line 1147, in execute File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id ------------- Failed to restore: Nikkia/Call it a Senju Sandwich (134846) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 86, in call_func_with_lock File "calibre\db\cache.py", line 2924, in restore_book File "calibre\db\cache.py", line 2145, in create_book_entry File "calibre\db\backend.py", line 1147, in execute File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id |
04-28-2024, 10:04 PM | #2 |
creator of calibre
Posts: 44,017
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Reboot in safe mode then run the restore, that error indicates something is interfering with calibre.
|
04-30-2024, 08:28 PM | #3 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2024
Device: none
|
Okay, I tried that, but it didn't work. Same error. I think the most confusing thing is that it looks like Calibre is complaining it can't access the file because it's in use by Calibre.
On the theory that the issue is the fact that it's Calibre Portable, I tried downloading the latest direct install and used that. Same result again. I figure I'll try the direct installed version in Safe Mode tonight and see what happens, but I don't have much hope for it. It takes hours, since it's a huge library (there are over 7000 authors, most of whom have more than one work) so I leave it running when I go to bed. The only other factor I can think of is the fact that it's an external hard drive, but this library is almost 9.5 GB. Copying it to the desktop would take a while. I'll probably try that tomorrow night, unless you have a better suggestion. I'm pretty sure I could reconstruct it by drag-and-drop with the opf files, but that's going to be horrifically tedious with the sheer quantity. |
04-30-2024, 09:51 PM | #4 |
Custom User Title
Posts: 8,841
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yeah. might be worth trying it on an internal drive.
|
04-30-2024, 11:52 PM | #5 |
Well trained by Cats
Posts: 29,974
Karma: 56143930
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
DB Recovery Size is really small.
It recursively reads the OPF files (not the book) and links the image, about 20KB per book. tiny Make sure your external drive has enough power (many come with a second USB (power only) plug on the cable.) Plug direct into the PC . IF YOU MUST use a USB Hub, make sure that it is powered by a wall wort of 2A or greater (each port is rated at 1/2 A). Avoid using another High data device on that hub (another Drive, USB video adapter...) The PC port has to handle all that traffic and share cycles with other ports |
05-01-2024, 12:18 AM | #6 |
creator of calibre
Posts: 44,017
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
One last thing to try is using the command line restore
Code:
calibredb.exe restore_database --really-do-it --library-path "c:/path/to/calibre/library/folder" |
05-01-2024, 03:39 PM | #7 |
Junior Member
Posts: 3
Karma: 10
Join Date: Apr 2024
Device: none
|
Okay, so last night I tried Safe Mode, Installed Version, with the whole library copied over to the Desktop first. Still no joy:
Spoiler:
(For the record, my (16TB) external drive is wall wort powered (can't get USB powered external drives larger than 5TB) and was plugged directly into the laptop with no hub and no other items plugged into the USB ports.) I've never used command line with Calibre. I know how to go to Start and find the Command Prompt. Can I just copy/paste from what you have here (except editing the library path) or do I need to navigate to a specific place first? Is it going to be an issue that the new installed version of Calibre doesn't already know this library? Telling it to add library was enough to get it to come up with the "do you want to repair" option, but as mentioned, I've never used CLI with Calibre. Should I use the portable version on the external drive instead? |
05-01-2024, 06:47 PM | #8 |
Well trained by Cats
Posts: 29,974
Karma: 56143930
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I did not know about the size vs power limit TNX
The first error implies something else had its gloms on the file The other 3: books.id Is it possible another Library was merged (in error) using the OS Like the Highlander: There can only be ONE (of any {id}) |
05-01-2024, 11:42 PM | #9 |
creator of calibre
Posts: 44,017
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes just copy paste the commend changing only the library path
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Troubleshooting PW 3 'needs repair' | urbos | Amazon Kindle | 9 | 06-25-2021 02:45 AM |
Repair? | celticgirl | Kobo Reader | 3 | 08-17-2018 06:12 AM |
Rsync failure, Database repair, missing books | laird | Library Management | 3 | 08-24-2012 04:47 AM |