"Tutorial" SQLite database Repair

Source: Internet
Author: User
Tags sqlite sqlite database

SQLite as we all know, not much to say.

Sometimes the data is large, or there is an exception in the stored procedure, and the database can be problematic.

This is the previous company product problems, resulting in software are not open, I took a lot of time to solve, while now available to contribute.

    1. Download a sqlite3 command-line tool to download the command-line shell for the system version

    2. When the download is complete, unzip it to a directory, and drop the database to be repaired in that directory.

    3. Open Terminal (CMD) to enter the directory.

    4. execute the following command: Sqlite3 the name of the database to be repaired . Output "_temp.tmp". dump. quit the command is to extract the contents of the old database and save it to a temporary file .
    5. Use the editor to open the temporary file _temp just generated. tmp look at the last line of the file is not ROLLBACK; --Due to errors delete it and add COMMIT; if the last line is COMMIT; This step is ignored.
    6. to the terminal, enter the command: sqlite3 the new database name . read "_temp.tmp". quit this command is to write the old data into the new database. 
    7. This completes the database repair. There may be a slight flaw, the data will be lost a small fraction, but at least most of the data is still there, and the database can continue to be used.

"Tutorial" SQLite database Repair

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.