error: database disk image malformed
#1
Hi, I was watching a TV show and when I pressed 'x' to stop, XBMC crashed. No big deal, I'm running a nightly build on OSX Lion, I know the risks.

So I relaunch and Movies is ok but TV does not work, no programs are shown, so I check the log and see this:
Code:
21:31:09 T:2895577792   DEBUG: Load MyVideoNav.xml: 774.29ms
21:31:09 T:2895577792   DEBUG: Alloc resources: 783.69ms (774.41 ms skin load)
21:31:09 T:2895577792   DEBUG: CGUIMediaWindow::GetDirectory (videodb://2/2/)
21:31:09 T:2895577792   DEBUG:   ParentPath = [videodb://2/2/]
21:31:09 T:2895577792   ERROR: SQL: The database disk image is malformed
                                            Query: SELECT * FROM tvshowview
21:31:09 T:2895577792   ERROR: GetTvShowsByWhere failed
21:31:09 T:2895577792   ERROR: GetDirectory - Error getting videodb://2/2/
21:31:09 T:2895577792   ERROR: CGUIMediaWindow::GetDirectory(videodb://2/2/) failed
21:31:09 T:2895577792    INFO:   msg: PICTURE::LoadImage: Unable to open image: /logo.png Error: (2)
21:31:09 T:2895577792   ERROR: Texture manager unable to load file: /logo.png

So it looks like the database became corrupt during the crash. I've taken a copy of the MyVideos54.db file and I'm wondering if there's any hope for repairing it?

I have a backup, but it's not recent. I blame that on QNAP not fixing their time machine support for Lion yet, but that's a whole other issue!

So, an xbmc db, can it be repaired?
Reply
#2
try dumping and reloading the DB:

- install sqlite3
- backup your DB file
Code:
mv MyVideos54.db MyVideos54.db.bak
sqlite3 MyVideos54.db.bak .dump | sqlite3  MyVideos54.db
Reply
#3
wsnipex Wrote:try dumping and reloading the DB:

- install sqlite3
- backup your DB file
Code:
mv MyVideos54.db MyVideos54.db.bak
sqlite3 MyVideos54.db.bak .dump | sqlite3  MyVideos54.db

Huh, well would you look at that, it worked!
Took just a few seconds and made then I was able to view the 'episodes' table in a sqlite viewer (previously it showed as error) and XBMC seems to be just fine with the file.

Thanks for the tip!
To make things better, the updated firmware for the NAS was released today, so the backups work again Smile
Reply
#4
glad to help.
btw, this method also compacts the DB. So if you remove stuff often the files grow a lot without actually containing more data. Essentially the DB will contain holes of empty data. Dumping and reloading will bring down the file size again and even improve performance on large DBs since indexes will be optimized too.
Reply
#5
THanks helped me too.
I Had

Code:
ERROR: SQL: The database disk image is malformed
and
Code:
ERROR: SQL: Unable to open the database file

ran

Code:
pi@raspbmc:~/.xbmc/userdata/Database$ sqlite3 MyVideos78.db "PRAGMA integrity_check"
*** in database main ***
Page 307: btreeInitPage() returns error code 11
On tree page 10 cell 115: Child page depth differs
On tree page 10 cell 116: Child page depth differs
Page 308 is never used
Page 309 is never used
rowid 171 missing from index ixMovieBasePath
Error: database disk image is malformed


your dump / repair saved the day and movie night :-)

Code:
pi@raspbmc:~/.xbmc/userdata/Database$ sqlite3 MyVideos78.db "PRAGMA integrity_check"
ok


edit: my enjoyment was premature, the Dump was only 0 KB. XBMC couldn't start with it. I did end up restoring from backup.
Reply
#6
Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
error: database disk image malformed1