View Single Post
Old 10-14-2012, 06:02 AM   #2
sja45uk
Junior Member
sja45uk began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2012
Device: Sony PRS-500
REBUILD DATABASE RESOLVED
======================
Spoiler:

Calibre Database Restore
------------------------
C:\Users\Steve> "C:\Program Files\Calibre2\calibredb.exe" restore_database --really-do-it
...
All Wrapped Up (anthology) ... 100%
Restoring database succeeded
old database saved as C:\Users\Steve\Calibre Library\metadata_pre_restore.db
Some errors occurred. A detailed report was saved to calibre_restore_report.txt

C:\Users\Steve>

Windows Explorer
----------------
C:\Users\Steve\Calibre Library\
metadata_pre_restore.db 14/10/2012 05:11 Data Base File 20,660 KB
metadata.db 14/10/2012 06:23 Data Base File 18,516 KB

Windows Explorer - C:\Users\Steve\
calibre_db_restore_report.txt 14/10/2012 06:23 Text Document 7 KB

Restore Text Document
---------------------
C:\Users\Steve\calibre_db_restore_report.txt

Failed to restore the books in the following folders:

C:\Users\Steve\Calibre Library\<AUTHOR>\<BOOK> Traceback (most recent call last):
File "site-packages\calibre\library\restore.py", line 159, in scan_library
File "site-packages\calibre\library\restore.py", line 181, in process_dir
File "site-packages\calibre\ebooks\metadata\opf2.py", line 564, in __init__
File "xpath.pxi", line 455, in lxml.etree.XPath.__call__ (src/lxml/lxml.etree.c:115107)
File "apihelpers.pxi", line 37, in lxml.etree._documentOrRaise (src/lxml/lxml.etree.c:11215)
TypeError: Invalid input object: NoneType

C:\Users\Steve\Calibre Library\<AUTHOR>\<BOOK> Traceback (most recent call last):
Traceback (most recent call last):
File "site-packages\calibre\library\restore.py", line 245, in restore_books
File "site-packages\calibre\library\restore.py", line 268, in restore_book
File "site-packages\calibre\library\sqlite.py", line 313, in run
IntegrityError: columns book, format are not unique

C:\Users\Steve\Calibre Library\<AUTHOR>\<BOOK> Traceback (most recent call last):
Traceback (most recent call last):
File "site-packages\calibre\library\restore.py", line 245, in restore_books
File "site-packages\calibre\library\restore.py", line 259, in restore_book
File "site-packages\calibre\library\database2.py", line 3352, in create_book_entry
File "site-packages\calibre\library\sqlite.py", line 313, in run
IntegrityError: PRIMARY KEY must be unique

Start Calibre
-------------
Corrupted database - popup window
?
The library database at C:\Users\Steve\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.

Show details
------------
calibre, version 0.9.2
Corrupted database: The library database at C:\Users\Steve\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 228, in initialize_db
File "site-packages\calibre\library\database2.py", line 198, in __init__
File "site-packages\calibre\library\database2.py", line 146, in connect
File "site-packages\calibre\library\sqlite.py", line 366, in connect
DatabaseException: disk I/O error
RemoteTraceback (most recent call last):
File "site-packages\calibre\library\sqlite.py", line 248, in run
File "site-packages\calibre\library\sqlite.py", line 226, in connect
OperationalError: disk I/O error

Yes
---
restoring database from backup

Choose a location for your new calibre e-book library - popup window
(click Calibre Library in left panel)
Folder: Calibre Library
(click Select Folder button)

calibre.exe - popup window (1st)
--------------------------------
calibre.exe has stopped working

Windows is collecting more information about the problem.
This might take several minutes...

calibre.exe - popup window (2nd)
--------------------------------
Do you want to send more information about the problem?

Additional details about what went wrong can help Microsoft create a solution.
(press View Details)

Files that help describe the problem:
C:\Users\Steve\AppData\Local\temp\WER2DA6.tmp.WERI nternalMetadata.xml
C:\Users\Steve\AppData\Local\temp\WER71E7.tmp.appc ompat.txt
C:\Users\Steve\AppData\Local\temp\WER7523.tmp.mdmp

Read our privacy statement online:
http://go.microsoft.com/fwlink/?link...8&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt

(press Cancel button)
Both popup windows disappear.

Windows Explorer
----------------
Windows Explorer - C:\Users\Steve\Calibre Library\
metadata.db 14/10/2012 07:01 Data Base File 20,660 KB

ALTERNATIVE
===========

