[mythtv-users] partial database restore

Michael T. Dean mtdean at thirdcontact.com
Tue Sep 17 14:18:35 UTC 2013


On 09/16/2013 07:11 PM, UB40D wrote:
> Restoring only the useful parts of a database
>
> I had a mythbuntu system that would often give "recorder failed" and
> litter the media library with 4 identical entries of the failed
> recording, each with "this file cannot be found" if you selected it,
> which were a pain to delete. Since I was not able to fix the issue, I
> decided to reinstall everything from zero on a new hard disk. I did
> take a backup of the database before reinstalling.
>
> I would now like to restore the old recordings (the ones that work)
> and their metadata. In particular what I'd like is, for each .mpg, its
> name, description and the manually-entered cut list that defines the
> ads to be skipped. I don't terribly mind losing the date that the
> shows were recorded or the channel they came from, but I would very
> much mind losing the cut lists and of course the film names, which I
> understand would happen if I just copied the mpgs into the video
> directory.
>
> However I don't really want to restore all of the old database which
> is full of that junk (empty entriesfor orphaned recordings
> that never happened).

http://www.mythtv.org/wiki/Find_orphans.py

>   I am also suspicious that the
> faulty behaviour of the old system was perhaps due to
> slightly incorrect backend configuration (channels, capture cards,
> video sources, input connections etc) that might be stored in the
> database as well; I don't want to overwrite the new ones of the
> reinstalled system that finally work with the old ones that didn't.

There's definitely no support, whatsoever, for "merging" data from 
multiple databases.

If your input connections configuration (which entails everything you 
mentioned, above) is broken, you can clear it (completely--as if you 
were starting with a brand-new, empty database) with "Delete all video 
sources" and "Delete all capture cards" (not "Delete all capture cards 
on <hostname>").  
http://www.gossamer-threads.com/lists/mythtv/users/264034#264034

Then, it's just a matter of (using the knowledge gained when you 
configured it properly, this time), reconfiguring it properly.

> I have read
> http://www.mythtv.org/wiki/Database_Backup_and_Restore#Change_the_hostname_of_a_MythTV_frontend_or_backend
> and noticed their insistence on how bad a partial restore is, and that a
> full restore is what every sane person should do. However I fear that
> if I do a full restore I'll end up with as broken a system as the one I had
> before reinstalling.
>
> I would simply like to restore the names and cut lists of the .mpgs
> that I have. Nothing else. Can I? What should I do? Is it OK to take the
> database dump and, before importing it, delete everything except the
> statements for the tables that contain the names and cut lists?
>

Cutting out parts of the database backup and sticking them into a 
different database is akin to grabbing bytes within a Word document and 
sticking them into another.  It's not the recommended approach for 
editing, and it requires learning the data constraints/format/language 
completely.  It may or may not work, and may cause problems that are 
only visible days/weeks/months down the line.

A partial restore is only useful for fixing a corrupt schema or for 
getting rid of untrusted/corrupt data (and, really, only if that data 
exists in certain tables).  And, a partial restore can only be performed 
on an empty database.  Any other "manual" partial restore is likely to 
cause data integrity problems that may well create more problems than 
getting rid of your old database "solved"--especially when there are 
good ways to clean up orphaned recordings (file and/or metadata) and bad 
configuration in your old database.

If you have some new recordings on the new system, your best bet for 
them will be to put them into the managed-by-the-user video section, the 
Video Library (and you may even want to consider doing the same for any 
other recordings you may want to keep - 
http://www.gossamer-threads.com/lists/mythtv/users/519758#519758 ).

Mike


More information about the mythtv-users mailing list