Re: Accidentally deleted zotero.sqlite file using disk cleaning tool

I am running Mac OS Monterey 12.4 and accidentally deleted my Zotero library using a disk cleaning tool. Unfortunately, I had not backed up the data directory and I was not using Zotero syncing.

These are the Zotero.sqlite files remaining in my data directory:

zotero.sqlite 1 MB June 24, 2022
zotero.sqlite-journal 91KB "Today"
zotero.sqlite.111.bak 8.8 MB March 20, 2022
zotero.sqlite.bak 1 MB June 14, 2022

Questions: Can I recover any of my Zotero library? Would it be possible to rebuild the library in whole or in part using the Reference Extractor tool on a Word document that contains the most important resources that were in my Zotero library?

Thank you,

JDP
  • edited June 27, 2022
    I assume you've read Locating Missing Zotero Data. Not much more that we can say than what's there.

    But zotero.sqlite.111.bak would be your data as of the Zotero 6 upgrade in March. So you can certainly recover to that.

    If you don't mind, what disk-cleaning tool did you use? I'm a bit curious how people end up doing this — it seems like somewhat of a failure of the tool to suggest wiping out arbitrary unknown files.
  • First, I have read "Locate Missing Zotero Data," but I did not understand how to recover my data using the sqlite.111.bak file. I am an older user, and these things are not as immediately apparent to me as they might be to a younger user. I will read it again to try to figure it out.

    Second, the disk-cleaning tool was MacKeeper, but in all fairness, the fault was entirely mine. I deleted the "cleaned-up" files without looking at them first. Very stupid, I know.
  • This is the relevant section:
    Look for larger zotero.sqlite.bak files in the data directory, or look for a larger zotero.sqlite file in any separate backups you have. (It's not possible to restore your data from the 'storage' files alone.) When Zotero starts up, it reads the zotero.sqlite file in the active data directory, so you can try other copies of zotero.sqlite by copying them to that location and filename. Do not try to import an .sqlite file into Zotero via File → “Import…” — it won't work.
    Make sure you've made backup copies of all of these files before trying anything.
  • Okay, thank you. I will give this a try after making back up copies of the files. I'm leaving soon to fly to Asia, so it might be a couple days before I do, but I will let you know how it turns out.

    Thank you for attending to my post and questions so promptly. I really do appreciate that!
  • By the way, is using the Reference Extractor on a Word document containing most of my resources an alternative way of rebuilding my Zotero library?
  • From the page:
    You can also extract data from any Word or LibreOffice documents you used with the Zotero word processor plugin by using Reference Extractor, though note that any data you re-import this way won't be linked to your existing documents.
    You'd want to start by restoring zotero.sqlite.111.bak.
  • Thank you!
  • Is it possible that I could have had automatic syncing on? Is there some way you can determine whether or not my local data was synced to the Zotero server?
  • You can see the data you have online by clicking Web Library at the top of this page. But no, you don't appear to have been syncing, at least through this account.

    Current versions of Zotero will warn you with a fairly prominent banner if you don't have syncing set up, but you can tell it not to remind you again. You can check the Sync pane of the preferences to see if by some chance you were syncing with another account.
  • In addition to the "zotero.sqlite.111.bak file, 8.8 MB, March 20, 2022" noted above, I have also found in a desktop folder another file titled "zotero.sqlite.bak file, 8.8 MB, March 27, 2022."

    After backing these up, do I simply copy and paste them into the Zotero folder in the Data Directory? (The 111.bak file above is already in there. If it contains my library, why doesn't it show up when I restart Zotero?)

    Assuming that I can restore my library with either or both of these files, will the data still be linked to my existing documents?

  • edited July 2, 2022
    From the linked section, and as I quoted above:

    "When Zotero starts up, it reads the zotero.sqlite file in the active data directory, so you can try other copies of zotero.sqlite by copying them to that location and filename."
    Assuming that I can restore my library with either or both of these files, will the data still be linked to my existing documents?
    It's just your database as of the date of the file. It will work exactly as it worked on that date. Citations for items added to your database later won't be linked, since they won't be in the database.
  • When I double click on those files in the Data Directory, it asks whether I want to import the file into Zotero as a new collection.

    Do I click "Ok"?

    I am not trying to import into Zotero via File → “Import…”
  • edited July 2, 2022
    Nothing says to double-click anything, and it specifically says not to try to import anything. I don't know what you're even double-clicking to get prompted to create a new collection — none of the files discussed would even do that. So whatever you're doing just has nothing whatsoever to do with these instructions.

    Once again:
    When Zotero starts up, it reads the zotero.sqlite file in the active data directory, so you can try other copies of zotero.sqlite by copying them to that location and filename.
    You'll need to read and follow the exact instructions we provide and not do anything it doesn't say to do. We really can't be any clearer than these instructions, so if you're having trouble with them, you should ask a tech-savvy friend to read them and help you.
  • Well, then, my library must not be in those files, because I have copied them into the active data directory and restarted Zotero, and nothing shows up.
  • edited July 2, 2022
    An 8.8 MB zotero.sqlite.111.bak file from March absolutely contains your data as of that date. If you're not seeing it, you haven't followed the instructions correctly.
  • edited July 2, 2022
    because I have copied them into the active data directory and restarted Zotero
    That's not what it says to do.

    "you can try other copies of zotero.sqlite by copying them to that location and filename"
Sign In or Register to comment.