![]() |
#1 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
Library crash - unable to rebuild
Hi, I am hoping someone can help.
I have a very large fanfiction library with a number of custom columns. Unfortunately, with no warning, it crashed. I am normally good with updating my back up, but forgot to do it for a few weeks, of course after I did a lot of work cleaning up and marking stories read, etc - stuff I would like to keep. Code:
calibre, version 2.0.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 I have deleted the metadata.db files, tried creating a new library, moving the metadata.db file to the old library and trying to restore. I got this error message then Code:
Traceback (most recent call last): File "site-packages\calibre\gui2\ui.py", line 630, in library_moved 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 344, in __init__ File "site-packages\calibre\db\backend.py", line 1066, in fget File "site-packages\calibre\db\backend.py", line 784, in conn File "site-packages\calibre\db\backend.py", line 243, in __init__ File "site-packages\calibre\db\backend.py", line 287, 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 So my question is, is there any way to get the metadata from the opf files into the back up database? I added all the changed files from the old database to the new database by copying them to another drive (just the changed ones) but the metadata didn't add. I would rather not do it all manually if I don't have to. And is there a maximum size on the database before it becomes unstable? I have plenty of room on my hard drive. Thanks for any help! Last edited by BetterRed; 05-10-2015 at 11:41 PM. Reason: Put error message in code box - I couldn't read the very pale blue |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,341
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
First of all update calibre. Then you can run the restore from the command line, that sometimes avoids file access issues caused by antivirus programs.
calibredb restore_database -r |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
Thanks. As soon as it finishes downloading, I will do that and try to rebuild.
Since I mostly use it to download fanfics and remove DRM from my Kindle books, I usually just update when they require it. ![]() |
![]() |
![]() |
![]() |
#4 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
Updated Calibre to the latest version (2.27) 64 bit. Ran the library maintenance restore library and after running about 24 hrs I get this again:
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'F:\\My documents\\Calibre fanfic\\comp fanfics -a\\metadata.db' I didn't turn off the virus check this time. I have to shut down the internet to do that. I'm going to try something different first and download the 32 bit version, shut off the virus, and try again and not touch the computer..... |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,341
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I suggest booting windows into safe mode, making sure all antivirus/file sync/dropbox programs are not running then running the restore.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
I turned off the automatic syncing a while ago when I found it messed with the library. So it no longer runs on startup. My main library also, was not in the syncing folder. (Hey, I learned my lesson after having to rebuild my library after using Google Drive)
![]() I got a "corrupt file" error. So I moved all the files to a new location where I had set up an empty library. I then turned off wifi and virus protection and ran the rebuild. 24+ hours later, I have the majority of my books and data back. Well, the books will always be there, it was the wonderful metadata that I really wanted. Although it rebuild the majority of the library, there were some errors that appear to all be the same: Failed to restore the books in the following folders: F:\My documents\Calibre fanfic\comp fanfics -b\Vixen1836\The Beauty and The Geek (1) 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 1979, in restore_book File "site-packages\calibre\db\cache.py", line 1487, in create_book_entry File "site-packages\calibre\db\backend.py", line 804, in execute File "c:\cygwin64\home\kovid\sw\build\apsw-3.8.2-r1\src\cursor.c", line 231, in resetcursor ConstraintError: ConstraintError: UNIQUE constraint failed: books.id So I am guessing somehow they got the same id as another book in the library. It isn't a lot, so I can manually re-add and fix. I then ran a Library Check and found a lot more extra books and authors. Some may be duplicates that don't matter. Unfortunately, they can't be automatically fixed ![]() So the rest is manual I guess. I copied everything to a notepad file so I have all the info. I have a backup library that was last updated about a month ago. Is there anyway to compare libraries? Thanks for all your help. This is such a great program! |
![]() |
![]() |
![]() |
#7 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You appear to have not read the FAQ and dug yourself into a whole lot of work .
1)Synch OFF (at least the Library folder) while using Calibre 2)Files (books) may not be added to/removed from a Library folder EXCEPT by using Calibre (GUI or CLI). Applies to Calibre Known Items One way to recover: Create a New Empty Library (Local Drives only) withe the same structure (Create/Switch has options) Select All books in existing Library: RIGHT CLICK: Copy to Library:<new> Delete after copy. What is LEFT OVER in your old Library FOLDER, is what Calibre could/did not know about. Those are now your job to deal with and possibly add (using a normal Calibre Add Books method) |
![]() |
![]() |
![]() |
#8 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Add books ==> Add books from directories, including sub-directories (One book per directory, assumes every ebook file is the same book in a different format)
This will add all metadata from the backup OPF files as well. |
![]() |
![]() |
![]() |
#9 | |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
Quote:
The copy library was only a back up and never the main library. Additionally, the Copy sync is only on when I turn it on. I do not need it running constantly. The Google fiasco was a couple years ago. And it was more of an attempt to see if Google Drive would work as a back up. But I did learn how to rebuild a library from it. So the library was on a drive in the computer. This was not the issue. The original library crashed due to a corrupted metadata file. I do not know what caused the corruption. As I said, it was working fine the day before. It is not on an NAS or online drive. A drive check did not show any problems with the drive. However, right before I did the last rebuild, I got a drive check error. So, who knows? My rebuild attempts following the manual and various posts here were not successful. The new metadata files would give error messages. Calibre couldn't find the new libraries. I then sorted the main Calibre folder by date and copied the ones dated since my last backup to a temp folder and added that folder to my back up library, which now has a major amount of duplicates. I tried adding directly but got file is corrupt errors. But copying to a new location seemed to work I then got the bright idea to move the whole library to another empty library folder on the same drive - the library was dead at that point. Multiple efforts to rebuild and restore following the directions had resulted in corruption errors. I tried adding from in place and got error messages. In the new library, I ran restore. It was mostly successful. I have a list of stories I will have to manually add that I obtained from running a library check. This is a fanfiction library. A lot of the stories are no longer available or I would just rebuild it from the URLs. Though that won't help with tracking what I've read and want to read. Authors also add chapters, delete chapters and add new ones, and generally mess stuff up. So just "deleting" duplicates is not an option. And it is large. So adding.... Adding only seems to add some of the metadata I've found. Either that or the OPF files are damaged in the ones I have to add. Or I may have to associate the data to a column? I will continue working on it. As I said, at least I haven't lost any books, just my ease of finding things. But I really appreciate all your help! This has been much easier than using FFDL standalone and an Excel spreadsheet. ![]() Last edited by Ellachanted; 05-14-2015 at 06:52 PM. |
|
![]() |
![]() |
![]() |
#10 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Adding will not add custom columns unless a matching custom column already exists.
(Make sure you used the option I indicated above.) |
![]() |
![]() |
![]() |
#11 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
It may still help to Fix your rebuilt library by making a new (3rd) and that will leave the remaining problems behind.
Not all solutions can be accomplished in a single step ![]() |
![]() |
![]() |
![]() |
#12 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
|
![]() |
![]() |
![]() |
#13 | |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
Quote:
I was just starting to make a new library, with all the various books from the old libraries and the messed up rebuilt one. Clean it up and start all over. Well, I really didn't want to clean my house anyway. ![]() |
|
![]() |
![]() |
![]() |
#14 |
Connoisseur
![]() Posts: 50
Karma: 10
Join Date: Oct 2013
Device: Kindle touch
|
I have a question - I am adding books. It states it is Reading Metadata and adding books to library. It says it is 25% done but there are no books listed yet.
Shouldn't they be showing in the screen? They are adding to the folder (checked with windows explorer) I seem to remember the showed up during this process. But then this may be the most books I've added at once. |
![]() |
![]() |
![]() |
#15 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Add FolderS is 1 task (100% when done) |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Personal experience with restoring library after crash | MiniMouse | Calibre | 16 | 08-26-2014 04:57 AM |
Rebuild library on PC from device? | CrankYanker | Library Management | 2 | 04-22-2013 12:27 AM |
Any way to rebuild meta data for library? | JeremyR | Library Management | 2 | 07-08-2011 05:35 AM |
Thumbnails, how to rebuild Library and get PDF thumbs for old uploads? | rakista | enTourage Archive | 2 | 12-21-2010 10:29 AM |
Retrieve Calibre library after Windows crash? | BikinOn | Calibre | 3 | 05-25-2009 02:45 PM |