Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-19-2015, 04:44 PM   #1
adrenaline
Enthusiast
adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.
 
Posts: 43
Karma: 28554
Join Date: Mar 2013
Device: Kindle Keyboard, KPW2
Unhappy Calibre Library appears to be corrupted

Hello everyone,

My Windows 7 computer (running a 250GB SSD) crashed for some reason and after a restart, Calibre throws up this message on opening:

Code:
calibre, version 2.26.0
Corrupted database: The library database at C:\Users\John\Documents\Calibre Library appears to be corrupted. Do you want calibre to try and rebuild it automatically? The rebuild may not be completely successful. If you say No, a new empty calibre library will be created.

Traceback (most recent call last):
  File "site-packages\calibre\gui2\main.py", line 278, in initialize_db
  File "site-packages\calibre\db\legacy.py", line 70, in __init__
  File "site-packages\calibre\db\legacy.py", line 44, in create_backend
  File "site-packages\calibre\db\backend.py", line 354, in __init__
  File "site-packages\calibre\db\backend.py", line 1077, in fget
  File "site-packages\calibre\db\backend.py", line 795, in conn
  File "site-packages\calibre\db\backend.py", line 253, in __init__
  File "site-packages\calibre\db\backend.py", line 297, in execute
  File "c:\cygwin64\home\kovid\sw\build\apsw-3.8.2-r1\src\cursor.c", line 990, in APSWCursor_execute.sqlite3_prepare
  File "c:\cygwin64\home\kovid\sw\build\apsw-3.8.2-r1\src\statementcache.c", line 386, in sqlite3_prepare
CorruptError: CorruptError: database disk image is malformed
I saw a couple of different ways but prefer to ask you guys for the most viable option since there's no way back if I mess it up further.

Many thanks for your time in advance.

Last edited by adrenaline; 06-19-2015 at 04:57 PM.
adrenaline is offline   Reply With Quote
Old 06-19-2015, 05:09 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Do a Restore Database, under Library Maintenance in the Library switcher toolbar dropdown.
eschwartz is offline   Reply With Quote
Advert
Old 06-19-2015, 05:30 PM   #3
adrenaline
Enthusiast
adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.
 
Posts: 43
Karma: 28554
Join Date: Mar 2013
Device: Kindle Keyboard, KPW2
Quote:
Originally Posted by eschwartz View Post
Do a Restore Database, under Library Maintenance in the Library switcher toolbar dropdown.
Many thanks for your response, eschwartz!

Obviously that needs to be done on the main Calibre window after clicking "Yes"on this dialog box, right?


Last edited by adrenaline; 06-19-2015 at 05:32 PM.
adrenaline is offline   Reply With Quote
Old 06-19-2015, 05:41 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Actually, that dialog is a shortcut to doing exactly that.

I couldn't be precisely clear on the details as I have always been careful to avoid corruption, so it's been a few years since the one time I had to do this.
eschwartz is offline   Reply With Quote
Old 06-19-2015, 06:32 PM   #5
adrenaline
Enthusiast
adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.
 
Posts: 43
Karma: 28554
Join Date: Mar 2013
Device: Kindle Keyboard, KPW2
Thanks again, eschwartz. Clicked on "Yes" and got this error message after the restore reached 100%:

Code:
calibre, version 2.26.0
ERROR: Failed: Restoring database failed, click Show details to see details

Traceback (most recent call last):
  File "site-packages\calibre\db\restore.py", line 125, in run
  File "site-packages\calibre\db\restore.py", line 277, in replace_db
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: u'C:\\Users\\John\\Documents\\Calibre Library\\metadata.db'
adrenaline is offline   Reply With Quote
Advert
Old 06-19-2015, 06:46 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
That implies some other program has the file open and is locking it. Perhaps your antivirus is scanning it or something?

You might try running the restore via the command-line -- type the following into the command prompt:
Code:
calibredb restore_database -r
eschwartz is offline   Reply With Quote
Old 06-19-2015, 07:30 PM   #7
adrenaline
Enthusiast
adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.
 
Posts: 43
Karma: 28554
Join Date: Mar 2013
Device: Kindle Keyboard, KPW2
Quote:
Originally Posted by eschwartz View Post
That implies some other program has the file open and is locking it. Perhaps your antivirus is scanning it or something?

You might try running the restore via the command-line -- type the following into the command prompt:
Code:
calibredb restore_database -r
Thanks again, eschwartz

Disabled Kaspersky Internet Security and MalwareBytes and tried restoring using command prompt.

Code:
Restoring database succeeded
old database saved as C:\Users\John\Documents\Calibre Library\metadata_pre_restore.db
Some errors occurred. A detailed report was saved to calibre_db_restore_report.txt
Under calibre_db_restore_report.txt,

I see about 10 books with similar error message as this one:

Code:
C:\Users\John\Documents\Calibre Library\American Academy Of Pediatrics\The American Academy of Pediatrics Guide (91) with error:
		Traceback (most recent call last):
		  File "site-packages\calibre\db\restore.py", line 253, in restore_books
		  File "site-packages\calibre\db\cache.py", line 57, in call_func_with_lock
		  File "site-packages\calibre\db\cache.py", line 1983, in restore_book
		  File "site-packages\calibre\db\backend.py", line 1707, in restore_book
		  File "site-packages\calibre\db\backend.py", line 816, in executemany
		  File "c:\cygwin64\home\kovid\sw\build\apsw-3.8.2-r1\src\cursor.c", line 231, in resetcursor
		ConstraintError: ConstraintError: UNIQUE constraint failed: data.book, data.format
I don't need some of those books so deleted them from Calibre and can get the rest from my backups of the Calibre folder. So that's no problem.

But wondering whether the other books in the library are okay and how I can prevent this from happening in the future (apart from the system crashing on its own).

I make backups of the Calibre folder once in two weeks.

Last edited by adrenaline; 06-19-2015 at 07:47 PM.
adrenaline is offline   Reply With Quote
Old 06-19-2015, 09:26 PM   #8
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
That error is saying the books aren't "unique", that is, the book_id is the same as another. Sometimes seen when Dropbox or some other syncing service records an edit clash (in which case you end up with two "_______'s conflicting copy").
calibre requires each book have a unique internal book number and a restore will reject the duplicates.
Note that it reported success.

You can manually add those as new books if you need to.
eschwartz is offline   Reply With Quote
Old 06-20-2015, 07:32 PM   #9
adrenaline
Enthusiast
adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.adrenaline solves Fermat’s last theorem while doing the crossword.
 
Posts: 43
Karma: 28554
Join Date: Mar 2013
Device: Kindle Keyboard, KPW2
Great, thanks so much for explaining the issue, eschwartz!

Greatly appreciate your help
adrenaline is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import an old Calibre library with corrupted database Beanxx Library Management 3 05-08-2015 04:12 PM
My library is corrupted. CCLady Calibre 23 07-28-2012 09:34 PM
903 Corrupted library Raisan PocketBook 1 04-09-2011 09:20 AM
Calibre library corrupted - slightly freaked out! chilady1 Calibre 6 12-08-2010 08:56 PM
Library corrupted rozie123 Sony Reader 1 05-26-2009 07:02 AM


All times are GMT -4. The time now is 03:20 AM.


MobileRead.com is a privately owned, operated and funded community.