![]() |
#1 |
Member
![]() Posts: 13
Karma: 10
Join Date: Dec 2012
Device: Sony PRST1
|
Database problem
I'm moving my Calibre install to a different computer.
The first thing I did was make sure both computers had the same version of Calibre. I copied the settings folder to the new computer, then physically moved the hard drive that had my Calibre database to the new machine. When I tried to point the new install to the existing Calibre library I got a message that the database was corrupted. Calibre offered to repair the database, however that process failed with the following information: Both computers are up to date Windows 10 64 bit. ---------------- calibre, version 7.23.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 5] Access is denied: 'G:\\Calibre\\metadata.db' -> 'G:\\Calibre\\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 333, in replace_db File "shutil.py", line 258, in copyfile PermissionError: [Errno 13] Permission denied: 'G:\\Calibre\\metadata_pre_restore.db' ------------- Failed to restore: Tom Clancy/Tom Clancy's EndWar_ The Missing (449) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: Robert M. Edsel/The Monuments Men_ Allied Heroes, N (2635) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: The Department of Dead Ends -/The Department of Dead Ends (4879) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: The Apprenticeship of Duddy Kravitz/Richler, Mordecai (6512) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: William Kent Krueger/This Tender Land_ A Novel (8535) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: Sayaka Murata;/Earthlings (8857) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: Edgar Rice Burroughs/Tarzan of the Apes Series--Complete (8858) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: Roberto Bolano/Monsieur Pain (8866) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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: Roberto Bolano/Last Evenings on Earth (Andrews tra (8869) Traceback (most recent call last): File "calibre\db\restore.py", line 306, in restore_books File "calibre\db\cache.py", line 85, in call_func_with_lock File "calibre\db\cache.py", line 2930, in restore_book File "calibre\db\cache.py", line 2150, 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 -------------------------------------------------------------- What should I do to recover from this? I'm trying the database repair again, but expecting the same error. I suppose I could re-import everything into a new Library, but I have about 13,000 books so it would take a looong time. |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,604
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
I've had to do that whenever I upgrade my PC's every 6 or 7 years. It's a hard thing to google for, but found this that might help. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 13
Karma: 10
Join Date: Dec 2012
Device: Sony PRST1
|
Thanks, but I don't think that's the problem. Administrators have full access and I can open the ebooks with the Calibre viewer.
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,172
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
delete the metadata.db file calibre will create a new empty one. Then go to LIbrary maintenance and use the rebuild database option. It will recreate the database for all your books automatically, with all your metadata from the individual OPF files that calibre uses as a distributed backup in each book's folder.
|
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 13
Karma: 10
Join Date: Dec 2012
Device: Sony PRST1
|
Thanks Kovid, I created a new metadata.db file and copied it into my library folder. When I try and select the library it prompts me to rebuild the database, then fails with the same errors.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,172
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The error is a permission error see
https://manual.calibre-ebook.com/faq...n-denied-error |
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 13
Karma: 10
Join Date: Dec 2012
Device: Sony PRST1
|
Permissions seemed to be fine. I copied the library into the default location and deleted the database and did a rebuild and it completed successfully with errors on 9 books. I checked the 9 books and they are in the library and seem to be fine, so all is good. Now I'll move the library to the new location using the move function in Calibre.
Oddly, I have a second small library and it opened fine in the new install. Thanks again. |
![]() |
![]() |
![]() |
#8 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,038
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Is this G drive a networked drive? If so, then it could be that you need to give the account you are using full permission.
|
![]() |
![]() |
![]() |
#9 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jun 2021
Device: Sony PRS-T1
|
metadata.db problem - or is it?
calibre, version 7.26.0
ERROR: Error: Error communicating with device unable to open database file Traceback (most recent call last): File "calibre\gui2\device.py", line 112, in run File "calibre\gui2\device.py", line 563, in _books File "calibre\devices\prst1\driver.py", line 167, in books File "calibre\devices\usbms\driver.py", line 309, in books File "calibre\devices\prst1\driver.py", line 250, in sync_booklists File "calibre\devices\prst1\driver.py", line 279, in update_device_database sqlite3.OperationalError: unable to open database file I tried deleting and rebuilding metadata.db - it restored the metadata.db file but Calibre still has the communication error with my PRS-T1 .My files are all there in Calibre but the On Device column is empty. The files are all there on the PRS-T1 (except for the most recent ones since this error; but they are all on Calibre). Could the problem be something wrong with the PRS-T1? it works perfectly well with the books that are on it, but I am unable to add any more books. I don't seem to be able to read the device reliably with W10 file explorer. There are two drives on the device. W10 offers to scan and repair Reader K but can't complete it whether Calibre is running or not. In fact it falls over after a long while. There is 196 MB free space on Reader K so it should be able to have more files, shouldn't it? Reader K is a fat32 drive. There is a SETTING O drive which is a 10 MB drive but doesn't seem to do much. All in all it is a mess. Anybody out there who has a clue as to what is happening? Regards J |
![]() |
![]() |
![]() |
#10 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,684
Karma: 168431851
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
From the error message you posted, it appears that problem is with the PRS-T1 database not calibre's database.
Code:
File "calibre\devices\prst1\driver.py", line 279, in update_device_database sqlite3.OperationalError: unable to open database file |
![]() |
![]() |
![]() |
Tags |
database, error, moving to new pc |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem in database ? | joelenvoyage | Calibre Companion | 1 | 08-08-2015 04:34 PM |
Calibre database problem | embryo | Kobo Developer's Corner | 4 | 04-11-2015 11:25 AM |
Problem with Database? | vivaldirules | Upload Help | 3 | 05-08-2014 07:30 AM |
Help! Corrupted database problem | Marok | Library Management | 12 | 06-24-2013 09:01 AM |
Database problem | zin | Calibre | 24 | 09-22-2010 06:19 AM |