Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

places.sqlite Database Troubleshooting

This article describes troubleshooting actions to deal with a broken places.sqlite database.

Places Maintenance Add-On

This option is valid when:

  • Bookmarks/History operations are slower than usual
  • Some (not all) pages are strangely missing from the Awesomebar or history
  • The Library and/or toolbar are not showing any bookmarks
  • The browser hangs on shutdown

This Firefox add-on calls maintenance code that is already in Places, but that for whatever reason may not be runnning for some users.

Always back up your profile folder before you try to fix it!

https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles

https://addons.mozilla.org/en-US/firefox/addon/places-maintenance/

How to (try to) recover from a corrupt places.sqlite

Sometimes after a Firefox/Aurora/Nightly upgrade, history disappears, but bookmarks are at their place. In the profile folder a places.sqlite-corrupt file has been created.

In some cases, this procedure may allow you to recover the corrupt file along with all of its contents (history).

Close Firefox and ensure it's done closing in your task manager.

Before you proceed, make a backup of the Firefox profile folder, in any case.

Create a folder to use temporarily for this work, such as my_work_folder.
Copy places.sqlite-corrupt from the Firefox profile folder to the work folder.

Download the latest precompiled binary Sqlite command-line shell from:
https://www.sqlite.org/download.html
Extract sqlite3 executable into the work folder.

Open a terminal window and navigate to the work folder.
Then open an sqlite shell:

my_work_folder> sqlite3 places.sqlite-corrupt

sqlite> PRAGMA integrity_check;

If the result IS OK, this guide won't help; stop here and please file a bug.

sqlite> .clone places.sqlite

sqlite> PRAGMA user_version;

Note the version number returned by the last pragma query.

sqlite> .exit

Open a new shell for the new database:

my_work_folder> sqlite3 places.sqlite

sqlite> PRAGMA integrity_check;

If the result IS NOT OK, the file cannot be recovered; stop here and please file a bug.

Let's fix the schema version.
NN must be replaced with the number we had noted previously:

sqlite> PRAGMA user_version = NN;

Let's update the page_size value:

sqlite> PRAGMA journal_mode = truncate;
sqlite> PRAGMA page_size = 32768;
sqlite> VACUUM;
sqlite> PRAGMA journal_mode = wal;
sqlite> .exit

Copy the new places.sqlite to the profile folder, overwriting the existing one.
Remove the places.sqlite-corrupt file.

Launch Firefox.

If the database is still broken (missing history, creating -corrupt file, ...), please file a bug.

Document Tags and Contributors

 Contributors to this page: beej, douglas-j-bothwell, Mak77
 Last updated by: beej,