Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the worst database accident that happened to you in production? [closed]

For example: Updating all rows of the customer table because you forgot to add the where clause.

  1. What was it like, realizing it and reporting it to your coworkers or customers?
  2. What were the lessons learned?
like image 989
binOr Avatar asked Aug 15 '08 11:08

binOr


People also ask

What is a production database?

A production database contains the data you are using for production tasks such as creating and updating features. Depending on the data model you are using, data in a production database can be used to create a digital or hard-copy map or chart or a specific type of data.

What happens when a database crashes?

If a failure occurs before all of the changes that are part of the unit of work are completed, committed, and written to disk, the database is left in an inconsistent and unusable state. Crash recovery is the process by which the database is moved back to a consistent and usable state.

What causes database crashes?

A great number of database crashes are caused by file permission issues, corrupted data, and index files. There are several reasons for this: 1.) Other processes are modifying a data or index that is written by the database without accurate locking.

What is the meaning of database crash?

Literally, database crash means that the database itself is damaged in some way. A disk is no more. Data files are corrupted. Etc. The database itself thus causes the crash - and a database crash will also cause all database instances (RAC or single) for that database to crash too.


3 Answers

I think my worst mistake was

truncate table Customers
truncate table Transactions

I didnt see what MSSQL server I was logged into, I wanted to clear my local copy out...The familiar "OH s**t" when it was taking significantly longer than about half a second to delete, my boss noticed I went visibily white, and asked what I just did. About half a mintue later, our site monitor went nuts and started emailing us saying the site was down.

Lesson learned? Never keep a connection open to live DB longer than absolutly needed.

Was only up till 4am restoring the data from the backups too! My boss felt sorry for me, and bought me dinner...

like image 88
Surgical Coder Avatar answered Nov 03 '22 04:11

Surgical Coder


I work for a small e-commerce company, there's 2 developers and a DBA, me being one of the developers. I'm normally not in the habit of updating production data on the fly, if we have stored procedures we've changed we put them through source control and have an officially deployment routine setup.

Well anyways a user came to me needing an update done to our contact database, batch updating a bunch of facilities. So I wrote out the query in our test environment, something like

update facilities set address1 = '123 Fake Street'
    where facilityid in (1, 2, 3)

Something like that. Ran it in test, 3 rows updated. Copied it to clipboard, pasted it in terminal services on our production sql box, ran it, watched in horror as it took 5 seconds to execute and updated 100000 rows. Somehow I copied the first line and not the second, and wasn't paying attention as I CTRL + V, CTRL + E'd.

My DBA, an older Greek gentleman, probably the grumpiest person I've met was not thrilled. Luckily we had a backup, and it didn't break any pages, luckily that field is only really for display purposes (and billing/shipping).

Lesson learned was pay attention to what you're copying and pasting, probably some others too.

like image 26
Marshall Avatar answered Nov 03 '22 04:11

Marshall


A junior DBA meant to do:

delete from [table] where [condition]

Instead they typed:

delete [table] where [condition]

Which is valid T-Sql but basically ignores the where [condition] bit completely (at least it did back then on MSSQL 2000/97 - I forget which) and wipes the entire table.

That was fun :-/

like image 6
Keith Avatar answered Nov 03 '22 05:11

Keith