How to fix SQLite (Database disk image is malformed)

Source: Internet
Author: User

From: http://hi.baidu.com/9562512/blog/item/81932e3e432bc33770cf6cd4.html

 


In the case of sqlite3 Database Error "Database disk image is malformed", I ran it for a moment and got it done. I recorded it and helped people to help me. Run
Pragma integrity_check;
Found
* ** In database main ***
On tree page 120611 cell 0: 3 of 4 pages missing from overflow list starting at 120617
On tree page 120616 cell 0: 3 of 4 pages missing from overflow list starting at 120621
On tree page 3309 cell 0: 3 of 4 pages missing from over
Assume that the original database nameabc.db
Run the command (sqlite3 command line tool is required, you can download the http://www.sqlite.org/download.html from the official)

 


sqlite3 abc.db
. Output "_ abctemp. tmp"
. Dump
. Quit

 

 

Create a new databaseabc2.db

sqlite3 abc2.db
. Read "_ abctemp. tmp"

. Quit

Delete ABC. DB, MV abc2.db ABC. DB

Fix the original database name and file permissions, and it should be okay.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.