Forum

Please or Register to create posts and topics.

SQLite3 Error 11 - database disk image is malformed

I am using RM7.   I just tried to run del unused_media_files.sql and got the SQLite3 Error 11 - database disk image is malformed message.

I have run into this problem before when running del unused_media_files.sql.  When I first encountered the problem, Jerry Bryan generously offered to help.  I uploaded my tree to a cloud drive and he downloaded it to his computer and the script ran without a problem for him.  He thought maybe the issue was that I had OneDrive running while trying to run scripts.  So I paused OneDrive and it didn't make any difference.  I also quit my backup program.  Then one day out of the blue I tried the script without stopping OD or backup and it worked.

I run unused_media_files.sql and PlacesDeleteUnused.sql frequently.  I never have problems deleting unused places.

The only solution I've found is to drag my problem tree into a new tree., but then I have issues with the new tree creating it's own media folder and I end up with a long process relinking media (it always crashes a few times and I have to quit RM and restart it again).

Does anyone have a clue as to why this happens and how to fix it?

I am an SQL dummy, so please use baby words 😉

My laptop specs in case it is important:

Processor Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 2.30 GHz
Installed RAM 64.0 GB (63.8 GB usable)
System type 64-bit operating system, x64-based processor

Appreciate any advice.  Thanks!

Uploaded files:
  • Capture.JPG

Are you referring to the script on the page Media - Delete Unused? It has a different name.

Try this before running the script:

REINDEX; --rebuild table indexes using the fake RMNOCASE

PRAGMA quick_check; --checks the integrity of the database

If the result is OK, the script should run without error.

When you return to using RM, run its Database tool Rebuild Indexes otherwise it will throw errors because the indexes were built on the fake RMNOCASE.

When i did the REINDEX I got errors (see attached - there were about 3 screens of these).

Then I ran the PRAGMA.

Then I ran the delete unused media script and IT WORKED!!!!!!!

THANK YOU!!!!!!!!!!!!  You're a lifesaver 🙂

Uploaded files:
  • Capture.JPG

REINDEX does not produce a long list of errors; quick_check and integrity_check can, especially on a RM database that has not been REINDEXed in SQLite.

Likewise, RM's Database Tool "Test database integrity" or words to that effect will return a long list of errors from a database that has been REINDEXed in SQLite against a fake RMNOCASE collation sequence because it is not a perfect match to the RM RMNOCASE. It may also raise an error on a database that has not been REINDEXed but has been edited in SQLite using a non-identical RMNOCASE. Those errors are resolved by running RM's Rebuild Indexes.

Good general practice until RM Inc provides us with its proprietary RMNOCASE collation sequence to use (I thought I had a commitment from Bruce Buzbee to do so around 2010 but nothing came of it) is to:

  1. REINDEX the RM database file in SQLite before running outboard queries on it.
  2. On returning from SQLite to using the database in RM, run Database Tools > Rebuild Indexes.

Can I jump into this convo? i was using RM7 roots2go, and received this "SQL error 11- image malformed" message just this last week, too. Coincidentally, on (or about) the same day this forum was started.  Totally heartbroken... 13k hand-entered people, and almost 8GB of data. When I realized I was going to need to talk to RootsMagic Tech Support - and I knew they were gonna ask - I upgraded to RM8, but I still have RM7. I'm told that they can fix the file if I can open it, but of course, with this error I can't open it. I am a Supervisor at a Library & help folks with computer tech stuff all the time, but this SQLite error 11 has me in a panic, since I know nothing about SQL. I mentioned to the RootsMagic Tech support person that I had heard that some SQL tools might be able to recover the file, and she said that they don't do that... then she mentioned Tom Holden by name. I'm not sure how this site works... is there someone here who could help me with my file? or is there a third-party vendor you would recommend? My files were being regularly copied to GoogleDrive, but some of those appear to be corrupted, as well. I found one copy of the file that is 5 months old that might be ok, but I haven't had the heart to find out yet. Planning to jump back into the conversation with the RootsMagic tech tomorrow morning. At this point, I don't know if my file - I'll call it Schrödinger's File - is dead or alive. If I should start a separate page (instead of jumping in here) let me know.

Your message is consistent with the topic but the solution, if any, may be very different. You mentioned RootsMagic To-Go; were you using the database file stored on a flash drive aka memory stick?

I have had zero to full success recovering data from RM files with this error. It depends on where and how widely corruption has occurred. It might be confined to a few records in one table or it could be across multiple tables and many records. It takes methodical checking, trial and error to narrow it down and then extract what is intact to a new database file.

Let me know if you want me to have a look at it. And there may be a couple of others here willing to have a go at it.

Teresa Mercier has reacted to this post.
Teresa Mercier

I am no expert, but have you tried to drag and drop your RM7 database into a new one?  I'm not sure if RM to Go has this feature.  Do you have the full RM7 program?  Tom Holden and others are the experts, so listen to them.

Teresa Mercier has reacted to this post.
Teresa Mercier

Jlodge, i'm game to try anything... when you say "drag and drop your RM7 database into a new one?" are you talking about the .rmgc file? i'm wondering drop & drag it into a new what? a new folder? or? i still have rm7, and have downloaded my recent backup from googledrive to my harddrive, then tried to open it in rm7... no go. 🙁

tom, yes, i was using togo on a flash drive, and storing the file on the same drive. to prevent loss in case something happened to the flashdrive i was regularly uploading the .rmgc file to googledrive, a plan that has not served me well. how do i share the .rmgc file with you/others? do i upload it to this page or do i send it to you directly?

Yes, the .rmgc file.  Although now that I think about it, if you can't open your "malformed" file this won't work.  Sorry.  I feel for you.  But for future reference:  see https://www.youtube.com/watch?v=-dLBIU_Tx9t8