[mythtv-users] Questions about transitioning to new MythBox

Bruce Markey bjm at lvcm.com
Wed Sep 1 15:08:13 EDT 2004


Cory Papenfuss wrote:
...
> 1.    Partial database restoration.  Since I've fiddled around with 
> recording profiles, different capture cards (used to have bttv card 
> installed), and gone through a few releases of mythtv, I would like to 
> start with a fresh database. I would, however, like to transfer the 
> database entries for the currently stored recordings, and which episodes 
> have already been recorded.  Does anyone know of a way to do this 
> *partial* database backup/restore?

Make a backup of your database on your current system:

http://www.mythtv.org/docs/mythtv-HOWTO-21.html#ss21.5

Look in your file as see that it is thousands of lines of readable
text. Once you know up have a good current backup, then continue. 

When you first run setup, mythbackend or mythfrontend, all the
tables will be created for your new database. Therefore, you don't
need any of the CREATE TABLE statement but only need the INSERT
INTO statements for the tables you need to restore.

Restore the information from "record' (the titles you've chosen
to record), 'recorded' (the descriptive info for your recording),
'oldrecorded' (for finding duplicates that you've recorded previously)
and 'recordedmarkup' (keyframe seek info, commercial skipping, etc).

grep "INSERT INTO record "         mythtv_backup.sql > restore.sql
grep "INSERT INTO recorded "       mythtv_backup.sql >> restore.sql
grep "INSERT INTO oldrecorded "    mythtv_backup.sql >> restore.sql
grep "INSERT INTO recordedmarkup " mythtv_backup.sql >> restore.sql

Note the space after the table name and the ">>" to append to the
file for all but the first grep. "recordedmarkup" is huge and
may be hundreds of thousands of lines if you had lots of hours
of recordings.

If your hostname has changed, bring up restore.sql in an editor
to search and replace your old hostname with the new one being
careful to not replace if your old hostname appears in a show's
title or description ;-).

Once your file is ready to go:

$ mysql -u mythtv -pmythtv mythconverg < restore.sql

If something goes terribly wrong you can:

$ mysql -u mythtv -pmythtv mythconverg
mysql> delete from record;
mysql> delete from recorded;
mysql> delete from oldrecorded;
mysql> delete from recordedmarkup;

then start over. 

--  bjm


More information about the mythtv-users mailing list