Posted by Ben1622 2015-03-30T16:38:10Z
I cleared the entries in the devices table in preparation of importing a current inventory file from a .csv. When I tried the import, I got an error that read:
[ database disk image is malformed ]
Exception Name: NS_ERROR_FILE_CORRUPTED
Exception Message: Component returned failure code: 0x8052000b (NS_ERROR_FILE_CORRUPTED) [mozIStorageStatement.execute]
When I ran the PRAGMA quick_check, I got the error «btreeInitPage() returns error code 11».
What do I need to do to fix this corruption?
5 Replies
-
Hi,
How did you empty out the devices table?
Was this post helpful?
thumb_up
thumb_down
-
Using the SQLite Manager add-in for Firefox, I right-clicked on the table and chose «Empty Table.»
Was this post helpful?
thumb_up
thumb_down
-
Spiceworks doesnt support manual database edits. Is there a backup from which you can restore?
Was this post helpful?
thumb_up
thumb_down
-
There should be. I was wondering if it was possible to fix the file without restoring, but from what you say, I imagine not. Thanks for your input. It is greatly appreciated.
Was this post helpful?
thumb_up
thumb_down
-
Thanks for the help. I’m doing fine now.
Was this post helpful?
thumb_up
thumb_down
Read these next…
Green Brand Rep Wrap-Up: January 2023
Spiceworks Originals
Hi, y’all — Chad here. A while back, we used to feature the top posts from our brand reps (aka “Green Gals/Guys/et. al.) in a weekly or monthly wrap-up post. I can’t specifically recall which, as that was approximately eleven timelines ago. Luckily, our t…
Help with domain controller setup
Windows
I just got a new job as the only IT person for a business with around 270 employees (I would say probably less than half use computers) They don’t have any policies or procedures when it comes to IT, as they have never had an IT person. My background cons…
Malicious URLs
Security
We have firewall, we have endpoint protection, we have Safe links and Attachments for Office 365 (Microsoft Defense for Office 365 Plan 1), and still receiving links that lead to malicious web sites.It seems like security companies still didn’t develop a …
Snap! — Old Batteries, Lovable Bots, Quantum Breakthrough, Should We Trust AI?
Spiceworks Originals
Your daily dose of tech news, in brief.
Welcome to the Snap!
Flashback: February 8, 1996: The massive Internet collaboration “24 Hours in Cyberspace” takes place (Read more HERE.)
Bonus Flashback: February 8, 1974: Americans end outer spa…
Large collection of Mac Minis
Best Practices & General IT
We are getting rid of a lot of older equipment that doesn’t have a purpose anymore on our campus. Most of it is 2010 and 2014 Mac Minis. When they were purchased, they were the absolute base model, so nothing special about them. I’ve reached out to multip…
Recently I came across a rather worrying SQLite database error:
Error: database disk image is malformed
Hrm, that’s odd. Upon double-checking, it looked like the database was functioning (mostly) fine. The above error popping up randomly was annoying though, so I resolved to do something about it. Firstly, I double-checked that said database was actually ‘corrupt’:
sudo sqlite3 path/to/database.sqlite 'PRAGMA integrity_check';
This outputted something like this:
*** in database main ***
Main freelist: 1 of 8 pages missing from overflow list starting at 36376
Page 23119: btreeInitPage() returns error code 11
On tree page 27327 cell 30: 2nd reference to page 27252
Uh oh. Time to do something about it then! Looking it up online, it turns out that the ‘best’ solution out there is to export to an .sql
file and then reimport again into a fresh database. That’s actually quite easy to do. Firstly, let’s export the existing database to an .sql
file. This is done via the following SQL commands (use sqlite3 path/to/database.db
to bring up a shell)
.mode insert
.output /tmp/database_dump.sql
.dump
.exit
With the database exported, we can now re-import it into a fresh database. Bring up a new SQLite3 shell with sqlite3
, and do the following:
.save /tmp/new_database.sqlite
.read /tmp/database_dump.sql
.exit
…that might take a while. Once done, swap our old corrupt database out for your shiny new one and you’re done! I would recommend keeping the old one as a backup for a while just in case though (perhaps bzip2 path/to/old_database.sqlite
?).
Also, if the database is on an embedded system, you may find that downloading it to your local computer for the repair process will make it considerably faster.
Found this useful? Still having issues? Comment below!
Sources
- Fixing the SQLite error “The database disk image is malformed”
- SQLiteException “database disk image is malformed”
SQLite has an integrity check. Need time to study how to fix problems. Here is a start by finding the errors.
#DIM ALL
#INCLUDE «sqlitening.inc»
FUNCTION PBMAIN () AS LONG ‘integrity.bas
LOCAL sDatabase AS STRING, result AS LONG
sDataBase = «sample.db3»
result = slIntegrityCheck(sDatabase)
IF result = 0 THEN ? «No problem detected»,,EXE.NAME$
END FUNCTION
FUNCTION slIntegrityCheck(sDatabase AS STRING) AS LONG
LOCAL result AS LONG, s AS STRING
result = slOpen(sDatabase,»E0″)
IF result THEN FUNCTION = result:? slGetError,%MB_ICONERROR,»Open database»:EXIT FUNCTION
result = slsel(«pragma integrity_check(10)»,0,»E0″)
IF result THEN FUNCTION = result:? slGetError,%MB_ICONERROR,»Pragma Integrity check»:EXIT FUNCTION
DO WHILE slGetRow:s+=slf(1)+ $CR:LOOP
IF s<> «ok»+$CR THEN ? s,,STR$(LEN(s)):FUNCTION = 999
END FUNCTION
‘https://www.sqlite.org/pragma.html#pragma_integrity_check
‘PRAGMA schema.integrity_check;
‘PRAGMA schema.integrity_check(N)
‘
‘This pragma does an integrity check of the entire database.
‘The integrity_check pragma looks for out-of-order records, missing pages, malformed records,
‘missing index entries, and UNIQUE and NOT NULL constraint errors. If the integrity_check pragma finds
‘problems, strings are returned (as multiple rows with a single column per row) which describe the problems.
‘Pragma integrity_check will return at most N errors before the analysis quits, with N defaulting to 100.
‘If pragma integrity_check finds no errors, a single row with the value ‘ok’ is returned.
‘
‘PRAGMA integrity_check does not find FOREIGN KEY errors. Use the PRAGMA foreign_key_check command for to find errors in FOREIGN KEY constraints.
‘
‘See also the PRAGMA quick_check command which does most of the checking of PRAGMA integrity_check but runs much faster.
Causes of database corruption: http://www.sqlite.org/howtocorrupt.html
File format: http://www.sqlite.org/fileformat.html
One suggested method on nabble is to not attempt repair on a corrupt database.
Use the most recent backup file and the log of transactions since then.
We all know that some users won’t have a backup so a method to force backup and logging is needed.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
Hi,
Thank you, but it does not help.
C:UsersMolnarDocumentsLocus mentés1>Sqlite3.exe tracks.db «PRAGMA integrity_check»
*** in database main ***
On page 3524 at right child: Failed to read ptrmap key=3449
On page 1159 at right child: Failed to read ptrmap key=3486
On page 1159 at right child: Failed to read ptrmap key=3484
On page 1159 at right child: Failed to read ptrmap key=3485
On page 1159 at right child: Failed to read ptrmap key=3483
On page 1159 at right child: Failed to read ptrmap key=3482
On page 1159 at right child: Failed to read ptrmap key=3479
Page 3169: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 7 at right child: Failed to read ptrmap key=3336
Page 3336: btreeInitPage() returns error code 11
Page 3211: btreeInitPage() returns error code 11
Page 4264: btreeInitPage() returns error code 11
Page 4261: btreeInitPage() returns error code 11
Page 4260: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
Page 4263: btreeInitPage() returns error code 11
Page 4259: btreeInitPage() returns error code 11
Page 4258: btreeInitPage() returns error code 11
Page 4257: btreeInitPage() returns error code 11
Page 3254: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 3131 at right child: Failed to read ptrmap key=3431
On page 3131 at right child: Failed to read ptrmap key=3430
On page 3131 at right child: Failed to read ptrmap key=3429
On page 3131 at right child: Failed to read ptrmap key=3442
On page 3131 at right child: Failed to read ptrmap key=3428
On page 3131 at right child: Failed to read ptrmap key=3426
On page 3131 at right child: Failed to read ptrmap key=3425
On page 3131 at right child: Failed to read ptrmap key=3424
Page 3424: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3441
On page 3131 at right child: Failed to read ptrmap key=3423
Page 3423: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3422
Page 3422: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3420
Page 3420: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3419
Page 3419: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 4023 at right child: Failed to read ptrmap key=3446
On page 4023 at right child: Failed to read ptrmap key=3481
On page 4023 at right child: Failed to read ptrmap key=3474
On page 4023 at right child: Failed to read ptrmap key=3468
On page 4023 at right child: Failed to read ptrmap key=3463
On page 4023 at right child: Failed to read ptrmap key=3455
On page 4023 at right child: Failed to read ptrmap key=3448
Page 3184: btreeInitPage() returns error code 11
Page 3177: btreeInitPage() returns error code 11
Page 3182: btreeInitPage() returns error code 11
Page 3190: btreeInitPage() returns error code 11
Page 3187: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3339
Page 3339: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3405
Page 3405: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3404
Page 3404: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3398
Page 3398: btreeInitPage() returns error code 11
Page 3233: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3375
Page 3375: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3379
Page 3379: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3362
Page 3362: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3355
Page 3355: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3346
Page 3346: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3340
Page 3340: btreeInitPage() returns error code 11
Page 3201: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3322
Page 3322: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3329
Page 3329: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3308
Page 3308: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3319
Page 3319: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3295
Page 3295: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3297
Page 3297: btreeInitPage() returns error code 11
Page 3229: btreeInitPage() returns error code 11
Page 3275: btreeInitPage() returns error code 11
Page 3281: btreeInitPage() returns error code 11
Page 3261: btreeInitPage() returns error code 11
Page 3260: btreeInitPage() returns error code 11
Page 3246: btreeInitPage() returns error code 11
Page 3239: btreeInitPage() returns error code 11
Page 3231: btreeInitPage() returns error code 11
Page 3228: btreeInitPage() returns error code 11
Page 3223: btreeInitPage() returns error code 11
Page 3209: btreeInitPage() returns error code 11
Page 3199: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3376
Hi,
Thank you, but it does not help.
C:UsersMolnarDocumentsLocus mentés1>Sqlite3.exe tracks.db «PRAGMA integrity_check»
*** in database main ***
On page 3524 at right child: Failed to read ptrmap key=3449
On page 1159 at right child: Failed to read ptrmap key=3486
On page 1159 at right child: Failed to read ptrmap key=3484
On page 1159 at right child: Failed to read ptrmap key=3485
On page 1159 at right child: Failed to read ptrmap key=3483
On page 1159 at right child: Failed to read ptrmap key=3482
On page 1159 at right child: Failed to read ptrmap key=3479
Page 3169: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 7 at right child: Failed to read ptrmap key=3336
Page 3336: btreeInitPage() returns error code 11
Page 3211: btreeInitPage() returns error code 11
Page 4264: btreeInitPage() returns error code 11
Page 4261: btreeInitPage() returns error code 11
Page 4260: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
Page 4263: btreeInitPage() returns error code 11
Page 4259: btreeInitPage() returns error code 11
Page 4258: btreeInitPage() returns error code 11
Page 4257: btreeInitPage() returns error code 11
Page 3254: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 3131 at right child: Failed to read ptrmap key=3431
On page 3131 at right child: Failed to read ptrmap key=3430
On page 3131 at right child: Failed to read ptrmap key=3429
On page 3131 at right child: Failed to read ptrmap key=3442
On page 3131 at right child: Failed to read ptrmap key=3428
On page 3131 at right child: Failed to read ptrmap key=3426
On page 3131 at right child: Failed to read ptrmap key=3425
On page 3131 at right child: Failed to read ptrmap key=3424
Page 3424: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3441
On page 3131 at right child: Failed to read ptrmap key=3423
Page 3423: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3422
Page 3422: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3420
Page 3420: btreeInitPage() returns error code 11
On page 3131 at right child: Failed to read ptrmap key=3419
Page 3419: btreeInitPage() returns error code 11
On page 7 at right child: Child page depth differs
On page 4023 at right child: Failed to read ptrmap key=3446
On page 4023 at right child: Failed to read ptrmap key=3481
On page 4023 at right child: Failed to read ptrmap key=3474
On page 4023 at right child: Failed to read ptrmap key=3468
On page 4023 at right child: Failed to read ptrmap key=3463
On page 4023 at right child: Failed to read ptrmap key=3455
On page 4023 at right child: Failed to read ptrmap key=3448
Page 3184: btreeInitPage() returns error code 11
Page 3177: btreeInitPage() returns error code 11
Page 3182: btreeInitPage() returns error code 11
Page 3190: btreeInitPage() returns error code 11
Page 3187: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3339
Page 3339: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3405
Page 3405: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3404
Page 3404: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3398
Page 3398: btreeInitPage() returns error code 11
Page 3233: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3375
Page 3375: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3379
Page 3379: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3362
Page 3362: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3355
Page 3355: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3346
Page 3346: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3340
Page 3340: btreeInitPage() returns error code 11
Page 3201: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3322
Page 3322: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3329
Page 3329: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3308
Page 3308: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3319
Page 3319: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3295
Page 3295: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3297
Page 3297: btreeInitPage() returns error code 11
Page 3229: btreeInitPage() returns error code 11
Page 3275: btreeInitPage() returns error code 11
Page 3281: btreeInitPage() returns error code 11
Page 3261: btreeInitPage() returns error code 11
Page 3260: btreeInitPage() returns error code 11
Page 3246: btreeInitPage() returns error code 11
Page 3239: btreeInitPage() returns error code 11
Page 3231: btreeInitPage() returns error code 11
Page 3228: btreeInitPage() returns error code 11
Page 3223: btreeInitPage() returns error code 11
Page 3209: btreeInitPage() returns error code 11
Page 3199: btreeInitPage() returns error code 11
On page 3583 at right child: Failed to read ptrmap key=3376
I was synching my photos, when my Macbook ran out of battery.
It hibernated and started again with power attached.
Now Lightroom is stuck with the progress spinner and does not show my library anymore.
This really does not build confidence of being able to trust all my pictures with a new product in Version 1.0, when after the 3rd day of usage I’m unable to access any of my images!
Here are some logs from Console:
default | 22:29:32.981702 -0700 | Adobe Lightroom CC Helper | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | maybePurgeLeastRecentlyAccessed encountered an error: %s | Database "/Users/stefan/Pictures/Lightroom Library.lrlibrary/79239ecf2a2a4438a6373609fc334137/Managed Catalog.mcat": library routine called out of sequence |
Statement: SELECT fullDocId AS selectIdCol, revId, sequence, content, annotation, hasConflicts,
docs.deleted AS deleted, | |||||
docs.mostRecentRevSequence AS mostRecentRevSequence | |||||
FROM revs | |||||
INNER JOIN docs ON docs.winningRevSequence = revs.sequence | |||||
WHERE | |||||
docs.localDocId = ? (error code 21) | |||||
default | 22:29:32.983940 -0700 | Adobe Lightroom CC Helper |
Bad sqlite return code: 21. Info: library routine called out of sequence
0: field _bindByPositionMethod - C
1: [unnamed] - 1753170016:1056+27
2: upvalue ? - 67365416:1079+82
3: [unnamed] - 67365416:1387+17
4: global pcall - C
5: [unnamed] - 1753170016:1339+39
6: [unnamed] - tail
7: upvalue ? - 67365416:1415+7
8: [unnamed] - 1151015846:106+6
9: global pcall - C
10: upvalue ? - 1875443985:839+14
11: [unnamed] - 1875443985:951+11
12: [unnamed] - tail
13: [unnamed] - C
---------------------------------
default | 22:29:32.984258 -0700 | Adobe Lightroom CC Helper | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | maybePurgeLeastRecentlyAccessed encountered an error: %s | Database "/Users/stefan/Pictures/Lightroom Library.lrlibrary/79239ecf2a2a4438a6373609fc334137/Managed Catalog.mcat": library routine called out of sequence |
Statement: SELECT fullDocId AS selectIdCol, revId, sequence, content, annotation, hasConflicts,
docs.deleted AS deleted, | |||||
docs.mostRecentRevSequence AS mostRecentRevSequence | |||||
FROM revs | |||||
INNER JOIN docs ON docs.winningRevSequence = revs.sequence | |||||
WHERE | |||||
docs.localDocId = ? (error code 21) | |||||
default | 22:29:32.986296 -0700 | Adobe Lightroom CC Helper |
Bad sqlite return code: 21. Info: library routine called out of sequence
0: field _bindByPositionMethod - C
1: [unnamed] - 1753170016:1056+27
2: upvalue ? - 67365416:1079+82
3: [unnamed] - 67365416:1387+17
4: global pcall - C
5: [unnamed] - 1753170016:1339+39
6: [unnamed] - tail
7: upvalue ? - 67365416:1415+7
8: [unnamed] - 1151015846:106+6
9: global pcall - C
10: upvalue ? - 1875443985:839+14
11: [unnamed] - 1875443985:951+11
12: [unnamed] - tail
13: [unnamed] - C
---------------------------------
default | 22:29:32.986622 -0700 | Adobe Lightroom CC Helper | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | NmbVolumeAgent:ACF65E13-3F74-3135-BA36-EFC196185BD7 | ERROR | maybePurgeLeastRecentlyAccessed encountered an error: %s | Database "/Users/stefan/Pictures/Lightroom Library.lrlibrary/79239ecf2a2a4438a6373609fc334137/Managed Catalog.mcat": library routine called out of sequence |
Statement: SELECT fullDocId AS selectIdCol, revId, sequence, content, annotation, hasConflicts,
docs.deleted AS deleted, | |||||
docs.mostRecentRevSequence AS mostRecentRevSequence | |||||
FROM revs | |||||
INNER JOIN docs ON docs.winningRevSequence = revs.sequence | |||||
WHERE | |||||
docs.localDocId = ? (error code 21) | |||||
default | 22:29:54.033089 -0700 | Adobe Lightroom CC Helper | WFRxContinuousTask | ERROR | Continuous task "WFCatIdleDownloader" sent onError: "<<<SQLite database corrupt>>>" |
default | 22:29:59.368950 -0700 | Adobe Lightroom CC Helper | WFRxContinuousTask | ERROR | Continuous task "NmbVolumeAgent:Proactive" sent onError: "<<<SQLite database corrupt>>>" |
Also, what is the proper way of filing a technical bug report for Adobe products?