View Single Post
Old 01-01-2025, 07:34 PM   #1
djeady
Member
djeady began at the beginning.
 
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.
djeady is offline   Reply With Quote