[mythtv-users] What to do if your upgrade fails (was Re: 0.22 database schema upgrade fails driver not loaded)

Michael T. Dean mtdean at thirdcontact.com
Fri Nov 6 03:19:33 UTC 2009

On 11/05/2009 07:34 PM, Chris Tepe wrote:
> Michael T. Dean wrote:
>>> On 11/05/2009 05:26 PM, Chris Tepe wrote:
>>>> If I drop the old database and start with a blank database 
>>>> everything appears to be working.  The issue occurs when upgrading 
>>>> the old database.  If I can't upgrade the old database how do 
>>>> import my previous settings? Or can the upgrade be done off line? 
>>> Any chance you could http://filebin.ca/ (or post elsewhere) a 
>>> gzip'ed or bzip2'ed copy of your 0.21-fixes (or whatever pre-upgrade 
>>> version you were using) database backup for me to check out to see 
>>> if we have an unhandled issue in the upgrades along the way? 
> Her you go
> Your file is available at

After looking at Chris's backup, I found that the schema was modified in 
such a way that it causes problems that prevent the DB upgrade from 
succeeding.  The solution here is to do a partial restore and only keep 
the "non-re-createable" data.  With this solution, you will save all 
your recording metadata, your recording rules, and your recording 
history.  All other data can be re-created.

Unfortunately, a partial restore can only be done with the same DB 
schema version.  Therefore, to do this prior to an upgrade, you'll need 
a blank 0.21-fixes DB into which to restore the portion of your 
corrupted database.  You can get one using 0.21-fixes mythtv-setup, 
but--since you've already found out your upgrade to 0.22 failed--you 
probably don't have 0.21-fixes installed, anymore.

Therefore, attached is a copy of a "blank" 0.21-fixes database backup.  
(Yes, it has some data--that data is all required data created when the 
schema is created and is not host-specific, so don't delete it.)

Note that this "blank" database backup will *ONLY* work with a 1214 or 
1215 database backup.  1214 is MythTV 0.21-fixes and 1215 is just before 
the database characterset conversion--i.e. what you'll likely have if 
your upgrade fails and you forgot to do a real backup before upgrading 
or some script helpfully deleted your 1214 backup.

Save the backup to your HOME directory and verify that you have the 
right one (see the md5sum and sha1sum, below), then follow the steps 
below to upgrade your database:

1) Back up your database ( 
http://www.mythtv.org/wiki/Database_Backup_and_Restore )


2) DROP your old database:

cat << "EOF" | mysql -umythtv -p mythconverg

(and, no, the "latin1" is not a typo or a mistake, and, no, the "latin1" 
won't cause any issues for users with non-latin characters).

3) Do a complete restore of the blank MythTV 0.21-fixes database:

mythconverg_restore.pl --dir=$HOME --file=mythconverg-1214-blank.sql 

4) Do a partial restore of your backup (fix the filename and directory 
as appropriate):

mythconverg_restore.pl --dir=$HOME 
--file=mythconverg-1214-20091105184542.sql.gz --verbose

5) Run the 0.22rc or 0.22-fixes or trunk mythtv-setup .  It should 
successfully upgrade your database.  You will then have to reconfigure 
MythTV (all of mythtv-setup configuration and all of mythfrontend 
settings) and your plugins.  (And, on the bright side, having to redo 
your settings means that you will get to go through all the settings 
that have been added since you first configured and set them the way you 
really want them. :)

Good luck,

$ md5sum mythconverg-1214-blank.sql.gz
3684bdc9b80420aa965ac51211dacd41  mythconverg-1214-blank.sql.gz
$ sha1sum mythconverg-1214-blank.sql.gz
d966269cdfdb8b4a8991b65bf68b1048d2e2107e  mythconverg-1214-blank.sql.gz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythconverg-1214-blank.sql.gz
Type: application/gzip
Size: 7521 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20091105/5df06fff/attachment-0001.bin>

More information about the mythtv-users mailing list