{"id":917,"date":"2020-05-03T13:58:38","date_gmt":"2020-05-03T20:58:38","guid":{"rendered":"https:\/\/www.casler.org\/wordpress\/?p=917"},"modified":"2020-05-08T11:46:07","modified_gmt":"2020-05-08T18:46:07","slug":"sqlite-fix-for-result-database-disk-image-is-malformed","status":"publish","type":"post","link":"https:\/\/www.casler.org\/wordpress\/sqlite-fix-for-result-database-disk-image-is-malformed\/","title":{"rendered":"SQLite &#8211; Fix for &#8220;Result: database disk image is malformed&#8221;"},"content":{"rendered":"<p>The database for my hot tub was returning IO errors and when I tried to use the VACUUM command, it returned an error:<\/p>\n<p><code>Result: database disk image is malformed<\/code><\/p>\n<p>Let&#8217;s fix this!<\/p>\n<p><!--more--><\/p>\n<p>This is caused by some write corruption of the database. Easiest fix is to export all the data, recreate a new database and then copy over the old database. We can do this in two lines on the command:<\/p>\n<ol>\n<li>cd into the location of the database<\/li>\n<li>Backup your database<\/li>\n<li>Run this series of commands<\/li>\n<\/ol>\n<p><code>sqlite3 databasename.db '.dump' | sqlite3 databasename.db.new<br \/>\nmv databasename.db.new databasename.db<br \/>\n<\/code><\/p>\n<p>That&#8217;s it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The database for my hot tub was returning IO errors and when I tried to use the VACUUM command, it returned an error: Result: database disk image is malformed Let&#8217;s fix this!<\/p>\n","protected":false},"author":1,"featured_media":918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","footnotes":""},"categories":[307],"tags":[],"class_list":["post-917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-systemadmin"],"gutentor_comment":0,"jetpack_featured_media_url":"https:\/\/www.casler.org\/wordpress\/wp-content\/uploads\/2020\/05\/sqlite-database-corrupted.png","_links":{"self":[{"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/posts\/917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/comments?post=917"}],"version-history":[{"count":0,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/posts\/917\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/media\/918"}],"wp:attachment":[{"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/media?parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/categories?post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.casler.org\/wordpress\/wp-json\/wp\/v2\/tags?post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}