Restoring Deleted Notes
This is a step-by-step instructional guide on how to restore accidentally deleted notes in Joplin using the restoreNoteRevision
command as well as how to find your missing notes in the Joplin database.
This assumes that you do not have a note backup of any kind (other clients, profile backups, JEX export etc.) and you have otherwise run out of options to get the data back.
If you are familiar with Joplin commands and have the ability to open the sqlite database then the more concise instructions can be found in the Joplin FAQ.
Prerequisites
- Joplin desktop newer than v2.0.8 (ideally latest released version)
- A method of opening and browsing SQLite databases. This guide will focus on using SQLiteStudio, available for Windows, macOS and Linux, but you can use any other tools you like if you are more comfortable with them.
- You have note history enabled and are within the configured keep period - see Joplin Help
Step-by-step
If you know the note ID of your missing notes (for example if you have backlinks or have copied the internal Joplin reference at some point then you can skip the database steps and go straight to step 7). Otherwise follow as below:
-
Locate and open a file browser to your Joplin profile directory
Help > Open Profile Directory
. You should have adatabase.sqlite
file. Take a copy of this file and save with a new name as we don't want to make accidental changes to the live copy. -
Open SQLiteStudio and click
Database > Add a database
Leave the database type as SQLite3 and press the folder icon on theFile
box. Navigate to the file you created in step 1 and select it. PressOK
-
Right click the database you added in the
Databases
panel and clickConnect to the Database
. You should see it expand into the Joplin database schema.
-
Double click the
revisions
table in this panel and then click theData
tab on the newly opened page -
Sort the database by clicking the
created_time
column twice so it looks like this:
This will sort the table in order of updates so any changes you made most recently should now be at the top of the table. -
Now comes the manual step, you will need to look carefully at the data contained in the
title_diff
andbody_diff
columns in order to identify your missing notes. If you can't see all of it then you can resize the column and hit the small double arrows to load the rest of the content. You can even copy that field and paste into an editor of your choice to see the data more clearly.
Once you have identified your note you need to look towards the left side and find theitem_id
column (should be the 4th column). Copy that ID (it should be a long string of characters like0133246cb05f406586f4e4b9fcde92fd
). -
Back in Joplin press
Tools > Command Palette
(Windows/Linux) orJoplin > Command Palette
(macOS). Alternatively pressCtrl + Shift + P
(Windows/Linux) orCmd + Shift + P
(macOS).
TyperestoreNoteRevision
followed by a space and then paste youritem_id
you copied and hit return.
If successful you should see something similar to the following:
And as the popup says, you should now find your note in a new notebook namedRestored Notes
. -
Repeat the process for any other notes you have lost.
Further Comments
- To avoid having to do this in the future you should make sure you always have a recent backup of your data. The Simple Backup plugin is highly recommended for this as it can create scheduled backups of not only your profile directory but also automate a full lossless JEX export containing all your notes.
- If your only client is a mobile one then the above may still be possible but you will need to export your profile, copy it to a computer and use the mobile database in place of the desktop one. This is currently only possible on Android but that is beyond the scope of this revision of the guide.
- If you have more than one client connected to your sync target and the other client has not yet synced the deleted notes then it will probably be easier to work from that client by preventing it from syncing (ideally just disconnect from the network) and exporting the note(s) in question where you can easily import it again afterwards.
Other Resources
Guides
Joplin FAQ
How-to by @theCollectiv with focus on Snap and Sqlite command line tools
How-to by @ridgeway with focus on Sqlite command line tools
Restoring from Sync Target by @JackGruber