[mythtvnz] Help needed to restore database
Stephen Worthington
stephen_agent at jsw.gen.nz
Sun Jun 15 04:48:59 BST 2014
On Sun, 15 Jun 2014 13:59:19 +1200, you wrote:
>On Sun, 15 Jun 2014 13:48:52 +1200, Paulgir <paulgir at gmail.com> wrote:
>
>>
>> I switched on my Myth box today to find that there were no recordings
>> listed.Possibly this may be related to an optimize db cron job that was
>> scheduled last night ,but I can not be sure of that.
>> I tried to restore a database back up from yesterday,but when I try
>> mythconverg_restore.pl command I get command not found messages.
>> I have tried this from the ~$ prompt and from the /usr/share/mythtv$
>> prompt.
>> Is they any other way I can do a db restore?
>
>I have just noticed that all the scheduled programs for the future are
>still listed,though I am not sure what this means.Database not lost after
>all?
The very first thing to do when having possible database problems is
to do a manual backup of the database before touching anything. In
Mythbuntu, the backup and restore scripts are here:
/usr/share/mythtv/mythconverg_backup.pl
/usr/share/mythtv/mythconverg_restore.pl
By default, Mythbuntu only does weekly backups from here:
/etc/cron.weekly/mythtv-database
and they are stored in:
/var/lib/mythtv/db_backups
I always add an edited copy of the mythtv-database file to:
/etc/cron.daily
so that I get daily backups to a different hard drive as well as the
weekly default ones. I have my daily backups going to another PC on
my network. It pays from time to time to check that the backups are
actually working by going to the destination directories and checking
the file dates and sizes.
It is also recommended that you turn on the option in Mythbuntu
Control Center that does daily database optimizations. That runs
from:
/etc/cron.daily/optimize_mythdb
Doing a daily check and repair seems to prevent most database
corruptions from ever happening.
If you have email working on your Mythbuntu box, you get a email from
cron jobs like optimize_mythdb showing their log output. I check that
email every day to make sure the database is good. When I installed
smartd to monitor my hard drives (highly recommended!), it installed
the email packages (I think it is postfix and mailx) so that it could
email me when I have hard drive problems. I am using the default
email setup where I log in to a root command prompt and run the mail
command to see the cron emails. It is also possible to have the
emails sent to a different address (eg your normal email account).
What I would recommend for you to do now is first to check where your
database backups are stored and see if they have been working
properly. If so, you should see a set of backup files of similar
size. Then copy those backups somewhere safe, as making further
backups rotates the old ones, deleting the oldest every time a new one
is made.
Then run mythconverg_backup.pl manually (from a root prompt or with
sudo) and make sure it works. If the database is corrupt, sometimes
it is corrupt enough to make backups fail. In any case, if the backup
succeeded or failed, you need to then manually run optimize_mythdb
(from root) to check if the database is corrupt and to try to repair
it.
More information about the mythtvnz
mailing list