Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table corruption... 2

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
PH
Hi everyone....

I've noticed as we used my multi user (LAN) application, that during power interruption ( i dnt have UPS) the affected tables are always desame... corruption... in the access of those table, i use INSERT INTO... instead of APPE BLANK, does it have something to do with FLOCK() although i have not used FLOCK(). Do i need to put FLOCK() everytime I use INSERT into? do i have to change INSERT INTO to APPE BLANK? May I know whats the difference/s between the two? Thanks in advanced experts....
 
Mandy, there is no programming technique that will avoid file corruption from a power outage. In a power outage without a UPS, the last state of the file will be what it is and can easily be corrupted, no matter if you use INSERT INTO or APPEND BLANK. No command does it better than the other. Both extend the file by one record and change the record count in the header. When that's actually written to the file and in which order is not even decided by VFP, but the hardware controller of the drive. So the thing to change, if power outages are not rare in your area, is to have a UPS. Not to change your code.

Do you need advice to repair the DBFs or do you have the tools for that?

Chriss
 
I have a folder full of bookmarks for DBF repair utilities, but most of them seem to be out of date or no longer available. Here are two that at least still seem to be in existence:



Don't take this as a recommendation. I've no personal experience of either of them. Power failures are very rare where I live, and when they do occur we often get a warning. (Perhaps I shouldn't have said that. I might be tempting fate.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The most important thing you need to do is get a UPS (uninterruptible power supply) for every computer involved. Then, if power fails, you have time to shut down in an orderly way.

Tamar
 
Thank you Chriss Mike and Tamar...power outages here is almost three time a week... I think i willa have to buy a UPS... Thanks everyone.. I will just have to repair the corrupted dbf... God bless...
 
The last power outage I experienced myself was about 8 years ago. And as I used a laptop the only thing that was gone was the internet. In your area, I would use no other computers but laptops. That doesn't work for things like a server rack or a NAS storage device, but a UPS is serving power to such things.

How long are the power outages, typically?

Chriss
 
Yes Mike. Believe or not... There are days that twice a day... And Chriss usually 15 to 30 mins... OMG...
 
Mandy said:
15 to 30 mins... OMG

Well, a UPS can last for such a time. And a laptop battery? Easy.

A UPS is something you'd normally only use to have a graceful shutdown of all systems, when you don't know how long the outage lasts. It's not used to continue working, usually. But if you have that usual breaks that's something you could plan for and manage to fix with a UPS for having continuous power. The only issues is, that the laptop battery and also a UPS need to charge/recharge to cover the next outage, of course. And, well, even if you power everything up to the final endpoint where you connect to the landline or cable the internet uses, it'll not just be a matter of your power bridging, whether that works.



Chriss
 
Mandy, I'm only asking this out of curiosity, but are these power outages widespread across your entire community, or are they specific to your house or office building?

If the former, you would expect local politicians or activists to be making a fuss - or even pressure groups being set up to demand action.

If the latter, then it is presumably caused by some fault in the supply system. Have you had it investigated by an electrician?

Either way, it's hard to imagine modern society functioning without a reliable supply of electricity.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike
I think the Philippines are not well known for stable electrical supply.




If you want to get the best response to a question, please check out FAQ184-2483 first.
 
True Mike... Only in our municipality, i dnt know in other places Mike... We always complain but they always say clearing operation....

Your also correct Mike gagnon
 
Or, make sure your users are on laptops with batteries, then no need for UPS at the user side. Just need one on the server if you're running in client/server environment.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
I have an UPS on my main workstation (and screen) and I can work over 4 hours on that. That said, the longest outage I can remember the last 20 years was maybe 30 seconds :)
 
Where I live, the power lines are above ground and there are many old trees, so we get several power outages a year ranging from a quick flash of the lights to many hours. (Longest I can recall was about 2.5 days after a major storm that knocked out power to hundreds of thousands.) We finally put in a generator a couple of years ago.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top