Well crap. Automatic failed, and repair failed, 5 lines of code listed,
- Runtime error near line 2379423: UNIQUE constraint failed: statistics_media.id (19)
Well crap. Automatic failed, and repair failed, 5 lines of code listed,
Try Option 9, replace. It will check the backup versions, if any exist, and see if any of them are OK.
Example:
Enter command # -or- command name (4 char min) : 9
Checking the PMS databases
Check complete. PMS main database is OK.
Check complete. PMS blobs database is OK.
Are you sure you want to restore a previous database backup (Y/N) ? y
yChecking for a usable backup.
Database backups available are: 2023-06-22 2023-06-19 2023-06-16 2023-06-13
Checking database 2023-06-22
Found valid database backup date: 2023-06-22
Use backup '2023-06-22' ? (Y/N) ?
Letting it run one more pass, then that will be next. Not sure how long itās been corrupted, tho.
Trying to make it stop running now.
Says PMS main db is damaged, blobs ok. No backups available. Only available option is repair, and repair didnāt work. Could that be because I ran the newest (non-working) release of plex?
Logs show:
==================================================================================
2023-06-24 19.36.14 - ============================================================
2023-06-24 19.36.14 - Session start: Host is Synology (DSM 7)
2023-06-24 19.36.25 - Auto - START
2023-06-24 19.36.28 - Check - Check com.plexapp.plugins.library.db - FAIL (DBRepair.log com.plexapp.dlna.db com.plexapp.dlna.db-shm com.plexapp.dlna.db-wal com.plexapp.plugins.library.blobs.db com.plexapp.plugins.library.blobs.db-2022-09-22 com.plexapp.plugins.library.blobs.db-2022-09-25 com.plexapp.plugins.library.blobs.db-2022-09-28 com.plexapp.plugins.library.blobs.db-2022-10-01 com.plexapp.plugins.library.blobs.db-shm com.plexapp.plugins.library.blobs.db-wal com.plexapp.plugins.library.db com.plexapp.plugins.library.db-2021-01-30 com.plexapp.plugins.library.db-2021-02-02 com.plexapp.plugins.library.db-2021-02-05 com.plexapp.plugins.library.db-2021-02-08 com.plexapp.plugins.library.db-damaged dbtmp in database main DBRepair.log com.plexapp.dlna.db com.plexapp.dlna.db-shm com.plexapp.dlna.db-wal com.plexapp.plugins.library.blobs.db com.plexapp.plugins.library.blobs.db-2022-09-22 com.plexapp.plugins.library.blobs.db-2022-09-25 com.plexapp.plugins.library.blobs.db-2022-09-28 com.plexapp.plugins.library.blobs.db-2022-10-01 com.plexapp.plugins.library.blobs.db-shm com.plexapp.plugins.library.blobs.db-wal com.plexapp.plugins.library.db com.plexapp.plugins.library.db-2021-01-30 com.plexapp.plugins.library.db-2021-02-02 com.plexapp.plugins.library.db-2021-02-05 com.plexapp.plugins.library.db-2021-02-08 com.plexapp.plugins.library.db-damaged dbtmp On tree page 640825 cell 41: Extends off end of page)
2023-06-24 19.37.08 - Check - Check com.plexapp.plugins.library.blobs.db - PASS
2023-06-24 19.37.08 - Check - FAIL
2023-06-24 19.40.43 - Repair - Export databases - PASS
2023-06-24 19.42.36 - Repair - Cannot import main database from './dbtmp/library.plexapp.sql-2023-06-24_19.36.25' - FAIL (1)
2023-06-24 19.42.36 - Repair - FAIL
2023-06-24 19.42.36 - Auto - FAIL
2023-06-24 19.46.10 - Repair - Export databases - PASS
2023-06-24 19.48.05 - Repair - Cannot import main database from './dbtmp/library.plexapp.sql-2023-06-24_19.42.36' - FAIL (1)
2023-06-24 19.48.05 - Unknown command: 'Runtime error near line 2379424: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.48.05 - Unknown command: 'Runtime error near line 2379425: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.48.05 - Unknown command: 'Runtime error near line 2379426: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.48.05 - Unknown command: 'Error 1 from Plex SQLite while importing from './dbtmp/library.plexapp.sql-2023-06-24_19.36.25''
2023-06-24 19.48.05 - Unknown command: 'Cannot continue.'
2023-06-24 19.53.20 - Repair - Export databases - PASS
2023-06-24 19.55.14 - Repair - Cannot import main database from './dbtmp/library.plexapp.sql-2023-06-24_19.48.05' - FAIL (1)
2023-06-24 19.55.14 - Unknown command: 'Runtime error near line 2379424: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.55.14 - Unknown command: 'Runtime error near line 2379425: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.55.14 - Unknown command: 'Runtime error near line 2379426: UNIQUE constraint failed: statistics_media.id (19)'
2023-06-24 19.55.14 - Unknown command: 'Error 1 from Plex SQLite while importing from './dbtmp/library.plexapp.sql-2023-06-24_19.36.25''
2023-06-24 19.55.14 - Unknown command: 'Cannot continue.'
2023-06-24 19.59.50 - Repair - Export databases - PASS
2023-06-24 20.01.45 - Repair - Cannot import main database from './dbtmp/library.plexapp.sql-2023-06-24_19.55.14' - FAIL (1)
2023-06-24 20.01.45 - Exit - Retain temp files.
2023-06-24 20.02.24 - ============================================================
2023-06-24 20.02.24 - Session start: Host is Synology (DSM 7)
2023-06-24 20.04.56 - Replace - Check com.plexapp.plugins.library.db - FAIL (DBRepair.log com.plexapp.dlna.db com.plexapp.dlna.db-shm com.plexapp.dlna.db-wal com.plexapp.plugins.library.blobs.db com.plexapp.plugins.library.blobs.db-2022-09-22 com.plexapp.plugins.library.blobs.db-2022-09-25 com.plexapp.plugins.library.blobs.db-2022-09-28 com.plexapp.plugins.library.blobs.db-2022-10-01 com.plexapp.plugins.library.db com.plexapp.plugins.library.db-2021-01-30 com.plexapp.plugins.library.db-2021-02-02 com.plexapp.plugins.library.db-2021-02-05 com.plexapp.plugins.library.db-2021-02-08 com.plexapp.plugins.library.db-damaged dbtmp in database main DBRepair.log com.plexapp.dlna.db com.plexapp.dlna.db-shm com.plexapp.dlna.db-wal com.plexapp.plugins.library.blobs.db com.plexapp.plugins.library.blobs.db-2022-09-22 com.plexapp.plugins.library.blobs.db-2022-09-25 com.plexapp.plugins.library.blobs.db-2022-09-28 com.plexapp.plugins.library.blobs.db-2022-10-01 com.plexapp.plugins.library.db com.plexapp.plugins.library.db-2021-01-30 com.plexapp.plugins.library.db-2021-02-02 com.plexapp.plugins.library.db-2021-02-05 com.plexapp.plugins.library.db-2021-02-08 com.plexapp.plugins.library.db-damaged dbtmp On tree page 640825 cell 41: Extends off end of page)
2023-06-24 20.05.26 - Replace - Check com.plexapp.plugins.library.blobs.db - PASS
2023-06-24 20.05.26 - Replace - Scan for usable candidates - FAIL
==================================================================================
@SandmanXX Quick question. Did you run the DBRepair utility with sudo or directly as root? It must be run that way to succeed.
I wonder if I start up the last working plex, then try the DB repair again. Hereās the last run on repair:
Enter command # -or- command name (4 char min) : repair
Exporting current databases using timestamp: 2023-06-24_20.20.24
Exporting Main DB
Exporting Blobs DB
Successfully exported the main and blobs databases. Proceeding to import into new databases.
Importing Main DB.
Runtime error near line 2379423: UNIQUE constraint failed: statistics_media.id (19)
Runtime error near line 2379424: UNIQUE constraint failed: statistics_media.id (19)
Runtime error near line 2379425: UNIQUE constraint failed: statistics_media.id (19)
Runtime error near line 2379426: UNIQUE constraint failed: statistics_media.id (19)
Error 1 from Plex SQLite while importing from ā./dbtmp/library.plexapp.sql-2023-06-24_20.20.24ā
Cannot continue.
I think I ran it as root.
I did sudo -i
Give it a try. It might work.
Uninstall Plex Media Server with the ākeepā option. Uninstall ā Are You Sure ā Uninstall Only.
You can then install the older version.
That works. Just wanted to check.
I got 6973 up and running, logged on to see if it works.
Still says Main DB is damaged. Donāt know where to go from here, except a complete rebuild, I guess.
Suggest?
Solve why it got shutdown HARD
There are no backups, somehow. I started the oldest working, seems to work fine generally. movie and music all there.
If there are no backups ?
ā this is a new installation and it got corrupted that fast ? WHY? Power fail? Hard Power OFF / Shutdown of DSM ?
If you have only a corrupt section or twoā¦
ā delete each and recreate
This installation is 3+ years old, I occasionally optimize database by hand, has seemed to work fine, I donāt know what part is corrupted, or I would wipe and rebuild whatever part is bad. There have been 2-3 power outs at the house over the past 2 years, although the NAS is on a UPC, who knows on that one.
Sorry if iām slow here.
what happened to the backup files which PMS makes automatically every 3 days?
The backups would be (by default) adjacent the actual database files in the āDatabasesā directory
unless you changed the backup location in settings - Server - Scheduled Tasks.
Side note: There is a way to āforceā this to import. Cannot guarantee the result but it can be forced.
After running dbrepair, it couldnāt find the backups, so Iām up for whatever we need to do.
And yes, the backup files are under pluginsupport/databases
The script doesnāt remove the PMS-created backup files. They are held as sacred / pristine.
Are you recommending the import option in dbrepair? still have that open atm
In hindsight, it appears the last backups were made in 9-22. well now.