Migrating Plex server - sqlite tables empty in database backup

Server Version#: Not sure. All I have is a backup, and I’m not sure if I can determine the version from there. It would have been one of the most recent versions in the FreeBSD 12.0 repos. I remember that I updated to FreeBSD 12.0 in late October and I remember that Plex updated at the same time.

For reasons mostly unrelated to Plex, I decided to rebuild my Plex server and migrate it from bare-metal FreeBSD to Docker/Kubernetes running on Ubuntu. I wanted to make sure my metadata changes were preserved, so I backed up everything in /usr/local/plexdata/Plex Media Server/ before wiping the server.

The file paths to my data have changed, so I started following the directions in this post: [HowTo] Plex database modification - Moving media the right/wrong way

However, upon inspecting the sqlite tables, all of them appear to be empty:

# sqlite3 com.plexapp.plugins.library.db
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
sqlite> SELECT * FROM section_locations;
sqlite> SELECT id FROM section_locations;

Any SELECT statement I run on any table returns nothing. This is leading me to believe I’ve somehow taken a bad backup, but I want to confirm this. I’m experienced with MySQL, but not too much with sqlite. Perhaps I’m using an incompatible version or I’m doing something else wrong?

If I did take a bad backup, what did I do wrong?

The first thing I would suggest is making a copy of your database and not work on your only copy… That way if something does mess up, you still have a virgin copy to start over with…

I did this a while ago… I used the database from my Windows 7 PLEX box to kick start a FreeBSD install of PLEX… I entered the exact commands that were show in the post, using my old and new paths and it worked just fine… I don’t know where you are getting:

sqlite> SELECT * FROM section_locations;
sqlite> SELECT id FROM section_locations;

Try running the commands shown in the thread… Like others in that thread, I didn’t have one of the four commands do anything but the other three did make changes and when I fired up PLEX with the corrected database on my FreeBSD box, it worked fine…

I would suspect that your database backup is good, maybe you’re just trying to run MySQL commands in sqlite… Just my two cents…

The first thing I would suggest is making a copy of your database and not work on your only copy… That way if something does mess up, you still have a virgin copy to start over with…

Already doing that. I have a backup saved on another computer and I’ve made a copy of com.plexapp.plugins.library.db.

I don’t know where you are getting:

sqlite> SELECT * FROM section_locations;
sqlite> SELECT id FROM section_locations;

I’m just trying to look at the existing content in the table before I modify it. I did confirm that the SELECT statement exists in sqlite. The SELECT statements return nothing, and I would therefore be updating nothing.

SELECT shows nothing in any of the four tables they want me to update:

sqlite> SELECT * FROM section_locations;
sqlite> SELECT * FROM metadata_items;
sqlite> SELECT * FROM media_streams;
sqlite> SELECT * FROM media_parts;

Like others in that thread, I didn’t have one of the four commands do anything but the other three did make changes

How did you see if it was making changes? I’ve been messing around with sqlitetutorial.net, and it looks like UPDATE statements don’t ever return a response regardless if changes were made or not.

I think I’m going to try using the database without making any changes and see if Plex complains about missing libraries. If it does, I’ll run the commands on the tables that at least appear empty and try again.

IIRC, it only returns an error if the command didn’t work, otherwise you just get a prompt… It’s been at least 2 or 3 years ago…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.