[mythtv-users] db upgrade ? please help :)

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Sep 22 02:41:39 UTC 2013


On Sat, 21 Sep 2013 17:33:25 -0400, you wrote:

>On Sat, Sep 21, 2013 at 2:37 PM, fordy ydrof <fordy at ydrof.com> wrote:
>> Database error was:
>> Table './mythconverg/recordmatch' is marked as crashed and last (automatic?)
>> repair failed
>
>You need to fix this within mysql before doing anything with mythtv.
>
>I'd start with running:
>
>mysqlcheck --auto-repair mythconverg
>
>and then see how it goes after that.
>
>Eric

Yes, it looks like your old 0.24 database is a little corrupt and
needs repair before attempting the upgrade.  In Mythbuntu installs,
there is a cron.daily script that you normally turn on from Mythbuntu
Control Center that does a full check/repair on the database each day
to prevent this sort of problem.  So after you have things working
again, you might like to do the same thing.  Here is a copy of the
script (optimise_db):

#!/usr/bin/perl -w
#
# Connects to the mythtv database and repairs/optimizes the tables
that it
# finds.  Suggested use is to cron it to run once per day.
#
# @url       $URL$
# @date      $Date$
# @version   $Revision$
# @author    $Author$
# @license   GPL
#

# Includes
    use DBI;
    use MythTV;

# Connect to mythbackend
    my $Myth = new MythTV({'connect' => 0});

# Connect to the database
    $dbh = $Myth->{'dbh'};

# Repair and optimize each table
    foreach $table ($dbh->tables) {
        unless ($dbh->do("REPAIR TABLE $table")) {
            print "Skipped:  $table\n";
            next;
        };
        if ($dbh->do("OPTIMIZE TABLE $table")) {
            print "Repaired/Optimized: $table\n";
        }
        if ($dbh->do("ANALYZE TABLE $table")) {
            print "Analyzed: $table\n";
        }
    }


More information about the mythtv-users mailing list