Migrate Plex Watch History

Move Viewstate/Ratings from One Install to Another

The watched/unwatched, view progress, and ratings are stored in an install-independent fashion that makes them easy to move between installations or servers.

In order to do so, you’ll need to use SQLite commands. These are built in to macOS, but you may need to install support for other operating systems.

Related Page : SQLite


Before you do anything, make sure that the Plex Media Server is not actively running on either the source or destination install.

Database Location

The main Plex Media Server database is com.plexapp.plugins.library.db , which is found at /Plug-in Support/Databases/ inside the normal server data directory. See our Where is the Plex Media Server data directory located? for details on where to find the Plex Media Server data directory.

*For PlexGuide and PTS/MHA you will find your plex database here:

/opt/appdata/plex/database/Library/Application Support/Plex Media Server/Plug-in Support/Databases

Related Page : Where is the Plex Media Server data directory located?

Database Commands

The following example commands are run from the command-line when inside the directory noted above.

Source Install

On your source Plex Media Server installation, export from the old database:

echo ".dump metadata_item_settings" | sqlite3 com.plexapp.plugins.library.db | grep -v TABLE | grep -v INDEX > settings.sql

Destination Install

Copy the settings.sql file you created to the new installation. On that new installation, add the data to the new database:

cat settings.sql | sqlite3 com.plexapp.plugins.library.db

Source information

1 Like

Need help doing this on the PG server please…
I understand how to extract this on windows using dbbrowser for sql but not the above commands.
for reasons (my stupidity) i have had to restore plex server from a backup that is 5 days old so users have lost the viewstate from te last five days.not disastrous but not ideal.
So i AT LEAST had the brains to backup the com.plexapp.plugins.library.db onto a root folder on the server (small mercies).
I need to extract the viewstate from this backed up db and install into te restored one from a few days back(so users cannot tell the difference).
I have worked all night but due to tiredness and mental insufficiency have not managed to get it going.
Add to that the fact this forum seems to be having trouble staying online over the past 24 hours and i’m losing my mind.