Well there's no undo

Yesterday i was working hard.. not hardly working as i was all week...
And suddenly somebody told me to check the announcements section in the system that i developed at work... i read that i had to delete two records from the database... well.. here's story.

I checked and see that evidently those two records should be deleted... so... i wrote a query in order to delete the status from a single job. Those records were made last year.. or at least they had last year dates.. so i should've written a query to delete those records... instead.. i wrote one that deleted 14994 records... actually.. every record from last year.. was deleted.. in just seconds!!!!..

Now that's a problem.. i thought... so.. ill keep my mouth shut and try to restore that info before anyone notices it. But i couldn't... i mean.. someone noticed it... and i had to say that there was a server error... actually it was programmer's error.. but i wouldn't admit such a thing.. so... i went to my last backup... that one had all those records deleted.. i just need to pass them from my laptop to company's server.
i tried to look for an undo query or something that would be easy to do.. but aftes a couple of hours i didn't find anything... so i made a little script that would restore all data.

after making a couple of tests on my laptop... i was ready to make the restore script run in the company's server. I was succesfull... 14992 records were inserted back to the status table in the database... but.. still 2 records were missing... i hope those are not as important as they could...

Anyways.. that time.. i spend trying to make things were back to normal... i couldn't spend it on upgrades as i would like... so now i have to do that work on monday..and the system upgrade would be once again.. a little delayed.

There's a new version for the dbms... but i'mnot sure if i should install it, since.. my laptop stoped working the same way as the server... and i have the new version in my laptop but server has an older version... ough.. desitions... i hope it's just a little bug.

2 commenti:

Dajoropo ha detto...

Wow!!, I was thinking that the story was going to have worse ending, like Kluzter fired, without job anymore, under the rain in the middle of the street... it's good you solved it! :)

F. Dwarf ha detto...

What did we learn?
*The importance of explicit commits.
*The importance of user requirements understanding.
*The importance of the RESTORE clause.
*The real mean of ROLLBACK.
*The importance of often database backups.
*That you can lose your job in matter of (milli)seconds