For those we lost, We will not forget 09/11/2001 “Our God given unalienable rights are given to us all as individuals. They tell us what me may do for ourselves, and they are the embodiment of liberty. The so-called rights that government gives to some of us are parcelled out to select groups as classes. They tell us what one class of people may require another to do for them, and they are the very essence of slavery.”
— Perri Nelson, February 9, 2010

A bheil Gàidhlig agaibh?

Stupid developer tricks


Published Thu, Jan 22 2009 11:23 AM

Never, never execute an update SQL query without remembering to put in a WHERE clause. Or, if you're going to do something that bone-headed, be sure to have a recent backup of your data.

I just committed the bone-headed mistake mentioned above with my site database. For a few brief moments there, every comment on the site was the same. I even forgot to use my regular safety net of putting the update inside a transaction with a rollback to test it before actually committing the changes.

Fortunately for me, my hosting provider backs up my data daily. Today their customer support saved my bacon, and most of my data. I lost everything in the system since I replied to David's comments yesterday. I did lose a few of your comments, but I'll be restoring those as soon as I can.

And, yes Mr. Foley, if you're reading this, I'll remember to use WHERE clauses in the future.


Trackback URI for this post: http://perrinelson.com/track.aspx?postid=1301
Permalink URI for this post: http://perrinelson.com/2009/1/22/1301.aspx


Subscribe to this entry's comment feed. (Atom)

Perri Nelson responded with: Restoration complete

Gravatar

I've restored all of the comments using the data in my email. If I missed any, I'm sorry.

Hopefully this won't happen again, but... thank God for backups.

ablur responded with:

Gravatar
I posted a comment on Spec at 4am pacific. Perhaps it is still out there somewhere.

Perri Nelson responded with: Lost comments

Gravatar
I'm sorry ablur, I had most of the comments still in email. That one was never delivered to my inbox.

David responded with:

Gravatar
*heh* At least it wasn't to someone else's site or system. I can recall recently (it pretty well has to be for me to recall it; I'm coffee-deprived today) carefully backing up someone else's Outlook Express email--2 different ways--before deleting their Inbox, the recommended method of fixing a FUBAR-ed Inbox. Never did get all the mail reimported. Ended up having to do a raw read of the exported emails, strip a lot of ASCII stuff and give 'em plain text files with the contents of the emails.

If only I'd bid that as an hourly gig... ;-)

Now, messing up my own systems or site, hey! I can live with that... for a while. (But yeh, I do love backups! And glad my hosting service backs up daily, too. Of course, I do a simple backup of my WP portion myself, just because. It's gotten to big for me to autonagically email it to myself, so remembering to download the thing after the backup is another step. Gottadoit, though.)

Backups in general: very, very good things. Site backups--since my WP stuff is most easily damaged, local backups are good peace of mind for me.

Nice thing about backups of my local computers: since my hosting service upgraded my account to "unlimited" storage and bandwidth, I have another off-site backup location for local comps. Each has its own folder on its desktop and a simple drag n drop takes care of critical, changed data pretty easily. Of course, images of the systems when they're working, stored locally on removable media, are great for OS backups, but it's my data I really care about.

Stanford Matthews responded with:

Gravatar
Perri, thanks for the memories. In the late 90's I was pursuing the DIY method for an Oracle dba certification.

Delicious Bookmark this on Delicious 

Comments to this entry are closed.

View Perri Nelson's profile on LinkedIn I'm a proud friend of Israel! Are you? Republican National Committee