Try starting Calibre without metadata.db file
---------------------------------------------
(pulldown 'Choose calibre library to work with' menu)
(select 'Library Maintenance > Check library' option)

Checking library integrity

Success
?
Found no errors in your calibre library database.
Do you want calibre to check if the files in your library match the information in the

database?

(click 'Yes' button)
--------------------
Calibre starting library scan - this may take some time
Check Library -- Problems found

Name Path from library
> Invalid titles
Unknown Unknown\Unknown - Unknown.pdf
_Archive _Archive\metadata.db-journal
_Archive _Archive\meta_db_prefs_backup.json
> Extra titles
(very long list in alphabetical order of <AUTHOR>\<BOOK>)
> Invalid authors
error.txt error.txt
metadata - Copy.db metadata - Copy.db
metadata_pre_restore.db metadata_pre_restore.db
> Extra authors
(very long list in alphabetical order of <AUTHOR>)
Missing book formats
Extra book formats
Unknown files in books
Missing covers files
Cover files not in database
Folders raising exceptions

Names to ignore: _Archive

Extensions to ignore

Help

calibre stores the list of your books and their metadata in a database. The actual book files

and covers are stored as normal files in the calibre library folder. The database contains a

list of the files and covers belonging to each book entry. This tool checks that the actual

files in the library folder on your computer match the information in the database.

The result of each type of check is shown to the left. The various checks are:
Invalid titles: These are files and folders appearing in the library where books titles should,

but that do not have the correct form to be a book title.
Extra titles: These are extra files in your Calibre library that appear to be correctly-formed

titles, but have no corresponding entries in the database

* Invalid authors: These are files appearing in the library where only author folders should

be.

* Extra authors: These are folders in the Calibre library that appear to be authors but that

do not have entries in the database

* Missing book formats: These are book formats that are in the database but have no

corresponding format file in the book's folder.

* Extra book formats: These are book format files found in the book's folder but not in the

database.

* Unknown files in books: These are extra files in the folder of each book that do not

correspond to a known format or cover file.

* Missing cover files: These represent books that are marked in the database as having covers

but the actual cover files are missing.

* Cover files not in database: These are books that have cover files but are marked as not

having covers in the database.

* Folder raising exception: These represent folders in the Calibre library that could not be

processed/understood by this tool.

There are two kinds of automatic fixes possible: Delete marked and Fix marked.

Delete marked is used to remove extra files/folders/covers that have no entries in the

database. Check the box next to the item you want to delete. Use with caution.

Fix marked is applicable only to covers and missing formats (the three lines marked 'fixable').

In the case of missing cover files, checking the fixable box and pushing this button will tell

calibre that there is no cover for all of the books listed. Use this option if you are not

going to restore the covers from a backup. In the case of extra cover files, checking the

fixable box and pushing this button will tell Calibre that the cover files it found are correct

for all the books listed. Use this when you are not going to delete the file(s). In the case of

missing formats, checking the fixable box and pushing this button will tell calibre that the

formats are really gone. Use this if you are not going to restore the formats from a backup.

(press 'Copy to clipboard - button)

(press 'Done' button)

Calibre window
--------------
(pulldown 'Choose calibre library to work with' menu)
(select 'Library Maintenance > Restore database' option)

Are you sure?
?
Your list of books, with all their metadata is stored in a single file, called a database. In

addition, metadata for each individual book is stored in that books' folder, as a backup.

This operation will rebuild the database from the individual book metadata. This is useful if

the database has been corrupted and you get a blank list of books.

Do you want to restore the database?

(click 'Yes' button)

Restoring database - popup window
---------------------------------
Restoring database from backups, do not interrupt, this will happen in three stages...

Windows Explorer
----------------
C:\Users\Steve\Calibre Library\
metadata_pre_restore.db 14/10/2012 07:40 Data Base File 116 KB
metadata.db 14/10/2012 09:02 Data Base File 18,516 KB

SOLUTION
--------
For a successful database rebuild, deleting the metadata.db was essential before doing the database rebuild. The following failed to delete or rename this file, so was destined to be unsuccessful with whatever was the cause of this problem. However, I have not determined whether the two ways of rebuild the database are exactly equivalent (although I assume they are).

calibredb restore_database --really-do-it

In addition, it appears the the term restore_database is misleading because it is really a rebuild_database operation as it does not recover the database from a single archive file.

Last edited by theducks; 10-14-2012 at 10:08 AM. Reason: wrap HUGE paste in spoiler
sja45uk is offline   Reply With Quote