System crash......lost data

browndrake wrote on Friday, May 29, 2009:

Today, there was a power outage and my server was shut down by it.   Upon rebooting the server, I got a string of error messages…mostly of the flavor:
ata1.00 status drdy err

afterwards, it finished booting.

To my surprise, their was about 10 days of data missing from the calendar of oemr. 

This is not critical…all but today was backed up anyhow…and I am still using very little of the app.

However, more of curiosity than anything I was wondering if anybody had experienced such or knows what happened.

I added new patients today.  They and their data are still there.  The only thing that seems missing, is calendar items that were entered during the last 10 days.

The calendar shows appointments for next week, that were made longer ago.  It does not show any appointments from the last 10 days nor any future appointments that were scheduled during the last 10 days.

any ideas why this might happen?  any ideas on how one might attempt to ‘find’ the lost items…or at least those from today?

thanks for any feedback

aaron

bradymiller wrote on Friday, May 29, 2009:

hey,
  Possibly a corrupted mysql table. Check the openemr_postcalendar_events table in your database to see if the raw data’s there (this is where appt are kept). If it’s corrupted, then there’s a simple way to repair it.
-brady

bradymiller wrote on Friday, May 29, 2009:

Also,
As an aside, I’d rec. getting a power backup to your server, and set it up to safely shut down your server when power goes down.
-brady

drbowen wrote on Friday, May 29, 2009:

It will be helpful if you post your operating system type and version, MySQL version, PHP version and OpenEMR version.

MySQL does not like sudden power loss and generally at least some of the tables get corrupted.  From the command prompt run:

mysqlcheck --all-databases -u root -p

This is the reference page:

http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html

Sam Bowen, MD

browndrake wrote on Monday, June 01, 2009:

There does appear to be a corrupted table.  Here is the system info and the error message from mysqlcheck:

Ubuntu 8.10

Linux server 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686

PHP Version 5.2.6-2ubuntu4.1

mysql     5.0.67-0ubuntu6 (Ubuntu)

OpenEMR v3.0.0-rc1

openemr.openemr_postcalendar_events
warning  : Size of datafile is: 44208       Should be: 36856
error    : got error: 5 when reading datafile at record: 81
Error    : Error reading file ‘./openemr/openemr_postcalendar_events.MYD’ (Errcode: 5)
error    : Corrupt

Yes, I do need to get a back-up power source and a few other things.

I am currently running two versions of oemr on both linux and windows. I hoped to have dug much farther into it by now, but was hit with other time constraints. Hopefully, I can now make the time to become much more oemr literate.

Brady, what is the simple way to repair tables?

thanks for both of your feedback/help.

aaron

sunsetsystems wrote on Monday, June 01, 2009:

By the way a laptop or netbook computer might be a good bet for a server, since the battery backup is built in and long-lasting.  If you get a UPS, do some research and get a good one.  In my experience a cheap UPS will create more problems than it solves.

Rod
www.sunsetsystems.com

browndrake wrote on Monday, June 01, 2009:

the laptop might be a good way to go.  My old laptop’s battery does not run long anymore, but longer than most back up power systems, and it also has more guts than the computer that I am currently using for the server.

I guess that there would be some way to have it detect power outage and automatically safely power down?

aaron

sunsetsystems wrote on Monday, June 01, 2009:

Ubuntu can do that.  System -> Preferences -> Power Management controls the details.  Doubtless other Linux flavors have their own ways to do it.  It might not work with some laptops.

Rod
www.sunsetsystems.com

bradymiller wrote on Monday, June 01, 2009:

hey,

Can do on commandline  or via phpmyadmin.

Check out this primer on database repair via commandline:
http://dev.mysql.com/doc/refman/5.1/en/repair.html
The important stuff is in Stage 1: and Stage 2: (hopefully you only require the ‘Easy safe repair’).

Check out this even easier way to do in phpmyadmin (should work using the one embedded in openemr at admin->database menu), very easy, but rec. backing up database before doing this one:
http://techblissonline.com/mysql-tables-corrupt-crash-repair-phpmyadmin/

-brady

drbowen wrote on Monday, June 01, 2009:

Mysqlcheck is optimized for finding and repairing tables.  For MyISAM tables it usually does the repair as it finds the error.

You might just rerun the command to see if the table is now repaired.

Sam Bowen, MD

browndrake wrote on Monday, June 01, 2009:

upon re-running it, it  does now show that the table is okay.  It did not, however, recover any of the lost data.  (should it have)

as I said, it is not critical now…But I am trying to problem solve for the future also…when it may be critical

aaron

drbowen wrote on Tuesday, June 02, 2009:

As I said above:

MySQL does not like sudden power loss and generally at least some of the tables get corrupted.

This includes some data loss.

Yes, there is something you can do.  Get a good battery backup.  Install a gas generator on your building.  Run backups.  Keep remote copies.

The are reasons that these things keep getting brought up.  Life is not perfect.  Things happen. Hurricanes, Tornadoes, Fire, War, Police states.  The fire usually states in the area of most heat.  This is frequently the server room.

A wise man once said their are only two types of system administrators: Those who make back-ups and those who never have hardware failure.

Sam Bowen, MD

browndrake wrote on Tuesday, June 02, 2009:

Well, thanks all.  I really liked Rod’s idea of using my laptop for a server. I think I will test that out and see how it works.

All your dedication and feedback is appreciated.

aaron